Cross compiling probem - rdynamic

1k Views Asked by At

I've been trying to cross-compile the library libsound to windows 10 on wsl2.

I used the steps described in the library's github. Session "Building for Windows"

However, I faced some problems during cmake execution:

cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe/usr/x86_64-w64-mingw32.static/share/cmake/mxe-conf.cmake

The command returns:

-- The C compiler identification is GNU 5.5.0
-- Check for working C compiler: /home/andre/git/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64- 
mingw32.static-gcc
-- Check for working C compiler: /home/andre/git/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64- 
mingw32.static-gcc -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

"/home/andre/git/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

Change Dir: /home/andre/git/libsoundio/build-win64/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_8a923/fast && /usr/bin/make -f 
CMakeFiles/cmTC_8a923.dir/build.make CMakeFiles/cmTC_8a923.dir/build
make[1]: Entering directory '/home/andre/git/libsoundio/build-win64/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_8a923.dir/testCCompiler.c.o
/home/andre/git/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-gcc    -o 
CMakeFiles/cmTC_8a923.dir/testCCompiler.c.o   -c /home/andre/git/libsoundio/build- 
win64/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_8a923
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8a923.dir/link.txt --verbose=1
/home/andre/git/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-gcc      -rdynamic 
CMakeFiles/cmTC_8a923.dir/testCCompiler.c.o  -o cmTC_8a923
x86_64-w64-mingw32.static-gcc: error: unrecognized command line option '-rdynamic'
make[1]: *** [CMakeFiles/cmTC_8a923.dir/build.make:87: cmTC_8a923] Error 1
make[1]: Leaving directory '/home/andre/git/libsoundio/build-win64/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_8a923/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/home/andre/git/libsoundio/build-win64/CMakeFiles/CMakeOutput.log".
See also "/home/andre/git/libsoundio/build-win64/CMakeFiles/CMakeError.log".

There is no log in /home/andre/git/libsoundio/build-win64/CMakeFiles/.

I followed all instructions described in github.

Does anyone know what's going on?

1

There are 1 best solutions below

2
On

I assume that apps built with a MinGW-compatible GCC are Windows-compatible apps, though I don't know for sure. -rdynamic is only relevant for Linux / ELF targets. You may need to make sure you've got the right compiler specified, e.g. by setting the CC environment variable.