首页 > 解决方案 > 交叉编译探针 - rdynamic

问题描述

我一直在尝试将库 libsound 交叉编译到 wsl2 上的 Windows 10。

我使用了库的 github中描述的步骤。会议“为 Windows 构建”

但是,我在 cmake 执行过程中遇到了一些问题:

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

命令返回:

-- 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".

/home/andre/git/libsoundio/build-win64/CMakeFiles/没有登录。

我遵循了 github 中描述的所有说明。

有谁知道发生了什么?

标签: ccross-compilinglibmxe

解决方案


我假设使用与 MinGW 兼容的 GCC 构建的应用程序是与 Windows 兼容的应用程序,尽管我不确定。-rdynamic仅与 Linux / ELF 目标相关。您可能需要确保指定了正确的编译器,例如通过设置 CC 环境变量。


推荐阅读