Boost Filesystem fails with FreeBSD 10, clang, and boost
Hello all, I am currently migrating to a FreeBSD 10 system which comes default with clang language. I was able to compile Boost just fine. But when I include filesysstem.hpp to it, I get the following error message:
Linking CXX executable boost_clang_test /usr/bin/ld: : invalid DSO for symbol `_ZN5boost6system15system_categoryEv' definition /usr/local/lib/libboost_system.so.1.55.0: could not read symbols: Bad value CC: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1
Stop.
I am using cmake as my build system, could it be possible that I need to adjust my cmake variables? I am not sure if I've came to correct forum or should this be on FreeBSD, clang, CMake forum(s)? Please let me know if I am at the wrong place…
The minimum amount of code to induce the problem are the following 2 files:
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
# Find and include Boost libraries
find_package(Boost 1.55 COMPONENTS filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
set(BOOST_CLANG_TEST_SOURCES ${SOURCES} main.cpp)
add_executable(boost_clang_test ${BOOST_CLANG_TEST_SOURCES})
target_link_libraries(boost_clang_test ${LIBS})
main.cpp:
#include
On Thu, Jun 19, 2014 at 05:55:10PM -0700, Ricky Huang wrote:
Hello all,
I am currently migrating to a FreeBSD 10 system which comes default with clang language. I was able to compile Boost just fine. But when I include filesysstem.hpp to it, I get the following error message:
Linking CXX executable boost_clang_test /usr/bin/ld: : invalid DSO for symbol `_ZN5boost6system15system_categoryEv' definition /usr/local/lib/libboost_system.so.1.55.0: could not read symbols: Bad value CC: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1
Stop.
Did you install Boost from ports or did you build it yourself? Note that Boost.System is a dependency of Boost.Filesystem, so you probably need to mention it in the COMPONENTS list, as AFIAK FindBoost doesn't grok library dependencies. Your error is due to not explicitly linking Boost.System, causing the linker to do some best-effort finding of the symbols based on what boost_filesystem pulls in, but not quite succeeding. I reproduced your problem on my 10.0 machine and resolved it by adding 'system' to the list of the components.
I am using cmake as my build system, could it be possible that I need to adjust my cmake variables? I am not sure if I've came to correct forum or should this be on FreeBSD, clang, CMake forum(s)? Please let me know if I am at the wrong place…
The minimum amount of code to induce the problem are the following 2 files:
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
# Find and include Boost libraries find_package(Boost 1.55 COMPONENTS filesystem REQUIRED) include_directories(${Boost_INCLUDE_DIR}) set(LIBS ${LIBS} ${Boost_LIBRARIES})
set(BOOST_CLANG_TEST_SOURCES ${SOURCES} main.cpp)
add_executable(boost_clang_test ${BOOST_CLANG_TEST_SOURCES}) target_link_libraries(boost_clang_test ${LIBS})
main.cpp:
#include
#include <iostream> #include <sstream> #include <string> #include using namespace std; using namespace boost::filesystem;
const char *progname;
int main(int argc, char **argv){ return 0; }
Thanks in advance.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Lars Viklund | zao@acc.umu.se
On Jun 20, 2014, at 12:50 AM, Lars Viklund
On Thu, Jun 19, 2014 at 05:55:10PM -0700, Ricky Huang wrote:
Hello all,
I am currently migrating to a FreeBSD 10 system which comes default with clang language. I was able to compile Boost just fine. But when I include filesysstem.hpp to it, I get the following error message:
Linking CXX executable boost_clang_test /usr/bin/ld: : invalid DSO for symbol `_ZN5boost6system15system_categoryEv' definition /usr/local/lib/libboost_system.so.1.55.0: could not read symbols: Bad value CC: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1
Stop.
Did you install Boost from ports or did you build it yourself?
I installed it from the ports.
Note that Boost.System is a dependency of Boost.Filesystem, so you probably need to mention it in the COMPONENTS list, as AFIAK FindBoost doesn't grok library dependencies.
Your error is due to not explicitly linking Boost.System, causing the linker to do some best-effort finding of the symbols based on what boost_filesystem pulls in, but not quite succeeding.
I reproduced your problem on my 10.0 machine and resolved it by adding 'system' to the list of the components.
That was it - adding system to CMake fine_package() fixed the problem. I guess the entire build system was different, FreeBSD 9, gcc, boost 1.48, on my older system. Thank you for the help Lars.
I am using cmake as my build system, could it be possible that I need to adjust my cmake variables? I am not sure if I've came to correct forum or should this be on FreeBSD, clang, CMake forum(s)? Please let me know if I am at the wrong place…
The minimum amount of code to induce the problem are the following 2 files:
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
# Find and include Boost libraries find_package(Boost 1.55 COMPONENTS filesystem REQUIRED) include_directories(${Boost_INCLUDE_DIR}) set(LIBS ${LIBS} ${Boost_LIBRARIES})
set(BOOST_CLANG_TEST_SOURCES ${SOURCES} main.cpp)
add_executable(boost_clang_test ${BOOST_CLANG_TEST_SOURCES}) target_link_libraries(boost_clang_test ${LIBS})
main.cpp:
#include
#include <iostream> #include <sstream> #include <string> #include using namespace std; using namespace boost::filesystem;
const char *progname;
int main(int argc, char **argv){ return 0; }
Thanks in advance.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Lars Viklund | zao@acc.umu.se _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Fri, Jun 20, 2014 at 11:01:54AM -0700, Ricky Huang wrote:
On Jun 20, 2014, at 12:50 AM, Lars Viklund
wrote: I reproduced your problem on my 10.0 machine and resolved it by adding 'system' to the list of the components.
That was it - adding system to CMake fine_package() fixed the problem. I guess the entire build system was different, FreeBSD 9, gcc, boost 1.48, on my older system.
The dependency on System from Filesystem arrived sometime in the last 1.4x series. There's a bunch of them in Boost and some are even documented at times. Popular ones tend to be Thread+System, DateTime, Regex.
On 19 Jun 2014 at 17:55, Ricky Huang wrote:
I am currently migrating to a FreeBSD 10 system which comes default with clang language. I was able to compile Boost just fine. But when I include filesysstem.hpp to it, I get the following error message:
If it is any use, proposed Boost.AFIO which heavily uses Filesystem is regularly built and tested by a CI slave running FreeBSD 10. I think the problem will be somewhere in your build configuration. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
participants (3)
-
Lars Viklund
-
Niall Douglas
-
Ricky Huang