dreamworksanimation / openmoonray

MoonRay is DreamWorks’ open-source, award-winning, state-of-the-art production MCRT renderer.

Home Page:https://openmoonray.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue building in Ubuntu20.04

ccronix opened this issue · comments

I have successfully building MoonRay in CentOS 7.9 using devtoolset-9, gcc-9.3.0 and want to try building it in a newer runtime-library platform Ubuntu 20.04. The software source has provided a gcc-9.4.0 and libstdc++.so.6.0.28 which is newer than CentOS's 6.0.19, it's under C++11 standard.
When I build all MoonRay's dependencies done, add them to CMAKE_PREFIX_PATH and try building MoonRay, I got some linking error like that:

/usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function readMessageHeader(std::string const&, Json::Value&)': main.cc:(.text+0xf5b): undefined reference to Json::Value::Value(std::string const&)' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function showInfo(std::string const&, bool, std::string const&)': main.cc:(.text+0x1378): undefined reference to Json::StyledWriter::write(Json::Value const&)' /usr/bin/ld: main.cc:(.text+0x14d6): undefined reference to Json::Value::asString() const' /usr/bin/ld: main.cc:(.text+0x151e): undefined reference to Json::Value::asString() const' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function boost::program_options::typed_value<std::string, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const': main.cc:(.text._ZNK5boost15program_options11typed_valueISscE6xparseERNS_3anyERKSt6vectorISsSaISsEE[_ZNK5boost15program_options11typed_valueISscE6xparseERNS_3anyERKSt6vectorISsSaISsEE]+0x34): undefined reference to boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, std::string*, int)' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function boost::program_options::typed_value<std::string, char>::name() const': main.cc:(.text._ZNK5boost15program_options11typed_valueISscE4nameEv[_ZNK5boost15program_options11typed_valueISscE4nameEv]+0x3c): undefined reference to boost::program_options::arg' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function std::vector<std::string, std::allocator<std::string> > boost::program_options::to_internal<std::string>(std::vector<std::string, std::allocator<std::string> > const&)': main.cc:(.text._ZN5boost15program_options11to_internalISsEESt6vectorISsSaISsEERKS2_IT_SaIS5_EE[_ZN5boost15program_options11to_internalISsEESt6vectorISsSaISsEERKS2_IT_SaIS5_EE]+0x97): undefined reference to boost::program_options::to_internal(std::string const&)' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)': main.cc:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0xd9): undefined reference to boost::program_options::detail::cmdline::cmdline(std::vector<std::string, std::allocator<std::string> > const&)' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o: in function main': main.cc:(.text.startup+0x2d0): undefined reference to boost::program_options::abstract_variables_map::operator[](std::string const&) const' /usr/bin/ld: CMakeFiles/msgInfo.dir/main.cc.o:(.data.rel.ro._ZTVN5boost15program_options11typed_valueISscEE[_ZTVN5boost15program_options11typed_valueISscEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const' /usr/bin/ld: ../../../arras4_log/lib/arras4_log/libarras4_log.so: undefined reference to pthread_create' /usr/bin/ld: ../../../arras4_message_api/lib/message_api/libmessage_api.so: undefined reference to Json::Value::getMemberNames() const' /usr/bin/ld: ../../lib/message_impl/libmessage_impl.so: undefined reference to Json::Value::operator[](std::string const&) const' collect2: error: ld returned 1 exit status

It seems that the jsoncpp and boost_program_options got some conflict flags which linker can not relocate. I found some macro definitions in CMakeLists.txt which set _GLIBCXX_USE_CXX11_ABI to false during explain from https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html.

It seems before C++11 and after it, libstdc++ got different implementation for std::string and std::list, so gcc provide that macro to fix compatibility for that. I build all my dependencies without this macro, so I set all _GLIBCXX_USE_CXX11_ABI macro to true in MoonRay's CMakeLists.txt, but got that link error:

/usr/bin/ld: ../../../../../scene_rdl2/lib/render/logging/librender_logging.so: undefined reference to boost::re_detail_107300::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const' /usr/bin/ld: ../../../../../scene_rdl2/lib/render/logging/librender_logging.so: undefined reference to boost::re_detail_107300::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const'

Seems boost_regex got some trouble but not boost_program_options and jsoncpp before. Did someone know what wrong I have done above it?

Have a look at #45.

Have a look at #45.

Hi @gonsolo,thanks for your reply. Have you ever seen some flag missing error during build process? I build all dependencies in static library, and always got dl and pthread flag missing. I must add them to link.txt generating by cmake so that I can pass the build process on CentOS. But for Ubuntu, add pthread flag to link.txt sometimes caused a flag hidden error.

I finally build MoonRay on Ubuntu20.04, gcc-9.4.0 successfully with most dependencies in static link library, but need to change the link.txt generated by cmake manually. I added a large number of flag such as -lpthread -ldl -lboost_filesystem -lboost_iostreams -lblosc, or I will got some undefined reference error. And also at last build denoise_cmd, some link target such as librendering_pbr.so librendering_rt.so librendering_geom.so need to be remove, because libdenoiser.so never used them but if they were added to linking cmdline, gcc's linker will find all the flag they need and I will got a large number of linking error.

Hi, did you build using gonsolo's version?

Hi, did you build using gonsolo's version?

No, gonsolo build MoonRay used clang, since I'm not familiar with this compilier, I build MoonRay used gcc-9.4.0 on Ubuntu 20.04 LTS.