Reputation:
Inside /usr/local/lib
I have the following files:
libxerces-c.so
libxerces-c.so.28
libxerces-c.so.28.0
My linker fails at this command:
g++ -m64 -o waspxs ConfigureWaspJobs.o MainWindow.o DataTypes.o waspxs.o \
XercesString.o qrc_buttons.o moc_ConfigureWaspJobs.o moc_MainWindow.o \
-L/usr/X11R6/lib64 -L../common -L../prewaspwdll -L/usr/local/lib \
-pthread -lcommon -lprewaspwdll -lxerces-c -lQt5Widgets \
-L/usr/lib/x86_64-linux-gnu -lQt5Gui -lQt5Core -lGL -lpthread
/usr/bin/ld: cannot find -lxerces-c
Note that the options include -L/usr/local/lib
and -lxerces-c
.
What am I missing here?
When I run file
on the libs:
$ file libxerces*
libxerces-c.so: broken symbolic link to `/home/samuel/Desktop/xerces-c-src_2_8_0/lib/libxerces-c.so.28'
libxerces-c.so.28: symbolic link to `libxerces-c.so.28.0'
libxerces-c.so.28.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x44c1a6dbfbe5b51a17fc0ce42097af88a8e8a7f0, not stripped
libxerces-depdom.so: broken symbolic link to `/home/samuel/Desktop/xerces-c-src_2_8_0/lib/libxerces-depdom.so.28'
libxerces-depdom.so.28: symbolic link to `libxerces-depdom.so.28.0'
libxerces-depdom.so.28.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xc9f643c520055a931c596f713853654192a5a7fa, not stripped
Upvotes: 2
Views: 617
Reputation: 70492
Since you are explicitly building a 64 bit binary (as you are using -m64
), you should make sure you have the 64 bit version of xerces installed. Usually, the 64 bit library directory would have 64
appended to it. For example: /usr/local/lib64
.
The file
command reports the symbolic link is broken. Therefore, the library cannot be found. To fix, remove the broken link, and create a fixed one.
rm /usr/local/lib/libxerces-c.so
ln -s /usr/local/lib/libxerces-c.so.28 /usr/local/lib/libxerces-c.so
If your version of ln
supports it, you can do it with a single command:
ln -sf /usr/local/lib/libxerces-c.so.28 /usr/local/lib/libxerces-c.so
Upvotes: 3