Glfw3 error: DSO Missing from command line

I recently had to reinstall Linux Mint on my PC. I reinstalled all my libraries, such as GLFW, and came across an error that I had never seen before. Unfortunately, my google-fu skills do not seem to match this error, as I could not find any fixes that work for me. Sidenote: These programs compiled in my old installation, and they also compile fine on my laptop, which also works with Linux Mint 17.2.

This is the compiler that I use to compile:

g++ -std=c++11 main.cpp -o out -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi 

This is what the terminal pops up on me:

 /usr/bin/ld: //usr/local/lib/libglfw3.a(glx_context.co): undefined reference to symbol ' dlclose@ @GLIBC_2.2.5' /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status 

So, if someone tells me why I get this / or how to fix it, that would be absolutely amazing! Thanks in advance for any help.

EDIT: I reinstalled the mint twice to try and fix this. He appears every time.

EDIT 2: I was playing the game and still have to find the problem.

+5
source share
2 answers

It looks like the missing character libdl from libdl .

As an added bonus, I will give you a Makefile. Remember to indent with tabs, not spaces, otherwise the Makefile will not work.

 all: out clean: rm -f out *.o .PHONY: all clean CXX = g++ CPPFLAGS = CXXFLAGS = -std=c++11 -Wall -Wextra -g LIBS = -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -pthread -lXi -ldl LDFLAGS = out: main.o $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) 

However, it would be much easier if you used pkg-config . I do not know, from my point of view, the correct command (now I am not on Linux, so I can not check), but it will look like this:

 packages = glfw3 CPPFLAGS := $(shell pkg-config --cflags $(packages)) LIBS := $(shell pkg-config --libs $(packages)) 

That way, you don’t even need to know that you need -ldl because pkg-config will figure this out for you. This is the standard way to do things.

Try running pkg-config --libs glfw3 to see the results. If it is not installed, run sudo apt-get install pkg-config .

+11
source

I just want to simplify Dietrich Epp's answer for less experienced programmers like me:

To solve this problem, link the libdl library by any means required by your compiler method. If you use the command line (gcc): add "-ldl" to the bind commands so that the original connection command from DavidBittner is higher:

 g++ -std=c++11 main.cpp -o out -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldl 

Note that "-ldl" is added at the end.

If you use Cmake, add "-ldl" to the list of additional libraries.

+5
source

Source: https://habr.com/ru/post/1236104/


All Articles