stack-of-tasks / sot-core

Hierarchical task solver plug-in for dynamic-graph
BSD 2-Clause "Simplified" License
19 stars 32 forks source link

feature-pose, clang and template instanciation #144

Closed olivier-stasse closed 4 years ago

olivier-stasse commented 4 years ago

The C++98 style of template instanciation seems to not work with clang.

[51.326s] [100%] Linking CXX executable test_feature_generic
[51.327s] cd /Users/ostasse/ros2_foxy/build/sot-core/tests && /usr/local/Cellar/cmake/3.17.3/bin/cmake -E cmake_link_script CMakeFiles/test_feature_generic.dir/link.txt --verbose=1
[51.347s] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -pedantic -Wno-long-long -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wwrite-strings -Wconversion  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/test_feature_generic.dir/features/test_feature_generic.cpp.o  -o test_feature_generic   -L/Users/ostasse/ros2_foxy/install/dynamic-graph/lib/dynamic-graph-plugins  -Wl,-rpath,/Users/ostasse/ros2_foxy/install/dynamic-graph/lib/dynamic-graph-plugins -Wl,-rpath,/Users/ostasse/ros2_foxy/build/sot-core/src -Wl,-rpath,/Users/ostasse/ros2_foxy/build/sot-core -Wl,-rpath,/usr/local/lib -Wl,-rpath,/Users/ostasse/ros2_foxy/install/dynamic-graph/lib /usr/local/lib/libboost_filesystem-mt.dylib /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_program_options-mt.dylib /usr/local/lib/libboost_unit_test_framework-mt.dylib /usr/local/lib/libboost_regex-mt.dylib /usr/local/lib/libboost_chrono-mt.dylib /usr/local/lib/libboost_date_time-mt.dylib /usr/local/lib/libboost_atomic-mt.dylib ../src/libgain-adaptive.4.9.0.dylib ../src/libfeature-generic.4.9.0.dylib ../src/libtask.4.9.0.dylib ../src/libfeature-pose.4.9.0.dylib ../libsot-core.4.9.0.dylib /usr/local/lib/libboost_program_options-mt.dylib /usr/local/lib/libboost_regex-mt.dylib /usr/local/lib/libpinocchio.2.4.5.dylib /usr/local/lib/libboost_filesystem-mt.dylib -L/usr/local/Cellar/console_bridge/1.0.0/lib -L/usr/local/Cellar/urdfdom/1.0.4_2/lib -lurdfdom_sensor -lurdfdom_model_state -lurdfdom_model -lurdfdom_world -lconsole_bridge -L/usr/local/Cellar/octomap/1.9.5/lib -L/usr/local/Cellar/eigenpy/2.4.0/lib -L/usr/local/lib -lhpp-fcl -lboost_thread-mt -lboost_date_time-mt -lboost_system-mt -loctomap -loctomath /Users/ostasse/ros2_foxy/install/dynamic-graph/lib/libdynamic-graph.4.2.0.dylib /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_unit_test_framework-mt.dylib /usr/local/lib/libboost_chrono-mt.dylib /usr/local/lib/libboost_date_time-mt.dylib /usr/local/lib/libboost_atomic-mt.dylib /usr/local/lib/libboost_serialization-mt.dylib -lpthread 
[51.619s] Undefined symbols for architecture x86_64:
[51.619s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0>::computeError(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, int)", referenced from:
[51.620s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0> in test_feature_generic.cpp.o
[51.630s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0>::getDimension(unsigned int&, int)", referenced from:
[51.630s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0> in test_feature_generic.cpp.o
[51.640s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0>::computeErrorDot(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, int)", referenced from:
[51.640s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0> in test_feature_generic.cpp.o
[51.649s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0>::computeJacobian(Eigen::Matrix<double, -1, -1, 0, -1, -1>&, int)", referenced from:
[51.650s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0> in test_feature_generic.cpp.o
[51.658s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0>::FeaturePose(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
[51.659s]       TestFeaturePose<(dynamicgraph::sot::Representation_t)0>::TestFeaturePose(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test_feature_generic.cpp.o
[51.667s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1>::computeError(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, int)", referenced from:
[51.667s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1> in test_feature_generic.cpp.o
[51.675s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1>::getDimension(unsigned int&, int)", referenced from:
[51.676s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1> in test_feature_generic.cpp.o
[51.684s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1>::computeErrorDot(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, int)", referenced from:
[51.685s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1> in test_feature_generic.cpp.o
[51.693s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1>::computeJacobian(Eigen::Matrix<double, -1, -1, 0, -1, -1>&, int)", referenced from:
[51.693s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1> in test_feature_generic.cpp.o
[51.702s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1>::FeaturePose(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
[51.702s]       TestFeaturePose<(dynamicgraph::sot::Representation_t)1>::TestFeaturePose(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test_feature_generic.cpp.o
[51.712s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0>::display(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const", referenced from:
[51.712s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)0> in test_feature_generic.cpp.o
[51.724s]   "dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1>::display(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const", referenced from:
[51.724s]       vtable for dynamicgraph::sot::FeaturePose<(dynamicgraph::sot::Representation_t)1> in test_feature_generic.cpp.o
[51.741s] ld: symbol(s) not found for architecture x86_64
[51.742s] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[51.744s] make[2]: *** [tests/test_feature_generic] Error 1

I tried to implement C++11 style with the extern keyword without any luck.

My current setup is: Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0

Any help would be welcome, it is suppose to be a standard feature since C++11...

jmirabel commented 4 years ago

You may try to add

#if __cplusplus >= 201103L
extern template class SOT_CORE_DLLAPI FeaturePose<SE3Representation>;
extern template class SOT_CORE_DLLAPI FeaturePose<R3xSO3Representation>;
#endif

in the header file of FeaturePose, without changing anything else.

olivier-stasse commented 4 years ago

Fixed by #148 Thanks @jmirabel