Sorry if this has already been covered but my google-fu hasn't gotten me anywhere.
I'm trying to cross compile a project I've helped develop a cmake configuration for since the autotools one doesn't work for all platforms currently.
I've had luck cross compiling all the dependencies but when I try to build the project I end up with undefined references and I noticed there's not a single -I/usr/i686/... type option anywhere in the build results:
/usr/bin/i686-w64-mingw32-g++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -Wall -mthreads -O3 -DNDEBUG -mwindows -Wl,--whole-archive CMakeFiles/freedv.dir/objects.a -Wl,--no-whole-archive -o freedv.exe -Wl,--out-implib,libfreedv.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lportaudio-2 -lsamplerate -lsndfile -lsox -L/usr/i686-w64-mingw32/sys-root/mingw/lib -Wl,--subsystem,windows -mwindows -lwx_mswu_core-2.9-i686-w64-mingw32 -lwx_baseu-2.9-i686-w64-mingw32 -lwx_mswu_aui-2.9-i686-w64-mingw32 -lwx_mswu_html-2.9-i686-w64-mingw32 -lwx_baseu_net-2.9-i686-w64-mingw32 -lwx_mswu_adv-2.9-i686-w64-mingw32 /usr/i686-w64-mingw32/sys-root/mingw/bin/libcodec2.dll -Wl,-Bstatic -lctb -Wl,-Bdynamic -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 CMakeFiles/freedv.dir/objects.a(fdmdv2_main.cpp.obj): In function `ZN9MainFrame15SetupSerialPortEv': /home/build/mingw32-proj/fdmdv2-0.96.svn1244/src/fdmdv2_main.cpp:3046: undefined reference to `ctb::SerialPort::SerialPort()' /home/build/mingw32-proj/fdmdv2-0.96.svn1244/src/fdmdv2_main.cpp:3047: undefined reference to `ctb::SerialPort_x::Open(char const*, int, char const*, ctb::SerialPort_x::FlowControl)' collect2: error: ld returned 1 exit status
libctb is installed and found by cmake...
Is this not required when cross compiling?
Thanks, Richard
Ok, it looks like I got it a little backwards... It's not the -l... that's missing, it's the -I...
Apparently mingw32-cmake creates a separate includes file, includes_CXX.rsp, whereas the native cmake just puts them in the flags.cmake file.
During compilation, it doesn't appear the contents of includes_CXX.rsp is being substituted:
[ 12%] Building CXX object src/CMakeFiles/libctb.dir/fifo.cpp.obj cd /home/build/mingw32-proj/libctb-0.16.cmake/build_mingw/src && /usr/bin/i686-w64-mingw32-g++ -DPIC -D_THREAD_SAFE -Dlibctb_EXPORTS -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -O3 -DNDEBUG @CMakeFiles/libctb.dir/includes_CXX.rsp -MD -MP -fPIC -o CMakeFiles/libctb.dir/fifo.cpp.obj -c /home/build/mingw32-proj/libctb-0.16.cmake/src/fifo.cpp /home/build/mingw32-proj/libctb-0.16.cmake/src/fifo.cpp:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
Any ideas?
Thanks, Richard