4

在我的新 linux 发行版(Fedora)上,如果我尝试编译我用 glfw 编写的东西,我会收到以下错误:

:-1: error: note: 'XF86VidModeQueryExtension' is defined in DSO /lib64/libXxf86vm.so.1 so try adding it to the linker command line

我可以通过添加 -lXxf86vm 来解决这个问题,但我从来不需要在我以前的 linux 发行版中包含它。现在我必须添加 6 个库名称。

到底是怎么回事?看来我的编译器拒绝 .so 库?我对此进行了一些研究,看来我必须使用 --enable-shared 重新编译我的 gcc。

这是真的?

这是我来自 gcc 的日志:

    20:32:44: Running steps for project sgl...
20:32:44: Configuration unchanged, skipping qmake step.
20:32:44: Starting: "/usr/bin/make" 
g++ -c -m64 -pipe -std=c++11 -g -Wall -W -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -I../../Qt5.0.2/5.0.2/gcc_64/mkspecs/linux-g++-64 -I../kantaki-sgl -Ishaders -I. -o camera.o ../kantaki-sgl/camera.cpp
../kantaki-sgl/camera.cpp:3:6: warning: unused parameter 'pos' [-Wunused-parameter]
../kantaki-sgl/camera.cpp:7:6: warning: unused parameter 'ori' [-Wunused-parameter]
../kantaki-sgl/camera.cpp:14:6: warning: unused parameter 'window' [-Wunused-parameter]
../kantaki-sgl/camera.cpp:14:6: warning: unused parameter 'action' [-Wunused-parameter]
g++ -m64 -Wl,-rpath,/home/maik/Qt5.0.2/5.0.2/gcc_64 -o sgl main.o filereader.o shader.o camera.o   -lGL -lglfw3 -lglimgD -lglloadD 
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_clipboard.c.o): undefined reference to symbol 'XConvertSelection'
/usr/bin/ld: note: 'XConvertSelection' is defined in DSO /lib64/libX11.so.6 so try adding it to the linker command line
/lib64/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [sgl] Error 1
20:32:45: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project sgl (kit: Desktop)
When executing step 'Make'

编辑我也用 clang -> 相同的结果编译它。

4

1 回答 1

3

这是 Fedora 的 DSO Linking 策略的改变,请看官方文档

于 2013-05-19T18:39:32.860 回答