Project

General

Profile

Wt 3.2.1 boost::filesystem3 [SOLVED]

Added by Thomas Saquet about 13 years ago

Hello,

I try to build my app with the 3.2.1 new wt version and i have a problem at the linking step (everything is working with 3.2.0) :

-------------- Clean: Debug in dbo (compiler: GNU GCC Compiler)---------------

Cleaned "dbo - Debug"

-------------- Build: Debug in dbo (compiler: GNU GCC Compiler)---------------

Compiling:
...
[Compiling everything without problem]
...
Linking console executable: bin/Debug/dbo
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_iterator&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_iterator&, boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::dir_itr_close(void*&, void*&)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::last_write_time(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::path::filename() const'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::file_size(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::path::wchar_t_codecvt_facet()'
collect2: ld a retourné 1 code d'état d'exécution
Process terminated with status 1 (0 minutes, 52 seconds)
8 errors, 0 warnings (0 minutes, 52 seconds)

I checked my boost version (1.46) and didn't find any conflict, do you have an idea about this ?

Thank you in advance,

Thomas


Replies (12)

RE: Wt 3.2.1 boost::filesystem3 - Added by Jan Hrubeš about 13 years ago

Hi,

boost::filesystem is not a header only library. You have to pass libboost_filesystem.so (on linux is by default located in /usr/local/lib) to your linker (or the location using -L parameter).

If the lib is missing then you can build it:

./bootstrap.sh --with-libraries=filesystem
./b2 install

For more info about installing boost see boost easy build and install .

Jan

RE: Wt 3.2.1 boost::filesystem3 - Added by Thomas Saquet about 13 years ago

Hi, thanks, i thought i had tried this but it seems i did not... Since it's ok now.

Is there a way to change the subject to say it is solved ?

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Bud T almost 12 years ago

I have compiled the binaries for this boost library but still get this message when trying to install Wt. If I have installed boost under the customary /usr/local/ then why this requirement to "pass to the linker"? How do I "pass to the linker", anyway? And if these libraries are always required to install Wt then why aren't they set up as default link targets in the CMakeLists.txt file?

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Wim Dumon almost 12 years ago

Hello Brad,

That's indeed not good, we should properly link to boost libs for targets within Wt. What library/executable fails? Can you paste the link command and error?

BR,

Wim.

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Bud T almost 12 years ago

Ok, pasted below. And I did install filesystem binaries before running.

[root@st wt-release]# make clean
[root@st wt-release]# make
[100%] Building CXX object CMakeFiles/wt-release.wt.dir/main.cpp.o
In file included from /usr/local/include/Wt/WApplication:24:0,
                 from /home/busr/wt-release/main.cpp:1:
/usr/local/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]
Linking CXX executable wt-release.wt
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_iterator&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_iterator&, boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::dir_itr_close(void*&, void*&)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::last_write_time(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::path::filename() const'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::file_size(boost::filesystem3::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
make[2]: *** [wt-release.wt] Error 1
make[1]: *** [CMakeFiles/wt-release.wt.dir/all] Error 2
make: *** [all] Error 2
[root@st wt-release]#

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Wim Dumon almost 12 years ago

Weird. Can you post the output from make VERBOSE=1 ?

Wim.

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Bud T almost 12 years ago

[root@st wt-release]# make VERBOSE=1
/usr/bin/cmake -H/home/busr/wt-release -B/home/busr/wt-release --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/busr/wt-release/CMakeFiles /home/busr/wt-release/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/busr/wt-release'
make -f CMakeFiles/wt-release.wt.dir/build.make CMakeFiles/wt-release.wt.dir/depend
make[2]: Entering directory `/home/busr/wt-release'
cd /home/busr/wt-release && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/busr/wt-release /home/busr/wt-release /home/busr/wt-release /home/busr/wt-release /home/busr/wt-release/CMakeFiles/wt-release.wt.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/busr/wt-release'
make -f CMakeFiles/wt-release.wt.dir/build.make CMakeFiles/wt-release.wt.dir/build
make[2]: Entering directory `/home/busr/wt-release'
/usr/bin/cmake -E cmake_progress_report /home/busr/wt-release/CMakeFiles 1
[100%] Building CXX object CMakeFiles/wt-release.wt.dir/main.cpp.o
/bin/c++    -O3 -DNDEBUG -I/usr/local/include    -o CMakeFiles/wt-release.wt.dir/main.cpp.o -c /home/busr/wt-release/main.cpp
In file included from /usr/local/include/Wt/WApplication:24:0,
                 from /home/busr/wt-release/main.cpp:1:
/usr/local/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]
Linking CXX executable wt-release.wt
/usr/bin/cmake -E cmake_link_script CMakeFiles/wt-release.wt.dir/link.txt --verbose=1
/bin/c++   -O3 -DNDEBUG    CMakeFiles/wt-release.wt.dir/main.cpp.o  -o wt-release.wt -rdynamic /usr/local/lib/libwtfcgi.so /usr/local/lib/libwt.so -Wl,-rpath,/usr/local/lib
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_iterator&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_iterator&, boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::dir_itr_close(void*&, void*&)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::last_write_time(boost::filesystem3::path const&, boost::system::error_code*)'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::path::filename() const'
/usr/local/lib/libwt.so: undefined reference to `boost::filesystem3::detail::file_size(boost::filesystem3::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
make[2]: *** [wt-release.wt] Error 1
make[2]: Leaving directory `/home/busr/wt-release'
make[1]: *** [CMakeFiles/wt-release.wt.dir/all] Error 2
make[1]: Leaving directory `/home/busr/wt-release'
make: *** [all] Error 2
[root@st wt-release]#

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Daniel Giguere almost 12 years ago

Got the same error with Wt 3.3.0, with both boost 1_49 and boost 1_52

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Wim Dumon almost 12 years ago

Hi brad,

Ah this is your own project, not wt that is failing - I misunderstood that.

Linux (and other unices too) don't behave consistently wrt what libraries you have to pass explicitly to the link command. Sometimes you need to add the dependencies for wt, sometime you don't have to do this, and this changes randomly from distribution to distribution (or even within versions of a single distribution).

You should specify boost_filesystem explicitly as a library on which your project depends. In cmake, you modify TARGET_LINK_LIBRARIES:

TARGET_LINK_LIBRARIES(myprog.wt
wthttp wt boost_filesystem
)

Replace boost_filesystem with the appropriate name for your system, it may have extra identifiers in its name such as boost version, compiler version, -mt, ...

BR,

Wim.

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Bud T almost 12 years ago

Thanks for that clarification... Again, lame question alert... I'm reading the Wt tutorials, such as Using CMake and the "Hands on Introduction", as well as the FAQ, and I'm not sure that I understand why sometimes we are using CMake and other times just compiling from command line with c or g.

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Wim Dumon almost 12 years ago

Wt does not impose a build system or IDE for your own projects that use Wt. Pick what works best for you. Cmake is in general not bad, especially if you want something that works on unix and windows, but it's really up to you to choose.

BR,

Wim.

RE: Wt 3.2.1 boost::filesystem3 [SOLVED] - Added by Bud T almost 12 years ago

And, on a somewhat related point re:cmake, am I to understand that CMakeLists.txt needs to be updated each time that I add some code to my project? I'm thinking of the FAQ example code here below. It seems to imply that I need to manually update this list with each new code file name? Then I must guess that this file is part of the project repository which gets deployed to the server before the build of each revision?

ADD_EXECUTABLE(myprog.wt
MyProg1.C
OtherFile.C
AndEvenMoreCode.C
)

# For FastCGI deployment:
TARGET_LINK_LIBRARIES(myprog.wt
wtfcgi wt someotherlib
)

# Or, for built-in httpd deployment:
# TARGET_LINK_LIBRARIES(myprog.wt
#   wthttp wt someotherlib
# )

INCLUDE_DIRECTORIES(/usr/local/wt/include)

Also, this line for INCLUDE_DIRECTORIES could be avoided if a symlink was added to the docroot for each required include folder? Like the /resources folder? I don't know why this escaped me previously, because I was not aware that this configuration option existed, based upon my use of this tutorial as reference: Wt + Apache + mod_fcgid + Valgrind + gdb + SELinux - Deploy and Debug. It doesn't actually wind up including my resources folder... So I'm not sure where this Wt_INCLUDE_DIR gets set, anyway?

He uses it in include_directories(${Wt_INCLUDE_DIR}), which I guess was fetching that /resources folder for him but not for me.

    (1-12/12)