Support #2065
Failure to locate library file
0%
Description
Why would a failure to find a standard library file like WtApplication, used in an app, occur during a build?
cmake .. -- Configuring done -- Generating done -- Build files have been written to: /home/busr/stapp/main/build [ 50%] Building CXX object source/CMakeFiles/app.wt.dir/app.cpp.o /home/user/app/main/source/app.cpp:1:27: fatal error: Wt/WApplication: No such file or directory compilation terminated. make[2]: *** [source/CMakeFiles/app.wt.dir/app.cpp.o] Error 1 make[1]: *** [source/CMakeFiles/app.wt.dir/all] Error 2 make: *** [all] Error 2 usage: kill [ -s signal | -p ] [ -a ] pid ... kill -l [ signal ]
Wt has been built and I checked the server to see that the file is present.
[root@st wt-3.2.1]# find / -name "WApplication" -type f /usr/local/src/wt-3.2.1/src/Wt/WApplication
Updated by Wim Dumon almost 9 years ago
- Status changed from New to Resolved
You should run 'make install' in your Wt directory, which will install Wt to /usr/local/ (you can change this by setting CMAKE_INSTALL_PREFIX to somewhere else). You cannot simply build against a Wt source directory, that setup is complex.
Then in your own CMakeLists.txt, add the following:
INCLUDE_DIRECTORIES(/usr/local/include)
Adapt the path if you changed CMAKE_INSTALL_PREFIX to something else. You'll likely also have to specify the link path so that wt finds the libraries:
LINK_DIRECTORIES(/usr/local/lib)
Updated by Bud T almost 9 years ago
When you say "in your Wt directory" you mean the src directory, right? Like this?
cd /usr/local/src wget http://downloads.sourceforge.net/project/witty/wt/3.2.1/wt-3.2.1.tar.gz tar zxvf wt-3.2.1.tar.gz cd /usr/local/src/wt-3.2.1/ cmake ../ make && make install
It this article you recommend creating a build folder
http://www.webtoolkit.eu:3080/wt/doc/reference/html/InstallationUnix.html
, like the following, which is what I have done.
mkdir build cd build cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release -DUSERLIB_ROOT=/usr/lib64 -DSSL_PREFIX=/usr/lib64/openssl -DRUNDIR=/var/www/approot -DWEBUSER=apache -DWEBGROUP=apache -DCONNECTOR_FCGI=ON ../ make && make install
But my dependencies aren't found, aside from Boost. Not even openssl which was installed by yum in /usr/lib64/openssl
** Disabling crypto support (Auth::SHA1HashFunction, HTTPS support): requires OpenSSL. Indicate the location of your OpenSSL library using -DSSL_PREFIX=... ** Disabling PDF support (WPdfImage, WPdfRenderer): requires libharu. Indicate the location of your haru library using -DHARU_PREFIX=... ** Disabling raster image support (WRasterImage): requires graphicsmagick. Indicate the location of your graphicsmagick library using -DGM_PREFIX=... ** Disabling advanced font rendering support: requires libpango. Wt will use pkg-config to retrieve your libpango installation location. ** Wt::Dbo: building SQLite3 backend. ** Wt::Dbo: not building Postgres backend. Indicate the location of your postgres installation using -DPOSTGRES_PREFIX=... ** Wt::Dbo: not building Firebird backend. Indicate the location of your FirebirdSQL and IBPP installation using -DFIREBIRD_PREFIX=... -DIBPP_SRC_DIRECTORY=... ** Disabling ISAPI. ** Disabling FCGI connector: requires libfcgi Indicate the location of libfcgi using -DUSERLIB_ROOT=..., or omit this connector using -DCONNECTOR_FCGI=OFF ** Enabling built-in httpd. -- Looking for crypt -- Looking for crypt - not found -- Looking for crypt in crypt -- Looking for crypt in crypt - found -- ** Not building mandelbrot example: requires Wt::WRasterImage. -- ** Not building style example: requires WRasterImage. -- ** Not building wtwithqt example. -- wtwithqt example requires a Qt4 installation. -- Configuring done -- Generating done -- Build files have been written to: /usr/local/src/wt-3.2.1/build [root@st wt-3.2.1]#
Again, libfcgi is in the USERLIB_ROOT:
[root@st wt-3.2.1]# find / -name "*libfcgi*" -type f /usr/lib64/libfcgi++.so.0.0.0 /usr/lib64/libfcgi.so.0.0.0 [root@st wt-3.2.1]#
But cmake fails because it can't be found. So, for this rebuild, we don't have problems finding Wt/WtApplication, etc.; but there is still the issue of finding dependencies.
And Wt is still not installed in /usr/local as it should, even though the header files are there within /usr/include
[root@st local]# ls -al /usr/local/ total 56 drwxr-xr-x. 14 root root 4096 Jul 26 15:37 . drwxr-xr-x. 13 root root 4096 Mar 2 2012 .. drwxr-xr-x. 2 root root 4096 Feb 3 2012 bin drwxr-xr-x. 10 501 wheel 4096 Jul 26 13:54 boost_1_54_0 drwxr-xr-x. 2 root root 4096 Feb 3 2012 etc drwxr-xr-x. 2 root root 4096 Feb 3 2012 games drwxr-xr-x. 4 root root 4096 Jul 26 15:37 include drwxr-xr-x. 2 root root 4096 Jul 26 15:37 lib drwxr-xr-x. 2 root root 4096 Jul 26 13:58 lib64 drwxr-xr-x. 2 root root 4096 Feb 3 2012 libexec drwxr-xr-x. 2 root root 4096 Feb 3 2012 sbin drwxr-xr-x. 6 root root 4096 Jul 26 15:37 share drwxr-xr-x. 3 root root 4096 Jul 26 14:48 src drwxr-xr-x. 3 root root 4096 Jul 26 15:37 usr [root@st local]# ls -al /usr/local/include total 24 drwxr-xr-x. 4 root root 4096 Jul 26 15:37 . drwxr-xr-x. 14 root root 4096 Jul 26 15:37 .. drwxr-xr-x. 96 root root 12288 Jul 26 13:56 boost drwxr-xr-x. 11 root root 4096 Jul 26 15:37 Wt [root@st local]#
I can't see what I'm doing wrong here.
Updated by Koen Deforche almost 9 years ago
- Status changed from Resolved to Feedback
- Assignee set to Koen Deforche
Hey,
PREFIX and ROOT are typically '/', /usr, /usr/local, i.e. the directory that contains lib/ and include/ folders.
Regards,
koen
Updated by Bud T almost 9 years ago
Koen:
Thanks, but I don't understand this latest reply.
...I still cannot resolve this build error, as detailed above.
/bin/ld: cannot find -lwtfcgi
Brad
Updated by Bud T almost 9 years ago
Ok, I see. A rebuild after changing to USERLIB_ROOT=/usr/local removed that error for finding -lwtfcgi
But now rebuild of the test app gives different errors which were not present earlier:
Linking CXX executable app.wt /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::dir_itr_close(void*&, void*&)' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::path::filename() const' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*)' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::last_write_time(boost::filesystem::path const&, boost::system::error_code*)' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status make[2]: *** [source/app.wt] Error 1 make[1]: *** [source/CMakeFiles/app.wt.dir/all] Error 2 make: *** [all] Error 2 usage: kill [ -s signal | -p ] [ -a ] pid ... kill -l [ signal ] cp: cannot stat `app.wt': No such file or directory
Updated by Wim Dumon almost 9 years ago
You need to add the boost library that contains the missing symbols to your link command, in this case it's boost_filesystem.
Updated by Bud T almost 9 years ago
I've added this line to my CMakeLists.txt
SET( BOOST_LIBS boost_filesystem boost_system boost_signals boost_regex boost_thread boost_random boost_date_time boost_program_options )
The errors persist:
Linking CXX executable app.wt /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::detail::dir_itr_close(void*&, void*&)' /usr/local/lib/libwt.so: undefined reference to `boost::filesystem::path::filename() const' ...
Help!! I need this to go away pronto. Thanks.
Updated by Bud T almost 9 years ago
It is also necessary to include these BOOST_LIBS in the set of TARGET_LINK_LIBRARIES(). Problem solved. Thanks.