linux 内核编译错误 gcc: error: elf_i386: No such file or directory
程序员文章站
2022-03-01 14:51:20
...
编译内核出现以下错误
CC arch/x86/mm/mmio-mod.o
LD arch/x86/mm/mmiotrace.o
LD arch/x86/mm/built-in.o
CC arch/x86/crypto/crc32c-intel.o
LD arch/x86/crypto/built-in.o
LDS arch/x86/vdso/vdso32/vdso32.lds
AS arch/x86/vdso/vdso32/note.o
AS arch/x86/vdso/vdso32/int80.o
VDSO arch/x86/vdso/vdso32-int80.so.dbg
gcc: error: elf_i386: No such file or directory
make[1]: *** [arch/x86/vdso/vdso32-int80.so.dbg] Error 1
make: *** [arch/x86/vdso] Error 2
看一下gcc编译器版本:
#gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
编译器是gcc-4.6.1的,编译器版本太高,对于gcc 4.6它 不再支持 linker-style 架构
解决方案:
找到对应的Makefile文件 比如上面错误中的 arch/x86/vdso/Makefile
把 -m elf_x86_64 替换为 -m64
把 -m elf_i386 替换为 -m32
推荐阅读
-
Linux内核编译时出现fatal error: openssl/opensslv.h: No such file or directory错误的解决办法
-
Linux内核编译时出现fatal error: openssl/opensslv.h: No such file or directory错误的解决办法
-
编译内核时报错:scripts/sign-file.c:23:30: fatal error: openssl/opensslv.h: No such file or directory
-
linux下编译安装MariaDB 10.4.7,解决错误:cannot access ‘/auth_pam_tool_dir’: No such file or directory
-
CocoaPods 编译错误 "clang: error: no such file or directory: 'xxx' ” 解决方案
-
fatal error: linux/compiler-gcc6.h: No such file or directory
-
解决编译openwrt mkimage时出现“linux/compiler-gcc7.h: No such file or directory”错误
-
Win10下Qt+OpenCV+Cmake编译错误记录与解决【gcc: error: long: No such file or directory】
-
linux内核编译 fatal error: openssl/opensslv.h: No such file or directory
-
C: 编译错误:fatal error: gnu/stubs-32.h: No such file or directory