18

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
Sean Bright
  • 118,630
  • 17
  • 138
  • 146
mo ba
  • 195
  • 1
  • 2
  • 7

4 Answers4

8

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

Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
  • @Jivan you should set the folder/directory where the library lies, that is what -Ldir stands for. If the folder where `coinhsl` is called `/home/mostafa/MyBuilds/CoinIpopt/build/lib/` then this switch should look like `-L/home/mostafa/MyBuilds/CoinIpopt/build/lib/`. The thing is, this switch is used, so this is not the case. Or it needs another folder to be set! Anyhow, this answer is not good for this kind of question. – Srđan Popić Apr 04 '19 at 12:01
2

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

Stephane Rouberol
  • 4,286
  • 19
  • 18
  • 2
    could you please tell me how should I install it and where are the standard libraries directories? In fact coinhsl is one of the libraries installed and used by IPopt (this a mathematical optimization tool) so I don't know how to install it individually? – mo ba Aug 24 '12 at 13:00
1

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.

user698116
  • 392
  • 4
  • 4
-5

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.

sashar
  • 73
  • 6