user5739619
user5739619

Reputation: 1838

libxcb.a: undefined reference to symbol 'XauGetBestAuthByAddr'

When I type make I get:

Linking CXX executable ../../bin/MyProgram
/usr/bin/ld: /home/myname/Desktop/MyProject/build/lib/libxcb.a(xcb_auth.o): undefined reference to symbol 'XauGetBestAuthByAddr'
/usr/lib/x86_64-linux-gnu/libXau.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
...

and my link.txt file looks like

/usr/bin/g++    -O3 -O3 -DNDEBUG   CMakeFiles/MyProject.dir/main.cpp.o      
-o ../../bin/MyProject  -L/home/myname/Desktop/MyProject/build/lib -rdynamic -lboost_thread-mt -lboost_date_time-mt -lboost_regex 
-lboost_filesystem-mt -lboost_system-mt -lboost_program_options-mt ../../lib/libfftw3.a   -lXau -lxcb -lXext -lX11 -lpetsc -lmpich -lmpl -lrt ../../lib/libflapack.a 
-lgfortran ../../lib/libfblas.a -lgfortran ../../lib/libMyProjectAPI.a -lfftw3  -lGLU -lGL -lpthread ../../lib/libfftw3.a  -lXau -lxcb -lX11 -lpetsc -lmpich -lmpl -lrt 
../../lib/libflapack.a -lgfortran ../../lib/libfblas.a -lgfortran ../../lib/libfblas.a -lpthread -lboost_thread-mt -lboost_date_time-mt -lboost_regex 
-lboost_filesystem-mt -lboost_system-mt     -lboost_program_options-mt /home/myname/anaconda2/lib/libhdf5.so /home/myname/anaconda2/lib/libhdf5_hl.so 
-lrt /home/myname/anaconda2/lib/libz.so -ldl -lm /home/myname/anaconda2/lib/libhdf5_cpp.so 
/home/myname/anaconda2/lib/libhdf5_hl_cpp.so /home/myname/anaconda2/lib/libhdf5.so /home/myname/anaconda2/lib/libhdf5_hl.so -lrt /home/myname/anaconda2/lib/libz.so 
-ldl -lm /home/myname/anaconda2/lib/libhdf5_cpp.so /home/myname/anaconda2/lib/libhdf5_hl_cpp.so -Wl,-rpath,/home/myname/Desktop/MyProject/build/lib:/home/myname/anaconda2/lib 

Anyone know how to solve this? I solved similar errors to this before by copying the relevant lib file from /usr/lib/x86_64-linux-gnu to home/myname/Desktop/MyProject/build/lib. I thought copying -lXau from the former to the latter directory would help, but apparently not

Upvotes: 0

Views: 1545

Answers (1)

Dietmar Kühl
Dietmar Kühl

Reputation: 153820

Exchange the position of -lXau and -lxcb: libraries are scanned in order for unresolved symbols.

Upvotes: 2

Related Questions