
Brooks Garrison wrote:
Volodya,
Thanks again for your responses :)
I recommend you add /usr/local/boost_1_41_0/prefix/lib to LD_LIBRARY_PATH environment variable. This is not a workaround. This is the standard way to make shared libraries installed into a custom location be available at runtime.
In fact, I'd recommend creating ~/local directory and using that as prefix for installing anything you install from source. Then, add ~/local/bin to PATH and ~/local/lib to LD_LIBRARY_PATH, and you'll no longer have to tweak any settings when you install something new.
I did this, and was able to get the Regex example to work. However, when I went to test the Thread library (another that I am interested using), I run into another linking problem but not during compile time. I'm able to compile and link correctly:
make -k all Building file: ../main.cpp Invoking: GCC C++ Compiler g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp" Finished building: ../main.cpp
Building target: boost_thread_test Invoking: GCC C++ Linker g++ -L/home/bgarrison/local/lib ./main.o -lboost_thread -o "boost_thread_test" Finished building target: boost_thread_test
Build complete for project boost_thread_test
but when I try to debug (using the debugger in Eclipse), I get the following message:
/home/bgarrison/Code/boost_thread_test/Debug/boost_thread_test: error while loading shared libraries: libboost_thread.so.1.41.0: cannot open shared object file: No such file or directory
This is strange to me because, I know the file it's looking for is in the directory specified by the -L parameter. :(
As I have explained earlier, the -L option to the static linker has nothing to do with dynamic linker. What is the output of ls -l /home/bgarrison/local/lib/libboost_thread* ? And did you set LD_LIBRARY_PATH this time? If so, what exact commands did you use? Did you use 'export'? - Volodya