Compiling error (Undefined symbols for architecture x86_64: ld: symbol(s) not found for architecture x86_64) on macos

Issue #43 resolved
Bin LI created an issue

I tried to compile on MAC OS 10.11.4 using clang compiler and cmake 3.5.1, ending up with following error. Any suggestion? Thank you very much!

[ 86%] Linking CXX shared library libmshr.dylib
Undefined symbols for architecture x86_64:
  "boost::detail::get_tss_data(void const*)", referenced from:
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::get() const in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::get() const in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::get() const in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Triangle_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::get() const in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Segment_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Segment_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::get() const in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Interval_nt<false>, CGAL::Gmpq, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::To_interval<CGAL::Gmpq> > >::get() const in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Line_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Line_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::get() const in CSGCGALDomain3D.cpp.o
      ...
  "boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)", referenced from:
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::reset(CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >*) in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::~thread_specific_ptr() in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::reset(CGAL::Lazy<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >*) in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::~thread_specific_ptr() in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::reset(CGAL::Lazy<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >*) in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::~thread_specific_ptr() in CSGCGALDomain3D.cpp.o
      boost::thread_specific_ptr<CGAL::Lazy<CGAL::Triangle_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::reset(CGAL::Lazy<CGAL::Triangle_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_2<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >*) in CSGCGALDomain3D.cpp.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[2]: *** [libmshr.1.7.0dev.dylib] Error 1
make[1]: *** [CMakeFiles/mshr.dir/all] Error 2
make: *** [all] Error 2

Comments (8)

  1. Benjamin Dam Kehlet

    Yes, can you try again with a fresh pull of master. (I don't have a mac available to test on at the moment).

  2. Corrado Maurini

    This is fixed now (I work with Bin and we filed the issue together). Thanks! FYI there are still few warnings with clang:

    [ 80%] Building CXX object CMakeFiles/mshr.dir/src/TetgenMeshGenerator3D.cpp.o
    [ 83%] Building CXX object CMakeFiles/mshr.dir/src/VTPFileReader.cpp.o
    [ 86%] Linking CXX shared library libmshr.dylib
    [ 86%] Built target mshr
    [ 88%] Swig source
    Scanning dependencies of target mshrable
    [ 91%] Building CXX object CMakeFiles/mshrable.dir/app/mshrable.cpp.o
    /opt/HPC/fenics-dev-petsc-stable/include/dolfin/geometry/Point.h:334: Warning 321: 'str' conflicts with a built-in name in python
    /opt/HPC/fenics-dev-petsc-stable/include/dolfin/geometry/Point.h:334: Warning 321: 'str' conflicts with a built-in name in python
    Scanning dependencies of target _mshr
    [ 94%] Building CXX object swig/CMakeFiles/_mshr.dir/mshrPYTHON_wrap.cxx.o
    /opt/HPC/src/fenics-dev-petsc-stable/mshr/build/swig/mshrPYTHON_wrap.cxx:4184:133: warning: '&&' within '||' [-Wlogical-op-parentheses]
      if (!(PyBool_Check(obj)||PyArray_IsScalar(obj, Bool)||(PyArray_Check(obj)&&PyArray_SIZE(reinterpret_cast<PyArrayObject*>(obj))==1)&&PyArray_TYPE(reinterpret_cast<PyArrayObject*>(obj))==NPY_BOOL))
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/HPC/src/fenics-dev-petsc-stable/mshr/build/swig/mshrPYTHON_wrap.cxx:4184:133: note: place parentheses around the '&&' expression to silence this warning
      if (!(PyBool_Check(obj)||PyArray_IsScalar(obj, Bool)||(PyArray_Check(obj)&&PyArray_SIZE(reinterpret_cast<PyArrayObject*>(obj))==1)&&PyArray_TYPE(reinterpret_cast<PyArrayObject*>(obj))==NPY_BOOL))
                                                                                                                                        ^
                                                            (                                                                                                                                          )
    /opt/HPC/src/fenics-dev-petsc-stable/mshr/build/swig/mshrPYTHON_wrap.cxx:4214:63: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
        const std::unique_ptr<const std::vector<double>> vertices(std::move(self->get_vertices()));
                                                                  ^
    /opt/HPC/src/fenics-dev-petsc-stable/mshr/build/swig/mshrPYTHON_wrap.cxx:4214:63: note: remove std::move call here
        const std::unique_ptr<const std::vector<double>> vertices(std::move(self->get_vertices()));
                                                                  ^~~~~~~~~~                    ~
    /opt/HPC/src/fenics-dev-petsc-stable/mshr/build/swig/mshrPYTHON_wrap.cxx:4226:66: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
        const std::unique_ptr<const std::vector<std::size_t>> facets(std::move(self->get_facets()));
                                                                     ^
    /opt/HPC/src/fenics-dev-petsc-stable/mshr/build/swig/mshrPYTHON_wrap.cxx:4226:66: note: remove std::move call here
        const std::unique_ptr<const std::vector<std::size_t>> facets(std::move(self->get_facets()));
                                                                     ^~~~~~~~~~                  ~
    [ 97%] Linking CXX executable mshrable
    [ 97%] Built target mshrable
    
  3. Benjamin Dam Kehlet

    Good. Thanks! Yes, I'm aware of the warnings now. The one from the swig generated code (mshrPYTHON_wrap.cxx) is hard to get rid of, I guess, (gcc also warnings about this) but the others should be trivial to fix.

  4. Log in to comment