【openwrt】openwrt CC 编译错误 Error: invalid instruction suffix for `p...
本帖最后由 sunsili 于 2023-7-13 16:48 编辑【openwrt】openwrt CC 编译xz-5.2.1错误 Error: invalid instruction suffix for `push'解决方法
开发环境:
源码:openwrt_CC(Chaos Calmer, r49396) 15.05
开发主机:WSL ubuntu LTS 16.04
出错文件:
crc32_x86.S
crc64_x86.S
出错提示:
libtool: compile:gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/include -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/usr/include -O2 -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/include -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/usr/include -MT liblzma_la-crc32_x86.lo -MD -MP -MF .deps/liblzma_la-crc32_x86.Tpo -c check/crc32_x86.S-fPIC -DPIC -o .libs/liblzma_la-crc32_x86.o
check/crc32_x86.S: Assembler messages:
check/crc32_x86.S:96: Error: invalid instruction suffix for `push'
check/crc32_x86.S:97: Error: invalid instruction suffix for `push'
check/crc32_x86.S:98: Error: invalid instruction suffix for `push'
check/crc32_x86.S:99: Error: invalid instruction suffix for `push'
check/crc32_x86.S:132: Error: relocated field and relocation type differ in signedness
check/crc32_x86.S:265: Error: invalid instruction suffix for `pop'
check/crc32_x86.S:266: Error: invalid instruction suffix for `pop'
check/crc32_x86.S:267: Error: invalid instruction suffix for `pop'
check/crc32_x86.S:268: Error: invalid instruction suffix for `pop'
Makefile:936: recipe for target 'liblzma_la-crc32_x86.lo' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:1550: recipe for target 'all-recursive' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:419: recipe for target 'all-recursive' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src'
Makefile:612: recipe for target 'all-recursive' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:479: recipe for target 'all' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:24: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/.built' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/tools/xz'
tools/Makefile:122: recipe for target 'tools/xz/compile' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
tools/Makefile:121: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
/home/fan/openwrt_CC_mt76xx_omj_source/include/toplevel.mk:181: recipe for target 'world' failed
make: *** Error 2
原因:
错误原因是,在64位系统和32位系统的as命令对于某些汇编指令的处理支持不一样造成的。在文件crc32_x86.S中,包含指令:pushl%ebp,该指令在64位系统下就编译不过。
解决方法:
./build_dir/host/xz-5.2.1/src/liblzma/check/crc32_x86.S中,在代码头部添加.code32
vim ./build_dir/host/xz-5.2.1/src/liblzma/check/crc32_x86.S同样的编译crc64_x86.S出现同样的问题:
check/crc64_x86.S: Assembler messages:
check/crc64_x86.S:86: Error: invalid instruction suffix for `push'
check/crc64_x86.S:87: Error: invalid instruction suffix for `push'
check/crc64_x86.S:88: Error: invalid instruction suffix for `push'
check/crc64_x86.S:89: Error: invalid instruction suffix for `push'
check/crc64_x86.S:123: Error: relocated field and relocation type differ in signedness
check/crc64_x86.S:248: Error: invalid instruction suffix for `pop'
check/crc64_x86.S:249: Error: invalid instruction suffix for `pop'
check/crc64_x86.S:250: Error: invalid instruction suffix for `pop'
check/crc64_x86.S:251: Error: invalid instruction suffix for `pop'
Makefile:943: recipe for target 'liblzma_la-crc64_x86.lo' failedMakefile:936: recipe for target 'liblzma_la-crc32_x86.lo' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:1550: recipe for target 'all-recursive' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:419: recipe for target 'all-recursive' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src'
Makefile:612: recipe for target 'all-recursive' failed
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:479: recipe for target 'all' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:24: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/.built' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/tools/xz'
tools/Makefile:122: recipe for target 'tools/xz/compile' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
tools/Makefile:121: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy' failed
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
/home/fan/openwrt_CC_mt76xx_omj_source/include/toplevel.mk:181: recipe for target 'world' failed
make: *** Error 2
同样解决方法:
crc64_x86.S中,在代码头部添加.code32
vim ./build_dir/host/xz-5.2.1/src/liblzma/check/crc64_x86.S
同样修改Makefile 使用32位编译
vim ./build_dir/host/xz-5.2.1/src/liblzma/Makefile
install_sh_DATA = $(install_sh) -c -m m32 #644
页:
[1]