问题
Upon performing the basic installation of Ipopt, I'm able to compile the example they provided in Ipopt-3.12.5/Ipopt/examples/hs071_cpp successfully using the command
g++ hs_071_main.cpp hs071_nlp.cpp -I/path/to/build/include/coin -L/path/to/build/lib -lipopt -llapack -lblas -lm -ldl
But when I try to run ./a.out, I get the error:
error while loading shared libraries:
libipopt.so.1: cannot open shared object file: No such file or directory
I've defined $LD_LIBRARY_PATH in .bashrc, and I've confirmed that ls $LD_LIBRARY_PATH shows libipopt.so and libipopt.so.l
回答1:
You need to export the environment variable after setting it.
Try
export LD_LIBRARY_PATH=/whatever/path/you/want:/any/more/pathes/here:/and/here
When setting this by default better use
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/your/personal/so/lib/path1:/path2
This way you do not overwrite any system wide search paths which might already have been set.
来源:https://stackoverflow.com/questions/37974827/libipopt-so-1-cannot-open-shared-object-file