On Fri, Mar 27, 2020 at 03:31:02PM +0000, Globe Trotter wrote:
> g++ -g -O2 -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions -L/usr/local/lib -o dw-simple-container-test dw_simple_container.o dw_simple_container_test.o ../dw/libDw-widgets.a ../dw/libDw-fltk.a ../dw/libDw-core.a ../lout/liblout.a -lfltk
> /bin/ld: ../dw/libDw-fltk.a(libDw_fltk_a-fltkviewbase.o): undefined reference to symbol 'XCreatePixmap'
It says that libDw_fltk_a-fltkviewbase.o object file refers to XCreatePixmap
symbol. To build dw-simple-container-test program from that object file
a library is needed that defines the symbol and that library must be named
using the "-l" argument to to the g++ command.
> /bin/ld: /usr/lib64/libX11.so.6: error adding symbols: DSO missing from command line
The linker is so nice that it searched the system and found that definition in
/usr/lib64/libX11.so.6 library.
> collect2: error: ld returned 1 exit status
>
But it keeps reporting it as an error because it the library must be specified
explicitly.
So what is missing is -lX11 argument to the g++ program. This is obviously
a bug in the ./configure script that it does not check for libX11 library and
a bug in the Makefile that it does not add -lX11 to linker flags for the
dw-simple-container-test test program.
> So, I can not figure out what the problem here is. I do have X11 installed.
> What is it?
You also need /usr/lib64/libX11.so file (without the .6 suffix) on your
system.
This problem is called an underlinking and it is a result of sloppy build
scripts. It probably worked in the old days when linkers mixed transative
library dependencies together (libfltk library itself is linked to libX11),
but modern linkers are stricter. That's due to security and performance
reasons.
-- Petr