Linking error: DSO missing from command line

北慕城南 提交于 2019-11-27 04:07:15

Hopefully this will be of help to those, like me, who are new to Linux and don't find anything related to Linux to be particularly obvious.

As noted by talonmies, I am not able to link indirectly and as such need to specify any additional libraries required by the libraries I am using. That is to say, if I link library A, which requires libraries B and C, I need to link all three libraries for the program to link correctly.

To find what other libraries were needed I used the pkg-config command, for which I found a guide here. Running pkg-config --print-requires --print-requires-private glfw3 gave the following output, which is the list of packages required by glfw3.

x11
xrandr
xi
xxf86vm
gl

I was then able to find what libraries I needed to include by running pkg-config --libs, followed by the name of the library. For example, pkg-config --libs x11 yielded -lX11.

Note: you can pass multiple items to pkg-config as input, so running

pkg-config --libs $(pkg-config --print-requires --print-requires-private glfw3)

will print out all the additional libraries you need to link (-lX11 -lXrandr -lXi -lXxf86vm -lGL).

My program now links successfully, I hope this helpful to anyone with a similar problem.

Your linker need X11 library,You need to specify -lX11 to linker

Try

/usr/local/cuda/bin/nvcc -arch=compute_30 -code=sm_30,compute_30 -o Main.o Display.o FileUtil.o Timer.o NeuralNetwork.o -L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/cuda/lib64 -lGLEW -lglfw3 -lGL -lGLU -lcuda -lcudart -lX11
HuuHoangNguyen

Use the following commands to fix the issue:

FLAGS=-lX11 ./configure --prefix=/usr --disable-static
make
make install
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!