I'm trying to compile a C++ program and one of the classes uses . g++ is not able to find the libraries would be my guess. The command i use to compile is -
g++ c1.cpp c2.cpp c3.cpp c4.cpp -o c4 -lm -lmysqlclient
c3.cpp is the file that needs mysql.h. This works perfectly on my local machine, but refuses to run on the server with the error
cannot find -lmysqlclient
I tried finding the libmysqlclient.so files on the server using the find command, I don't think they are present there
uname -a
reveals
SunOS opteron 5.10 Generic_139556-08 i86pc i386 i86pc
user#opteron 12:26:02 ~/c++/projname/
I realize that i need to link some libraries, but where and how?
Any help would be appreciated.
Thanks.
Whatever library packages u think is not installed can be installed using sudo apt-get install. But the problem is to find the right name of the package apt-get can understand. So how to do that ?! simple
use command : sudo apt-cache search <filename>
For eg.: in this case lmysqlclient
sudo apt-cache search mysqlclient
(remember to exclude 'l' from the actual name ,ie, mysqlclient and not lmysqlclient).
This outputs:
libmysqlclient-dev - MySQL database development files
In the above -libmysqlclient-dev is the name that apt-get can recognize and solve our cannot find lmysqlclient problem
so now type: sudo apt-get install libmysqlclient-dev from interface.
After its done, try making your required file.
Simplifying #SriHariY.S's answer-
Try installing it with sudo apt-get install libmysqlclient-dev.
Do you have the MySQL client libraries? Can you look for it as
find / -name "libmysqlclient.so" -type f -print 2>/dev/null
Also, you can use the -R flag on linker to hardlink the libmysqlclient as
g++ -R/usr/local/mysql/lib ....
Or, you can export the LD_LIBRARY_PATH_32 or LD_LIBRARY_PATH_64 as
export LD_LIBRARY_PATH_32=$MYSQL_HOME/lib
Urko,
On Ubuntu 18 I used this command to find a name of required package for fixing this error:
apt search lmysqlclient
After this I installed missing package:
sudo apt install libmariadbclient-dev-compat
Related
I'm trying to run a release build of my kitura (2.7) app with mysql on the official swift-ubuntu (latest, 5.0.1) image with the following commands.
docker build --no-cache -t my-app-build -f Dockerfile-tools .
docker run -v $PWD:/swift-project -w /swift-project my-app-build /swift-utils/tools-utils.sh build release
First command one is working as expected. Second one is giving a warning:
warning: you may be able to install mysqlclient using your system-packager: apt-get install libmysqlclient-dev
Tried to install the lib but nothing changed...
Can someone help me?
Thanks in advance!
The issue appears to be related to the version of Ubuntu and the resulting level of MySQL that is installed. As the base container is running Ubuntu 14.04 when MySQL installs you get version 5.5 which does not ship the required configuration for pkg-config to find the include paths needed to build your application.
I have been able to get a simple Kitura application which uses SwiftKueryMySQL to build under docker by updating my Dockerfile-tools file with two changes:
1) Update the FROM to:
FROM swift:5.0.1
2) Add some required packages:
# Install system level packages
RUN apt-get update && apt-get install -y sudo libcurl4-openssl-dev openssl libssl-dev pkg-config libmysqlclient-dev
With these updates your build should succeed. I will look into a longer term solution to the issue.
I have been trying to install the Rust Diesel CLI tool using cargo install diesel_cli, but the installation fails with a linking error
ld: library not found for -lmysqlclient
clang: error: linker command failed with exit code 1
(use -v to see invocation)
I installed the MySQL client using Homebrew: brew install mysql-client. During installation I got the following warning:
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because conflicts with mysql.
If you need to have mysql-client first in your PATH run:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
export CPPFLAGS="-I/usr/local/opt/mysql-client/includeā€¯
I set the PATH and flags as in that warning message, but I still get the above linking error when trying to install the diesel-cli tool. I am unfamiliar with how to do linking in Rust - are there extra steps I need to do here to link mysqlclient directly?
Cargo ignores LDFLAGS and CPPFLAGS, you should set RUSTFLAGS instead. Something like this untested invocation:
RUSTFLAGS="-L/your_lib -I/your_include" cargo install diesel_cli
Relevant documentation.
On my side, I did not make it work with a mysql-client only. I had to install mysql with
brew install mysql
In the end, what matters is that you have a version of the mysqlclient dynamic lib.
Mines where installed here :
/usr/local/lib/libmysqlclient.21.dylib
/usr/local/Cellar/mysql/8.0.15/lib/libmysqlclient.21.dylib
And it worked.
I successfully installed the nvidia driver and toolkit for cuda 5 (but not the samples) on a 64 bit Ubuntu 12.04 box. The samples failed to install even though I previously ran
$ sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
I can't seem to find nvcc. I ran
$ export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib:/usr/local/cuda-5.0/lib64:$LD_LIBRARY_PATH
nvcc -v reports that the compiler is not found:
nvcc -V No command 'nvcc' found, did you mean: Command 'nvlc' from
package 'vlc-nox' (universe) nvcc: command not found
The getting started guide hasn't been of much help here:
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html
What's going on here? Do I need to install the gpu computing sdk samples to get nvcc? :/
Consider installing CUDA 5.5 in Ubuntu 12.04. The 5.5 release has special leverages to install it as a debian package. See the following links,
https://developer.nvidia.com/content/cudacasts-episode-5-install-cuda-55-linux-package-manager
https://developer.nvidia.com/cuda-downloads
It is truly much easier than all that you have tried till now ! personal experience ! :-)
Failing to install samples is a common problem as outlines in https://sn0v.wordpress.com/2012/12/07/installing-cuda-5-on-ubuntu-12-04/#comment-869
The solution is to find "libglut.so" and create a soft-link to it under /usr/lib. Then re-run the cuda*.run and choose to install only the samples.
sudo find /usr -name libglut\*
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so
sudo ./cuda*.run #when prompted only install samples. ie do not install drivers and toolkit.
works for me on ubuntu 12.04 hope it works for you too
I met the problem during the installation, but I found the sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so is useless. My solution is to install freeglut3 first:
`sudo apt-get install freeglut3`
then use:
sudo ln -s /usr/lib/libglut.so.3 /usr/lib/libglut.so
After this, CUDA sample is successfully installed.
When I'm trying to run a perl script (on my centos 6 machine) I get this message:
Can't locate JSON.pm in #INC (#INC contains:
/usr/local/lib/perl5/5.10.1/x86_64-linux-thread-multi
/usr/local/lib/perl5/5.10.1
/usr/local/lib/perl5/site_perl/5.10.1/x86_64-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.1 .)...
After googling a bit, I found out that I need to install that module; But, when I'm typing:
sudo yum install perl-JSON
I get this message:
...
Setting up Install Process
Package perl-JSON-2.17-1.el5.noarch already installed and latest version
Nothing to do
What can I do in order to run that script?
My perl version is v5.10.1
Thanks,
Try to install it via:
1) CPAN (cpan install)
$ sudo cpan JSON
2) CPAN minus (cpanm)
Install cpan minus
$ wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.5017.tar.gz
$ tar -zxvf App-cpanminus-1.5017.tar.gz
$ cd App-cpanminus-1.5017
$ perl make.pl
$ make
$ make test
$ sudo make install
Then install it via cpanm
$ sudo cpanm JSON
I prefer work with CPAN modules via cpanm, because it's modern and easy way!
Maybe this will help others.
In my case,
running in Centos 7:
yum install cpan
then
yum install cpanminus
for cpan (not cpan minus):
yum install cpan
cpan JSON
I have a running (in production) mysql instance on my linux server (ubuntu-10.10) however I cannot find my mysql_config file.
command and output:
~$ locate mysql_config
~$
I've heard/read that I need the libmysqlclient-dev package installed to be able to use mysql_config but I don't want to break my current production instance. I want to make sure installing this dev package is not going to have adverse effects on my current mysql databases.
Furthermore, where can I find the source download for libmysqlclient-dev to install manually? In my current situation (behind corporate proxy) I am not permitted to use apt-get's.
UPDATE
this is stemming from attempting to install python-MySQLdb from source. the setup.py file is requiring the mysql_config path and continues to break when trying to use anything but that file.
The mysql_config executable is by default located in the bin directory of the MySQL server installation if you install it from precompiled binaries. But if you install it using apt-get it may not exist on your server.
Try:
sudo apt-get install libmysqlclient-dev
yum install mariadb-devel works for Centos 7 too, this puts the mysql_config into all the places that pip install mysqlclient requires/looks for it.
In Ubuntu 13.04 installation, it is at /usr/bin/mysql_config
Try /etc/my.cnf, that is the standard file for mysql config.
You can also do:
find / -name my.cnf -type f
On Fedora, install the mariadb-devel package, and you should have the binary.