FreeCAD 0.18.4 fails to build with vtk 9.0

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by hobbes1069 »

Looks like you've got it mostly figured out but I already posted to the VTK forums...

https://discourse.vtk.org/t/porting-fre ... k-9-0/4404

Thanks,
Richard
StefanBruens
Posts: 24
Joined: Sun Nov 29, 2020 5:30 am

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by StefanBruens »

I have applied the VTK 9 patch on top of 0.18.5 (applies mostly fine, one whitespace problem due to changed line endings), and so far it is working without any errors in the Path and MeshDesign workbenches.
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by hobbes1069 »

I applied the vtk9 patch to my master checkout that I've already built for Fedora and tried to build with vtk 9.0.1, now I'm getting a weird boost problem:

Code: Select all

/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::put_mem_block(void*)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `vtable for boost::program_options::error_with_option_name'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::variables_map::variables_map()'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::get_default_error_string(boost::regex_constants::error_type)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::error_with_option_name::what() const'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `typeinfo for boost::program_options::error_with_option_name'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `typeinfo for boost::regex_error'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::positional_options_description::positional_options_description()'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::positional_options_description::add(char const*, int)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::arg[abi:cxx11]'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `vtable for boost::program_options::variables_map'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::basic_parsed_options<char> boost::program_options::parse_config_file<char>(std::basic_istream<char, std::char_traits<char> >&, boost::program_options::options_description const&, bool)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > >::maybe_assign(boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > > const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::detail::cmdline::get_canonical_option_prefix()'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::options_description::add(boost::program_options::options_description const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::validation_error::get_template[abi:cxx11](boost::program_options::validation_error::kind_t)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, char const*)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `typeinfo for boost::program_options::value_semantic_codecvt_helper<char>'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::validators::check_first_occurrence(boost::any const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::get_mem_block()'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::notify(boost::program_options::variables_map&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::options_description::add_options()'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::verify_options(unsigned int, boost::regex_constants::_match_flags)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::detail::cmdline::run()'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::detail::cmdline::set_positional_options(boost::program_options::positional_options_description const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::options_description::m_default_line_length'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::to_internal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::re_detail_107300::raise_runtime_error(std::runtime_error const&)'
/usr/bin/ld: ../../lib/libFreeCADApp.so: undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)'
collect2: error: ld returned 1 exit status
GCC 10.2.1
Boost 1.73

https://copr-be.cloud.fedoraproject.org ... ild.log.gz

Thanks,
Richard
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by hobbes1069 »

Still having weird boost issues now with 1.75... I'm assuming CMake may be to blame.

It's finding all the required components, then finding the python one separately, and then only linking with the serialization library...

https://lists.fedoraproject.org/archive ... HU5VK3DSZ/
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by hobbes1069 »

My current working theory is there has been some kind of change in behavior in CMake, although if I'm correct then I'm not sure how it ever worked in the first place.

SetupBoost() with all the needed components is called once in the main CMakeLIsts.txt file but then other modules call find_package(boost...) directly. My theory is these later calls are overwriting the Boost_LIBRARIES variable.

If that's the case, then the variable needs to be saved to a new name before the next find_package call.
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by hobbes1069 »

Ok, so in thinking about the problem I remembered variables in CMake have scope, but regardless my fixed worked. I just built 0.19.2 for Fedora Rawhide.

Code: Select all

$ cat freecad-boost.patch
Index: FreeCAD-0.19.2/CMakeLists.txt
===================================================================
--- FreeCAD-0.19.2.orig/CMakeLists.txt
+++ FreeCAD-0.19.2/CMakeLists.txt
@@ -46,6 +46,7 @@ if(NOT FREECAD_LIBPACK_USE OR FREECAD_LI
     SetupPCL()
     SetupPybind11()
     SetupBoost()
+	set(Boost_LIBRARIES_App ${Boost_LIBRARIES})
     SetupXercesC()
     find_package(ZLIB REQUIRED)
     find_package(PyCXX REQUIRED)
Index: FreeCAD-0.19.2/src/App/CMakeLists.txt
===================================================================
--- FreeCAD-0.19.2.orig/src/App/CMakeLists.txt
+++ FreeCAD-0.19.2/src/App/CMakeLists.txt
@@ -59,7 +59,7 @@ include_directories(
 
 set(FreeCADApp_LIBS
     FreeCADBase
-    ${Boost_LIBRARIES}
+    ${Boost_LIBRARIES_App}
 )
 
 if (BUILD_QT5)
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by freman »

This can looks like it's getting kicked down the road at Fedora where most bugs die of old age and get "fixed" by being declared too old.

Is there any progress on this, I seem to be hitting similar issues having just made the foolish error of moving the "current" Fedora release.

https://forum.freecadweb.org/viewtopic. ... 31#p502531

Quite a lot of progress seems to have been made here, what is the state of play ?

Thx.
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by hobbes1069 »

freman wrote: Sat May 08, 2021 4:58 pm This can looks like it's getting kicked down the road at Fedora where most bugs die of old age and get "fixed" by being declared too old.

Is there any progress on this, I seem to be hitting similar issues having just made the foolish error of moving the "current" Fedora release.

https://forum.freecadweb.org/viewtopic. ... 31#p502531

Quite a lot of progress seems to have been made here, what is the state of play ?
I'm not sure what you mean. Yes that does often happen in general but I have spent countless hours of my "free" time trying to keep FreeCAD going in Fedora but it has a very complicated dependency chain to the point I've almost given up.

I built 0.19.2 for Fedora 33 and up but they're in testing if you want to try it out and report any isses.

Thanks,
Richard
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by freman »

Hobbes, please don't think that was a comment on your sterling efforts with Fedora which are much appreciated. It was a comment on my experience of posting bug reports Fedora in general, where most bugs die of old age without ever getting fixed.
I was foolish in updating to current Fedora release, I generally try to stay a bit behind the curve to avoid this kind of hassle.

I had master built on Fed33 and it seemed fine. Now I'm in a corner because I can't downgrade back to Fed33 and I really don't want to do a fresh installation again. I'll just have to build without SMESH until this gets sorted out.
Post Reply