尝试从本机 Linux(x86_64)编译针对目标 Linux 机器(i686)的 cmake 版本。观察到此错误:
/usr/bin/ld: i386 architecture of input file `CMakeFiles/cmTC_5398f.dir/testCCompiler.c.o' is incompatible with i386:x86-64 output collect2: error: ld returned 1 exit status
TARGET MACHINE
root@Docsis-Gateway:/tmp# uname -a
Linux Docsis-Gateway 4.9.199-yocto-standard #1 SMP PREEMPT Thu Aug 6 22:38:09 UTC 2020 i686 GNU/Linux
root@Docsis-Gateway:/tmp#
NATIVE MACHINE
prashad@ubuntu:~/.ssh$ uname -a
Linux ubuntu 5.3.0-62-generic #56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
prashad@ubuntu:~/.ssh$
.cmake 文件中以下 add_defintions 触发的错误。请帮助解决问题,我看到过与此相关的类似问题,但没有解决我的问题。
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i686)
add_definitions(-Wall -Wunused-function -Wno-missing-braces -march=i686 -m32 -mfpmath=sse -msse2 -mssse3 -msse4.1 -msse4.2 -O3 -fsigned-char )