ld cannot find -l<library> - gcc

I am having trouble installing pyipopt on ubuntu 12.04. During linking, I receive the error:
/usr/bin/ld: cannot find -lcoinhsl
Even though I know that this library is installed and the .so and .la files are available in /home/mostafa/MyBuilds/CoinIpopt/build/lib/
does anyone have a solution for this?
below is the complete return of running setup.py build:
root#ubuntu:~/MyBuilds/pyipopt# sudo python setup.py build
running build
running build_ext
building 'pyipopt' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/callback.c -o build/temp.linux-x86_64-2.7/src/callback.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/pyipopt.c -o build/temp.linux-x86_64-2.7/src/pyipopt.o
src/pyipopt.c: In function ‘set_intermediate_callback’:
src/pyipopt.c:452:15: warning: variable ‘myowndata’ set but not used [-Wunused-but-set-variable]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relrobuild/temp.linux-x86_64-2.7/src/callback.o build/temp.linux-x86_64-2.7/src/pyipopt.o -L/home/mostafa/MyBuilds/CoinIpopt/build/lib/ -lipopt -lblas -lcoinhsl -lcoinmetis -llapack -ldl -lm -o build/lib.linux-x86_64-2.7/pyipopt.so -Wl,--rpath -Wl,/home/mostafa/MyBuilds/CoinIpopt/build/lib/
/usr/bin/ld: cannot find -lcoinhsl
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

-Ldir
Add directory dir to the list of directories to be searched for -l.

You may install your coinhsl library in one of your standard libraries directories and run 'ldconfig` before doing your ppyipopt install

I had a similar problem with another library and the reason why it didn't found it, was that I didn't run the make install (after running ./configure and make) for that library. The make install may require root privileges (in this case use: sudo make install). After running the make install you should have the so files in the correct folder, i.e. here /usr/local/lib and not in the folder mentioned by you.

you can add the Path to coinhsl lib to LD_LIBRARY_PATH variable. May be that will help.
export LD_LIBRARY_PATH=/xx/yy/zz:$LD_LIBRARY_PATH
where /xx/yy/zz represent the path to coinhsl lib.

Related

yocto: failing to find Python.h and cross compiling fails

Im using poky version of yocto, and adding zbar library in my yocto build. I found a readymade recipe at http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-support/zbar/zbar_0.10.bb and modified it a bit to get working with poky. I got it working fine with imagemagick, and the compiled zbarimg works on the target board.
The modified recipe is available here: http://paste.ubuntu.com/25725000/
When I proceed configuring python support (--with-python) to the build, some dependency issues crept up, which Im unable to resolve.
It appears as if the compiler doesn't find the appropriate headers, since the include paths don't contain appropriate folder.
The full compiler command is:
arm-poky-linux-gnueabi-libtool: compile: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/jlumme/imx_build/build-x11-pico-imx6ul/tmp/sysroots/pico-imx6ul-emmc -DHAVE_CONFIG_H -I. -I/home/jlumme/imx_build/build-x11-pico-imx6ul/tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/zbar/0.10-r0/zbar-0.10 -I./include -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/python2.7 -I/usr/include/python2.7 -I/home/jlumme/imx_build/build-x11-pico-imx6ul/tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/zbar/0.10-r0/zbar-0.10/include -Wall -Wno-parentheses -O2 -pipe -g -feliminate-unused-debug-types -c /home/jlumme/imx_build/build-x11-pico-imx6ul/tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/zbar/0.10-r0/zbar-0.10/python/symbol.c -fPIC -DPIC -o python/.libs/python_zbar_la-symbol.o
You can see that sysroot variable is set, and it appears like the right location, and there is /usr/include/python2.7 there, though its pointing right at the host system include path.
There is a warning from compiler: cc1: warning: include location "/usr/include/python2.7" is unsafe for cross-compilation [-Wpoison-system-directories] which I don't know why it happens, but it seems like the python2.7 folder is appropriately looked at, just not under the sysroot (my host system doesn't have /usr/lib/python2.7)
If I go to the sysroot include (/home/jlumme/imx_build/build-x11-pico-imx6ul/tmp/sysroots/pico-imx6ul-emmc/usr/include/) folder, I can see that it has a subfolder python2.7. If under this usr/include folder I add a symlink Python.h -> python2.7/Python.h, the compiler will complain about the next header file which is not found.
So to me it seems, all I should do is add the appropriate 'sysroot' + usr/include/python2.7 as include search folder it would compile happily - but Im not sure how..
The full compilation log is available here: http://paste.ubuntu.com/25725014/
This is a bug in the zbar configure script.
Try inheriting pythonnative so the configure script can run a compatible Python to know where to look.

