trying to compile a cmake build for target linux machine(i686) from native linux(x86_64). observed this error:
/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 statusTARGET 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$ the error triggered with the below add_defintions in .cmake file. please help to resolve issue, i seen similar questions related to this, but not solved my issue.
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 ) Reset to default