Open xmirabel opened 1 year ago
A (not desirable) workaround is to install boost using: sudo apt-get install libboost-all-dev
But then a compilation error occurs in src/proxyfmu/fmi/fmicontext.hpp
It is needed to add the following headers:
Not the best solution, but if you use gcc9, you should get precompiled binaries with conan, thus omitting the issue you are facing.
I had the installation of the older compiler by the following sequence of commands:
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo apt-get install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --config gcc
then select gcc-9
Then check with:
g++ -v
and
gcc -v
that answer:
gcc version 9.5.0 (Ubuntu 9.5.0-1ubuntu1~22.04)
Then change the conan configuration of the compiler to 9 in ~/.conan/profiles/default:
compiler.version=9
Then redo the compilation procedure:
rm -r build/ ; mkdir build ; cd build
conan install .. --build=missing
cmake .. -DLIBCOSIM_USING_CONAN=TRUE -DCMAKE_BUILD_TYPE=Release
cmake --build .
check the conan boost version installed:
$HOME/.conan/data/boost/1.71.0
but the final result is an error:
Consolidate compiler generated dependencies of target cosim [ 40%] Built target cosim Consolidate compiler generated dependencies of target cpp_fixed_step_algorithm_test [ 41%] Linking CXX executable ../output/release/bin/cpp_fixed_step_algorithm_test /usr/bin/ld : CMakeFiles/cpp_fixed_step_algorithm_test.dir/fixed_step_algorithm_test.cpp.o : dans la fonction « void boost::log::v2_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >::aligned_write<wchar_t>(wchar_t const*, long) » : fixed_step_algorithm_test.cpp:(.text._ZN5boost3log11v2_mt_posix24basic_formatting_ostreamIcSt11char_traitsIcESaIcEE13aligned_writeIwEEvPKT_l[_ZN5boost3log11v2_mt_posix24basic_formatting_ostreamIcSt11char_traitsIcESaIcEE13aligned_writeIwEEvPKT_l]+0xdd) : référence indéfinie vers « boost::log::v2_mt_posix::aux::code_convert_impl(wchar_t const*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long, std::locale const&) » /usr/bin/ld : fixed_step_algorithm_test.cpp:(.text._ZN5boost3log11v2_mt_posix24basic_formatting_ostreamIcSt11char_traitsIcESaIcEE13aligned_writeIwEEvPKT_l[_ZN5boost3log11v2_mt_posix24basic_formatting_ostreamIcSt11char_traitsIcESaIcEE13aligned_writeIwEEvPKT_l]+0x24f) : référence indéfinie vers « boost::log::v2_mt_posix::aux::code_convert_impl(wchar_t const*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long, std::locale const&) » /usr/bin/ld : CMakeFiles/cpp_fixed_step_algorithm_test.dir/fixed_step_algorithm_test.cpp.o : dans la fonction « void boost::log::v2_mt_posix::type_dispatcher::callback_base::trampoline<boost::log::v2_mt_posix::binder1st<boost::log::v2_mt_posix::output_fun, boost::log::v2_mt_posix::expressions::aux::stream_ref<boost::log::v2_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> > >&>, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(void*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) » : fixed_step_algorithm_test.cpp:(.text._ZN5boost3log11v2_mt_posix15type_dispatcher13callback_base10trampolineINS1_9binder1stINS1_10output_funERNS1_11expressions3aux10stream_refINS1_24basic_formatting_ostreamIcSt11char_traitsIcESaIcEEEEEEENSt7__cxx1112basic_stringIwSB_IwESaIwEEEEEvPvRKT0_[_ZN5boost3log11v2_mt_posix15type_dispatcher13callback_base10trampolineINS1_9binder1stINS1_10output_funERNS1_11expressions3aux10stream_refINS1_24basic_formatting_ostreamIcSt11char_traitsIcESaIcEEEEEEENSt7__cxx1112basic_stringIwSB_IwESaIwEEEEEvPvRKT0_]+0x12e) : référence indéfinie vers « boost::log::v2_mt_posix::aux::code_convert_impl(wchar_t const*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long, std::locale const&) » /usr/bin/ld : CMakeFiles/cpp_fixed_step_algorithm_test.dir/fixed_step_algorithm_test.cpp.o : dans la fonction « boost::log::v2_mt_posix::sinks::synchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char> >::consume(boost::log::v2_mt_posix::record_view const&) » : fixed_step_algorithm_test.cpp:(.text._ZN5boost3log11v2_mt_posix5sinks16synchronous_sinkINS2_26basic_text_ostream_backendIcEEE7consumeERKNS1_11record_viewE[_ZN5boost3log11v2_mt_posix5sinks16synchronous_sinkINS2_26basic_text_ostream_backendIcEEE7consumeERKNS1_11record_viewE]+0xf8) : référence indéfinie vers « boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>::consume(boost::log::v2_mt_posix::record_view const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) » /usr/bin/ld : CMakeFiles/cpp_fixed_step_algorithm_test.dir/fixed_step_algorithm_test.cpp.o : dans la fonction « boost::log::v2_mt_posix::sinks::synchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char> >::try_consume(boost::log::v2_mt_posix::record_view const&) » : fixed_step_algorithm_test.cpp:(.text._ZN5boost3log11v2_mt_posix5sinks16synchronous_sinkINS2_26basic_text_ostream_backendIcEEE11try_consumeERKNS1_11record_viewE[_ZN5boost3log11v2_mt_posix5sinks16synchronous_sinkINS2_26basic_text_ostream_backendIcEEE11try_consumeERKNS1_11record_viewE]+0x12d) : référence indéfinie vers « boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>::consume(boost::log::v2_mt_posix::record_view const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) » /usr/bin/ld : ../output/release/lib/libcosim.so : référence indéfinie vers « YAML::detail::node_data::set_scalar(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) » collect2: error: ld returned 1 exit status gmake[2]: *** [tests/CMakeFiles/cpp_fixed_step_algorithm_test.dir/build.make:106 : output/release/bin/cpp_fixed_step_algorithm_test] Erreur 1 gmake[1]: *** [CMakeFiles/Makefile2:249 : tests/CMakeFiles/cpp_fixed_step_algorithm_test.dir/all] Erreur 2 gmake: *** [Makefile:146 : all] Erreur 2
A workaround is to disable test generation:
cmake .. -DLIBCOSIM_USING_CONAN=TRUE -DCMAKE_BUILD_TYPE=Release -DLIBCOSIM_BUILD_TESTS=false
cmake --build .
A local installation can be done:
cmake .. -DLIBCOSIM_USING_CONAN=TRUE -DCMAKE_BUILD_TYPE=Release -DLIBCOSIM_BUILD_TESTS=false -DCMAKE_INSTALL_PREFIX=$HOME/osp/install/linux-release/
cmake --build . --target install
Prerequisite: conan 1.60 installed (conan 2 does not work with libcosim)
when running: conan install .. --build=missing -o proxyfmu=True
the following error occurs: CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Boost (missing: filesystem) (found suitable version "1.71.0", minimum required is "1.71") Call Stack (most recent call first): /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args) CMakeLists.txt:94 (find_package)
ERROR: proxyfmu/0.3.1@osp/stable: Error in build() method, line 37 cmake = self.configure_cmake() while calling 'configure_cmake', line 33 cmake.configure() ConanException: Error 1 while executing cd '/home//.conan/data/proxyfmu/0.3.1/osp/stable/build/12fb9b8d0a334600e69d5361f1677cee897ac9b9' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="11" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++" -DBUILD_SHARED_LIBS="True" -DCMAKE_INSTALL_PREFIX="/home//.conan/data/proxyfmu/0.3.1/osp/stable/package/12fb9b8d0a334600e69d5361f1677cee897ac9b9" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -Wno-dev '/home//.conan/data/proxyfmu/0.3.1/osp/stable/build/12fb9b8d0a334600e69d5361f1677cee897ac9b9'