Platypus installation error message

I am trying to install Platypus and have gotten the following error message:
building 'htslibWrapper' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c htslibWrapper.c -o build/temp.linux-x86_64-2.7/htslibWrapper.o -msse2 -msse3 -funroll-loops -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC
htslibWrapper.c:243:25: fatal error: htslib/bgzf.h: No such file or directory
#include "htslib/bgzf.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I am new to Bioinformatics and cannot seem to find a working solution online.
Sometimes the bioinformatics applications don't describe thier dependencies all that well. See this link for a possible solution
Install htslib from http://www.htslib.org/download/ and copy c headers to Platypus root folder:
cp -r htslib-x.x.x/htslib platypus_folder/
Build again

"cannot find -lssl; cannot find -lcrypto" when installing mysql-python?

I'm struggling to install the mysql-python pip either systemwide or in a venv on Ubuntu 14.04 with MariaDB 10 installed. Also tried with MariaDB 5.5 and getting the same error. I don't have this issue with vanilla mysql-server installed.
I have the following installed via apt-get:
build-essential
python-dev
libmariadbclient-dev (thats the MariaDB replacement for libmysqlclient-dev)
python-mysqldb
Originally I thought this was an issue installing this into a venv but I've subsequently noticed mysql-python won't install systemwide either. Below are the cmds I used to install in a venv.
virtualenv venv
. venv/bin/activate
pip install mysql-python==1.2.5
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:439:0: warning: "HAVE_WCSCOLL" redefined [enabled by default]
#define HAVE_WCSCOLL
^
In file included from /usr/include/python2.7/pyconfig.h:3:0,
from /usr/include/python2.7/Python.h:8,
from _mysql.c:29:
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h:911:0: note: this is the location of the previous definition
#define HAVE_WCSCOLL 1
^x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmariadbclient_r -lpthread -lz -lm -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /root/env/bin/python -c "import setuptools, tokenize;__file__='/root/env/build/mysql- python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-EyhO2v-record/install-record.txt --single-version-externally-managed --compile --install-headers /root/env/include/site/python2.7 failed with error code 1 in /root/env/build/mysql-python
Storing debug log for failure in /root/.pip/pip.log
You need to have installed the development libraries of OpenSSL. It can be a libssl-dev, libssl-devel if your distribution provides separated packages for the dev libraries. Or install the complete openssl package if they don't.
(venv)➜ src pip install mysql-python==1.2.5
Downloading/unpacking mysql-python==1.2.5
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/home/braiam/src/venv/build/mysql-python/setup.py) egg_info for package mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
building '_mysql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:439:0: warning: "HAVE_WCSCOLL" redefined
#define HAVE_WCSCOLL
^
In file included from /usr/include/python2.7/pyconfig.h:3:0,
from /usr/include/python2.7/Python.h:8,
from _mysql.c:29:
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h:911:0: note: this is the location of the previous definition
#define HAVE_WCSCOLL 1
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmariadbclient_r -lpthread -lz -lm -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
Successfully installed mysql-python
Cleaning up...
But, there were two messages that you have that I didn't, namely:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
Which if you did ld -lcrypto --verbose or ld -lssl --verbose wouldn't produce this results:
➜ src ld -lcrypto --verbose | grep succeeded
attempt to open //usr/lib/x86_64-linux-gnu/libcrypto.so succeeded
ld: warning: cannot find entry symbol _start; not setting start address
➜ src ld -lssl --verbose | grep succeeded
attempt to open //usr/lib/x86_64-linux-gnu/libssl.so succeeded
ld: warning: cannot find entry symbol _start; not setting start address
So, to fix this just make sure you have installed the libssl-dev package which provides both libraries.
I meet the similar error on MacOS but there is no "/usr/bin/ld: cannot find -lssl" for me.
Solved with the following steps:
Step 1. Make sure you have installed openssl with homebrew.
brew install openssl
Step 2. In a terminal:
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
For Linux you can also try yum install your missing library and add them to LIBRARY_PATH.
For Debian 9.x:
apt install libssl-dev
For CentOS:
sudo yum install openssl-devel

