When I run 'make' using my NetBeans generated Makefile everything compiles OK but then when we try to link everything together we get an error:
g++ -o dist/Debug/GNU-Linux-x86/hub build/Debug/GNU-Linux-x86/Calculations.o build/Debug/GNU-Linux-x86/Client.o build/Debug/GNU-Linux-x86/Connection.o build/Debug/GNU-Linux-x86/DataStore.o build/Debug/GNU-Linux-x86/Hub.o build/Debug/GNU-Linux-x86/Instruments.o build/Debug/GNU-Linux-x86/Parameters.o build/Debug/GNU-Linux-x86/PricingEngine.o build/Debug/GNU-Linux-x86/Server.o build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/stdafx.o -L/usr/lib/x86_64-linux-gnu ../Core/dist/Debug/GNU-Linux-x86/libcore.a -pthread -lpq -lzmq -lboost_system -lboost_log -lboost_log_setup -lboost_thread -lboost_filesystem -lboost_unit_test_framework -lQuantLib
build/Debug/GNU-Linux-x86/Connection.o: In function `Hub::Connection::ReadHeaderHandler(boost::system::error_code, unsigned long)':
/home/jj5/arena/Hub/Connection.cpp:35: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/home/jj5/arena/Hub/Connection.cpp:35: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/home/jj5/arena/Hub/Connection.cpp:42: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/home/jj5/arena/Hub/Connection.cpp:42: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
The problem seems to be a missing boost logging library. Curiously, however, if I delete the Boost shard object files:
root@happiness:/usr/lib/x86_64-linux-gnu# archive libboost_*.so
Archive path is: /root/archive/2015-09-08-200813
Date: Tuesday 8 September 20:08:13 AEST 2015
User: root
Host: happiness
Path: /usr/lib/x86_64-linux-gnu
File: libboost_atomic.so libboost_chrono.so libboost_context.so libboost_date_time.so libboost_filesystem.so libboost_graph_parallel.so libboost_graph.so libboost_iostreams.so libboost_locale.so libboost_log_setup.so libboost_log.so libboost_math_c99f.so libboost_math_c99l.so libboost_math_c99.so libboost_math_tr1f.so libboost_math_tr1l.so libboost_math_tr1.so libboost_mpi_python-py27.so libboost_mpi_python-py34.so libboost_mpi_python.so libboost_mpi.so libboost_prg_exec_monitor.so libboost_program_options.so libboost_python-py27.so libboost_python-py34.so libboost_python.so libboost_random.so libboost_regex.so libboost_serialization.so libboost_signals.so libboost_system.so libboost_thread.so libboost_timer.so libboost_unit_test_framework.so libboost_wave.so libboost_wserialization.so
Then the next time I run make everything compiles and links successfully! Nevertheless, deleting the shared object files seems a little bit drastic... is there some other way?
p.s. the 'archive' script shown above 'deletes' files by moving them to 'trash', it's similar to rm -rf.
To make linker prefer a static library, you can try this:
-Wl,-Bstatic -lboost_log -lboost_log_setup -Wl,-Bdynamic
Notes:
I don't see a problem with linking to .a directly, it's not any way less portable than the solution above
It would seem Boost.Log fails to set default visibility on these symbols, so please make sure this issue is reported.