I'm trying to follow the answer given in QSqlDatabase: QMYSQL driver not loaded on Ubuntu 15.04 64bits
on Xubuntu 16.04, where:
# ls /usr/lib/x86_64-linux-gnu/libmysql* -ls
5624 -rw-r--r-- 1 root root 5757198 Abr 21 10:30 /usr/lib/x86_64-linux-gnu/libmysqlclient.a
0 lrwxrwxrwx 1 root root 20 Abr 21 10:29 /usr/lib/x86_64-linux-gnu/libmysqlclient.so -> libmysqlclient.so.20
0 lrwxrwxrwx 1 root root 24 Abr 21 10:29 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 -> libmysqlclient.so.20.2.1
4140 -rw-r--r-- 1 root root 4237408 Abr 21 10:30 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.2.1
Here there are no *_r terminated files.
However, make seems to search for *_r terminated files:
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: error: ld returned 1 exit status
Makefile:111: recipe for target '../../../../plugins/sqldrivers/libqsqlmysql.so' failed
make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
From What is difference between libmysqlclient.a and libmysqlclient_r.a? it seems just a link must be made between the two. Is this the correct approach? Should I do it manually like:
cd /usr/lib/x86_64-linux-gnu/
ln -s libmysqlclient.so.20.2.1 libmysqlclient_r.so.20.2.1
ln -s libmysqlclient.so.20 libmysqlclient_r.so.20
ln -s libmysqlclient.so libmysqlclient_r.so
ln -s libmysqlclient.a libmysqlclient_r.a
Or I'm missing some thing?
Related
I started working with c++ a few weeks ago, and I started a new project to start learning more. I'm encountering an issue with an external dependency. I'm trying to use a library called:
libbgp, and I installed it base on their documentation.
Here is my code:
https://gist.github.com/amb1s1/9b2c72294da0ec9416810c8686d3adce
Error:
/usr/bin/ld: /tmp/ccsdO32O.o: in function `ticker(libbgp::BgpFsm&)':
ambgp.cpp:(.text+0xa7): undefined reference to `libbgp::BgpFsm::tick()'
collect2: error: ld returned 1 exit status
I'm not sure if there is anything else that I have to do after installing the lib for the library to be accessible in my source code.
Update
I ran it with the -lbgp flag and when running it, i get the following error:
g++ -lbgp ambgp.cpp -o ambgp
Error:
./ambgp: error while loading shared libraries: libbgp.so.0: cannot open shared object file: No such file or directory
My Lib:
ls -l /usr/local/lib/
-rw-r--r-- 1 root root 10875880 Jan 18 16:56 libbgp.a
-rwxr-xr-x 1 root root 924 Jan 18 16:56 libbgp.la
lrwxrwxrwx 1 root root 15 Jan 18 16:56 libbgp.so -> libbgp.so.0.0.0
lrwxrwxrwx 1 root root 15 Jan 18 16:56 libbgp.so.0 -> libbgp.so.0.0.0
-rwxr-xr-x 1 root root 4291128 Jan 18 16:56 libbgp.so.0.0.0
drwxrwsr-x 3 root staff 4096 Dec 16 19:27 python3.7
echo $LD_LIBRARY_PATH
:/usr/local/lib
Before running the executable, you have to tell it where to find the libgdp.so file, if it is not stored in a standard place such as /usr/lib or /lib. Following should help you:
$ export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
$ ./ambgp
If you do not want to export the LD_LIBRARY_PATH each time you start the shell manually, add the line to your /home/<user>/.bashrc file.
Additionally, i think the -lbgp flag should go after the source file in the compiler command (g++ ambgp.cpp -lbgp -o ambgp)
TL;DR :
ld states it cannot find libbgp.so.0, and you wrote in the comments that you found libbgp.so without a trailing .0. So, creating a symlink to the library could help too:
$ sudo ln -s /usr/local/lib/libbgp.so /usr/local/lib/libbgp.so.0
For linking, you need a library file without a trailing .0, but for loading, the library name must have a trailing .0.
The last thing to try is to directly specify the library location to the linker with -Wl,-rpath=/usr/local/lib (as you worked out already !)
I'm trying to install trainable-tokenizer. I have installed all the dependencies as per the README. this is trainable-tokenizer https://github.com/jirkamarsik/trainable-tokenizer. i have installed quex.deb using installer from quex.org which is a dependency for trainable-tokenizer.
when i try to do sudo make install i get the following error
ThinkPad-T430:~/tmp/OpenFST/tokenizer/trainable-tokenizer/src$ sudo make install
[ 6%] Building FeaturesReader with quex
Environment variable QUEX_PATH has not been defined.
error: environment variable 'QUEX_PATH' is not defined.
error: your system is 'posix'.
error: if you are using bash-shell, append the following line
error: to your '~/.bashrc' file:
error:
error: export QUEX_PATH=directory-where-quex-has-been-installed
make[2]: *** [quex_files/trtok_read_features_FeaturesReader] Error 255
make[1]: *** [CMakeFiles/trtok.dir/all] Error 2
make: *** [all] Error 2
but i have already set up the QUEX_PATH.
ThinkPad-T430:~/tmp/OpenFST/tokenizer/trainable-tokenizer/src$ echo $QUEX_PATH
/opt/quex/quex-0.65.4/
ThinkPad-T430:~/tmp/OpenFST/tokenizer/trainable-tokenizer/src$ ll /opt/quex/quex-0.65.4/
total 68
drwxrwxr-x 5 root root 4096 May 25 17:42 ./
drwxrwxr-x 3 root root 4096 May 25 17:42 ../
-rw-r--r-- 1 root root 181 Oct 13 2013 COPYRIGHT.txt
drwxr-xr-x 5 root root 4096 May 25 17:42 demo/
-rw-r--r-- 1 root root 0 Feb 26 02:01 __init__.py
-rwxr-xr-x 1 root root 26424 Oct 13 2013 LGPL.txt*
drwxr-xr-x 2 root root 4096 May 25 17:42 manpage/
drwxr-xr-x 6 root root 4096 May 25 18:02 quex/
-rw-r--r-- 1 root root 3098 Oct 13 2013 quex.bat
-rwxrwxr-x 1 root root 2649 Feb 26 02:01 quex-exe.py*
-rw-r--r-- 1 root root 4074 Oct 13 2013 README
-rw-rw-r-- 1 root root 118 Mar 22 15:22 unit_test_results.txt
i also added export QUEX_PATH=/opt/quex/quex-0.65.4/ to the .bashrc
ThinkPad-T430:~/tmp/OpenFST/tokenizer/trainable-tokenizer/src$ vim ~/.bashrc
ThinkPad-T430:~/tmp/OpenFST/tokenizer/trainable-tokenizer/src$ echo $QUEX_PATH
/opt/quex/quex-0.65.4/
ThinkPad-T430:~/tmp/OpenFST/tokenizer/trainable-tokenizer/src$ sudo make install
[ 6%] Building FeaturesReader with quex
Environment variable QUEX_PATH has not been defined.
error: environment variable 'QUEX_PATH' is not defined.
error: your system is 'posix'.
but still i get the same error.
I fixed the issue using the -I flag. I had to use quex -I.
I would guess that the real problem is that your python is python 3.0+
and not python 2.7 as required for Quex.
Admittedly, the error message does not tell this directly.
Trying to compile Qt 4.8.4 with opengl support for installing Visit. I run
./configure -opengl -verbose
The console gives me:
OpenGL auto-detection... ()
g++ -c -m64 -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++-64 -I. -I/usr/include/GL -I/usr/X11R6/include -o opengl.o opengl.cpp
g++ -m64 -Wl,-O1 -o opengl opengl.o -L/usr/lib64/X11 -L/usr/lib64 -lGL -lXext -lX11 -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: cannot find -lGL
collect2: ld returned 1 exit status
gmake: *** [opengl] Error 1
OpenGL disabled.
OpenGL ES 2.x auto-detection... ()
g++ -c -m64 -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++-64 -I. -I/usr/X11R6/include -o opengles2.o opengles2.cpp
opengles2.cpp:45:25: error: GLES2/gl2.h: No such file or directory
opengles2.cpp: In function ‘int main(int, char**)’:
opengles2.cpp:50: error: ‘GLfloat’ was not declared in this scope
opengles2.cpp:50: error: ‘glUniform1f’ was not declared in this scope
opengles2.cpp:51: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
opengles2.cpp:51: error: ‘glClear’ was not declared in this scope
gmake: *** [opengles2.o] Error 1
OpenGL ES 2.x disabled.
OpenGL ES 1.x auto-detection... ()
g++ -c -m64 -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++-64 -I. -I/usr/X11R6/include -o opengles1.o opengles1.cpp
opengles1.cpp:45:23: error: GLES/gl.h: No such file or directory
opengles1.cpp: In function ‘int main(int, char**)’:
opengles1.cpp:50: error: ‘GLfloat’ was not declared in this scope
opengles1.cpp:50: error: expected ‘;’ before ‘a’
opengles1.cpp:51: error: ‘a’ was not declared in this scope
opengles1.cpp:51: error: ‘glColor4f’ was not declared in this scope
opengles1.cpp:52: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
opengles1.cpp:52: error: ‘glClear’ was not declared in this scope
gmake: *** [opengles1.o] Error 1
OpenGL ES 1.x disabled.
All the OpenGL functionality tests failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in
/home/.../Downloads/qt-everywhere-opensource-src-4.8.3/mkspecs/linux-g++-64.
So, i look inside /mkspecs/linux-g++-64, there's only one file, qmake.conf
#
# qmake configuration for linux-g++
#
# Written for GNU/Linux platforms that have both lib and lib64 directories,
# like the AMD Opteron.
#
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_CFLAGS = -m64
QMAKE_LFLAGS = -m64
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_LIBDIR_X11 = /usr/X11R6/lib64
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib64
I don't have a /usr/X11R6 directory, but X_11 reports that everything is OK in the output.
I add the variables:
QMAKE_INCDIR_OPENGL = /usr/include/GL
QMAKE_LIBDIR_OPENGL = /usr/lib64
QMAKE_LIBS_OPENGL = -lGLU -lGL
Contents of /usr/include/GL:
drwxr-xr-x. 3 root root 4.0K Jun 29 14:26 .
drwxr-xr-x. 46 root root 12K Jun 29 16:07 ..
-rw-r--r--. 1 root root 7.7K Nov 12 2010 freeglut_ext.h
-rw-r--r--. 1 root root 681 Nov 12 2010 freeglut.h
-rw-r--r--. 1 root root 26K Nov 12 2010 freeglut_std.h
-rw-r--r--. 1 root root 710K Dec 13 2013 glext.h
-rw-r--r--. 1 root root 83K Dec 13 2013 gl.h
-rw-r--r--. 1 root root 126K Dec 13 2013 gl_mangle.h
-rw-r--r--. 1 root root 17K Dec 13 2013 glu.h
-rw-r--r--. 1 root root 3.3K Dec 13 2013 glu_mangle.h
-rw-r--r--. 1 root root 639 Nov 12 2010 glut.h
-rw-r--r--. 1 root root 44K Dec 13 2013 glxext.h
-rw-r--r--. 1 root root 17K Dec 13 2013 glx.h
-rw-r--r--. 1 root root 4.6K Feb 23 2013 glxint.h
-rw-r--r--. 1 root root 3.4K Dec 13 2013 glx_mangle.h
-rw-r--r--. 1 root root 2.1K Feb 23 2013 glxmd.h
-rw-r--r--. 1 root root 80K Feb 23 2013 glxproto.h
-rw-r--r--. 1 root root 12K Feb 23 2013 glxtokens.h
drwxr-xr-x. 2 root root 4.0K Jun 25 17:20 internal
contents of /usr/lib64
lrwxrwxrwx. 1 root root 15 Jun 25 17:20 libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx. 1 root root 15 Jun 25 15:59 libGLU.so.1 -> libGLU.so.1.3.1
-rwxr-xr-x. 1 root root 514K Dec 13 2013 libGLU.so.1.3.1
-rw-r--r--. 1 root root 656 Jun 25 16:20 libGL.la
lrwxrwxrwx. 1 root root 14 Jun 25 17:20 libGL.so -> libGL.so.1.2.0
lrwxrwxrwx. 1 root root 15 Jun 25 16:20 libGL.so.1 -> libGL.so.331.79
-rwxr-xr-x. 1 root root 1.2M Jun 25 16:20 libGL.so.331.79
lrwxrwxrwx. 1 root root 15 Jun 25 17:20 libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx. 1 root root 15 Jun 25 15:59 libGLU.so.1 -> libGLU.so.1.3.1
-rwxr-xr-x. 1 root root 514K Dec 13 2013 libGLU.so.1.3.1
./configure -opengl -verbose gives the same result
in addition
glxgears
works fine.
What am I doing wrong?
I guess you might install mesa driver that provides libGL.so.1.2.0 and changes the libGL.so symbolic link.
libGL.so -> libGL.so.1.2.0
libGL.so.1 -> libGL.so.331.79
libGL.so.331.79
In /usr/lib64,
rm libGL.so
ln -s libGL.so.1 libGL.so
will give you
libGL.so -> libGL.so.1 -> libGL.so.331.79
I got this issue is after i run countryServer in background and then i kill it. I try recompile a new version and this is what i get
root#ubuntu:/home/baoky/shell_assignment/shell_assn2# g++ -o countryServer CountryServer.cpp
root#ubuntu:/home/baoky/shell_assignment/shell_assn2# ./countryServer &
[1] 3097
root#ubuntu:/home/baoky/shell_assignment/shell_assn2#
Running server program 'css' ......
Country Directory server started
root#ubuntu:/home/baoky/shell_assignment/shell_assn2# ps
PID TTY TIME CMD
2993 pts/3 00:00:00 su
3001 pts/3 00:00:00 bash
3097 pts/3 00:00:00 countryServer
3098 pts/3 00:00:00 ps
root#ubuntu:/home/baoky/shell_assignment/shell_assn2# kill 3097
[1]+ Terminated ./countryServer
root#ubuntu:/home/baoky/shell_assignment/shell_assn2# g++ -o countryServer CountryServer.cpp
/usr/bin/ld: cannot open output file countryServer: No such device or address
collect2: ld returned 1 exit status
root#ubuntu:/home/baoky/shell_assignment/shell_assn2# ls -l
total 60
-rw-r--r-- 1 baoky baoky 19545 Aug 2 10:33 Countries.txt
-rwxr-xr-x 1 root root 14756 Aug 4 03:17 countryClient
-rw-r--r-- 1 baoky baoky 3514 Aug 4 03:19 CountryClient.cpp
-rw-r--r-- 1 baoky baoky 4740 Aug 4 2012 CountryData.c
-rw-r--r-- 1 baoky baoky 2022 Aug 2 10:33 CountryData.h
srwxr-xr-x 1 root root 0 Aug 4 03:29 countryServer
-rw-r--r-- 1 baoky baoky 7762 Aug 4 03:18 CountryServer.cpp
I get an error that return me this
/usr/bin/ld: cannot open output file countryServer: No such device or address
collect2: ld returned 1 exit status
I can fix it if i do rm -rf countryServer
but how do i fix it so it can overwrite the old countryServer ( after i kill its process and recompile it)
Your countryServer program appears to be creating a socket file called countryServer in the current directory, overwriting itself in the process.
Delete that socket file before compiling your code, or better: change your code so that it doesn't overwrite its own executable.
*c*ountryServer.cpp and *C*ountryServer.cpp are different files on a Linux/Unix system.
File paths are case sensitive in linux.
countryServer.cpp and CountryServer.cpp are not the same path.
When I tried to compile a [.cpp] file to [.swc] file, I got this:
dyld: Library not loaded: /usr/lib/libltdl.3.dylib
And I found that my libltdl is
Poechant:src poechant$ ls -l /usr/lib/libltdl.*
lrwxr-xr-x 1 root wheel 15 10 11 08:17 /usr/lib/libltdl.7.2.2.dylib -> libltdl.7.dylib
-rwxr-xr-x 1 root wheel 88848 10 11 08:17 /usr/lib/libltdl.7.dylib
lrwxr-xr-x 1 root wheel 15 10 11 08:17 /usr/lib/libltdl.dylib -> libltdl.7.dylib
How to solve it?
According to the post here
http://forums.adobe.com/message/3892045:
The following set of commands would work( i tested, too )
cd /usr/lib/
sudo ln -s libltdl.7.dylib libltdl.3.dylib