MySqlDB: llvm-gcc-4.2: error. Even after installing XCode 4.6.3 and storing MySQL include folder in XAMPP

I took the following steps after reading suggestions from http://andhikalegawa.wordpress.com/2012/01/05/installing-mysql-python-on-snow-leopard-using-xampp-mysql/
Downloaded MySQL-python-1.2.4b4 and unzipped
Changed the mysql_config = /Applications/XAMPP/xamppfiles/bin/mysql_config (as I am using XAMPP 1.7.3)
Downloaded mysql-5.1.70-osx10.6-x86 (I could not find 5.1.55 which is the version used in XAMPP) kept the include folder at /Applications/XAMPP/xamppfiles/
I am new to development so, downloaded XCode 4.6.3 with command line tools.
Logically it should have worked I am getting the following error
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.7-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.7-intel-2.7
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) -D_version_=1.2.4b4 -I/Applications/XAMPP/xamppfiles/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -mmacosx-version-min=10.4 -arch i386 -arch ppc -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
In file included from _mysql.c:44:
/Applications/XAMPP/xamppfiles/include/my_config.h:1088:1: warning: "HAVE_WCSCOLL" redefined
In file included from /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:8,
from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h:891:1: warning: this is the location of the previous definition
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/6p/8bxdl12d2nq05dmwbmdzttt40000gn/T//cc0v0ehE.out
error: command 'llvm-gcc-4.2' failed with exit status 255
Looks like it's trying to compile universal for PowerPC, which you probably don't have?
error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2'
I would suggest setting the ARCHFLAGS:
shell> rm -Rf build/
shell> ARCHFLAGS="-arch i386" /usr/bin/python setup.py build
Or instead of i386, on 64-bit x86_64. But since you are downloading 32-bit MySQL, might be good to use i386.
Good luck! (Shameless advert: you can always try MySQL Connector/Python)

"internal compiler error" from yajl-ruby build on OpenSUSE 12.1

As a requirement for chef-client, I am trying to install yajl-ruby on OpenSUSE 12.1. So far, it is returning the following message:
linux:~ # gem install yajl-ruby
Building native extensions. This could take a while...
ERROR: Error installing yajl-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
creating Makefile
make
gcc -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I/usr/lib64/ruby/1.8/x86_64-linux -I. -fPIC -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -g -fno-strict-aliasing -fPIC -Wall -funroll-loops -c yajl.c
gcc -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I/usr/lib64/ruby/1.8/x86_64-linux -I. -fPIC -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -g -fno-strict-aliasing -fPIC -Wall -funroll-loops -c yajl_alloc.c
gcc -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I/usr/lib64/ruby/1.8/x86_64-linux -I. -fPIC -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -g -fno-strict-aliasing -fPIC -Wall -funroll-loops -c yajl_buf.c
gcc -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I/usr/lib64/ruby/1.8/x86_64-linux -I. -fPIC -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -g -fno-strict-aliasing -fPIC -Wall -funroll-loops -c yajl_encode.c
yajl_encode.c: In function ‘hexToDigit’:
yajl_encode.c:201:1: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.
make: *** [yajl_encode.o] Error 1
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/yajl-ruby-1.1.0 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/yajl-ruby-1.1.0/ext/yajl/gem_make.out
The appropriate packages are installed:
zypper install ruby ruby-devel ruby-ri ruby-rdoc ruby-shadow gcc gcc-c++ automake autoconf make curl dmidecode
It may be an issue with the compiler or there may be an issue specific on OpenSUSE. So far, I am not sure which path to take.
gcc clearly recommends you to send bug report to OpenSuse with full preprocessed source (-E option instead of "-c" and add a redirect to file). This may be because opensuse gcc might have some modifications. You should check instructions on bugs.opensuse.org and send a bug report to OpenSuse. If the bug is in basic gcc too, opensuse bugzilla people will forward it upstream or will ask you to do this
To avoid an "internal compiler error" without sending bugs you can try to change build options. Usually "internal compiler error" means that something goes wrong in complex process of optimizations, so you can just change this process (order of optimization stages and which are enabled). Easiest is to change level of optimization (e.g. replace -O2 with -O1 or -O0) or add something like -Osize.

Resources