Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Boost in doesn't work. Why?



  • Hello all!

    I am trying to run simple Boost example:

    // System includes
    #include <iostream>
    #include <boost/locale.hpp>
    #include <boost/log/trivial.hpp>
    #include <cassert>
    #include <ctime>
    
    // Application includes
    
    // Namespace
    using namespace std;
    using namespace boost::log;
    
    int main(int inCounter, char *inArguments[]) {
    
    	BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
    	BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
    	BOOST_LOG_TRIVIAL(info) << "An informational severity message";
    	BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
    	BOOST_LOG_TRIVIAL(error) << "An error severity message";
    	BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
    
    	cout << "Hello World!" << endl;
    
    	return 0;
    }
    

    But at time of compilation I see this:

    Undefined symbols for architecture x86_64:
      "boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)", referenced from:
          boost::log::v2s_mt_posix::record::reset() in main.o
      "boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)", referenced from:
          boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::auto_release::~auto_release() in main.o
      "boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)", referenced from:
          boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::record_pump(boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>&, boost::log::v2s_mt_posix::record&) in main.o
      "boost::log::v2s_mt_posix::aux::unhandled_exception_count()", referenced from:
          boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::record_pump(boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>&, boost::log::v2s_mt_posix::record&) in main.o
          boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::~record_pump() in main.o
      "boost::log::v2s_mt_posix::core::open_record(boost::log::v2s_mt_posix::attribute_set const&)", referenced from:
          boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::open_record_unlocked<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in main.o
      "boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)", referenced from:
          boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::push_record_unlocked(boost::log::v2s_mt_posix::record&&) in main.o
      "boost::log::v2s_mt_posix::sources::aux::get_severity_level()", referenced from:
          boost::log::v2s_mt_posix::sources::aux::severity_level<boost::log::v2s_mt_posix::trivial::severity_level>::set_value(boost::log::v2s_mt_posix::trivial::severity_level) in main.o
      "boost::log::v2s_mt_posix::trivial::logger::get()", referenced from:
          _main in main.o
      "boost::log::v2s_mt_posix::core::get_logging_enabled() const", referenced from:
          boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_composite_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex>, boost::log::v2s_mt_posix::sources::features<boost::log::v2s_mt_posix::sources::severity<boost::log::v2s_mt_posix::trivial::severity_level> > >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in main.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [Boost_v1] Error 1
    16:14:46: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project Boost_v1 (kit: Desktop Qt 5.15.2 clang 64bit)
    When executing step "Make"
    

    In *.pro file:

    INCLUDEPATH += $$PREBUILD_DIR/Boost/macos/include
    LIBS += -L$$PREBUILD_DIR/Boost/macos/lib \
    		-lboost_atomic \
    		-lboost_chrono \
    		-lboost_date_time \
    		-lboost_filesystem \
    		-lboost_iostreams \
    		-lboost_log \
    		-lboost_program_options \
    		-lboost_regex \
    		-lboost_system \
    		-lboost_thread
    

    In editor no any errors. Include directory working perfectly. All headers available.

    Screenshot 2020-12-26 at 16.18.25.png

    What am I missing?


  • Lifetime Qt Champion

    I would guess your boost libs are for the wrong architecture. But what has this to do with Qt?



  • @Christian-Ehrlicher I am trying to implement Boost in my Qt application. For now just trying to write tests/examples for researching purpose. The same result when I am trying to implement it into Qt Quick Application.



  • @Christian-Ehrlicher Just tested architecture - all is OK. At least via lipo:

    $ lipo -info libboost_locale.a
    Non-fat file: libboost_locale.a is architecture: x86_64
    $ lipo -info libboost_log.a
    Non-fat file: libboost_log.a is architecture: x86_64
    

  • Lifetime Qt Champion

    Hi,

    Did you check whether you are linking all the logging related boost libraries ?


Log in to reply