Boost Linker Error when building Wt
Added by Jonathan Greig about 12 years ago
I'm tried building Wt and its dependencies separately as well as using the winst installer. I keep getting stuck with linker errors that cannot find boost. This happens when trying to build wt-3.2.3 or wt-3.3.0. I'm not very familiar with the cmake or boost stuff but both cmake and boost appear to be installed correctly since cmake is working and I can build the boost hello world example using b2.
Linker Errors
Linking CXX executable test
../src/libwt.so.3.2.3: undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
../src/libwt.so.3.2.3: undefined reference to `boost::thread::start_thread_noexcept()'
../src/libwt.so.3.2.3: undefined reference to `boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)'
../src/libwt.so.3.2.3: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../src/libwt.so.3.2.3: undefined reference to `boost::filesystem::detail::last_write_time(boost::filesystem::path const&, boost::system::error_code*)'
../src/libwt.so.3.2.3: undefined reference to `boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*)'
../src/libwt.so.3.2.3: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
../src/libwt.so.3.2.3: undefined reference to `boost::filesystem::detail::dir_itr_close(void*&, void*&)'
../src/libwt.so.3.2.3: undefined reference to `boost::thread::join_noexcept()'
collect2: ld returned 1 exit status
My .bash_profile looks like this:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin:$HOME/dev/usr/bin:$HOME/dev/usr/include:$HOME/dev/usr/lib
#
export PKG_CONFIG_PATH=$HOME/dev/usr/lib/pkgconfig
export LD_LIBRARY_PATH=$HOME/dev/usr/lib:${LD_LIBRARY_PATH}
export CFLAGS=\"$CFLAGS -fPIC -I$HOME/dev/usr/include\"
export CXXFLAGS=\"$CXXFLAGS -fPIC -I$HOME/dev/usr/include\"
export CPPFLAGS=\"$CPPFLAGS -fPIC -I$HOME/dev/usr/include\"
export LDFLAGS=\"-L$HOME/dev/usr/lib\"
#
export PATH
unset USERNAME
Replies (3)
RE: Boost Linker Error when building Wt - Added by Wim Dumon about 12 years ago
Hi Jonathan,
Sounds like you need to add -lboost_thread and -lboost_filesystem to your link command. Unfortunately, the exact libraries that you have to pass to the link command varies wildly with OS and compiler/linker details, so it's difficult for us to provide uniform instructions that work in all situation.s
BR,
Wim.
RE: Boost Linker Error when building Wt - Added by Jonathan Greig about 12 years ago
Wim,
Thanks, I wish it was as easy as that. I got it working though, I recompiled Boost statically and got Wt to build. When I did a 'make install' though, I noticed these issues:
running mkdir -p /var/run/wt 2>&1
mkdir: cannot create directory `/var/run/wt': Permission denied
running chown apache:apache /var/run/wt 2>&1
chown: invalid user: `apache:apache'
The server is a shared host x86_64 redhat machine, so I do not have root access, but it's supposed to have FastCGI installed. I'm documenting my steps so later I can post about it. I am able to build the hello world example using:
g -O3 -I$HOME/dev/usr/include -L$HOME/dev/usr/lib -o hello.wt hello.c -lwt -lwthttp -ldl -lrt
but I cant get it to show up when I go to the page. I'm not quite sure how to proceed from here, any help is appreciated.
RE: Boost Linker Error when building Wt - Added by Wim Dumon about 12 years ago
Hello Jonathan,
I'm not an fcgi deployment specialist, but with fcgi Wt will need a directory to store run files in - you can change it by setting RUNDIR while running cmake, and point it to a directory that you can make writeable for the httpd.
Secondly, apache (or other webserver) has to be configured properly to allow the execution of fcgi binaries in the directory where you deploy your Wt application. This is problematic on most shared hosting setups.
BR,
Wim.