1

How can I get around missing boost::throw_exception while building PCL?

I've built PCL on Windows (MSVC 2013) a few times in the past, but I've never see this error. It's been blocking me all today and yesterday:

LNK2019: unresolved external symbol "void __cdecl boost::throw_exception(class std::exception const &)" (?throw_exception@boost@@YAXAEBVexception@std@@@Z) referenced in function "public: __cdecl boost::detail::shared_count::shared_count<struct pcl::io::ply::ply_parser::list_property<unsigned char,signed char> >(struct pcl::io::ply::ply_parser::list_property<unsigned char,signed char> *)" (??$?0U?$list_property@EC@ply_parser@ply@io@pcl@@@shared_count@detail@boost@@QEAA@PEAU?$list_property@EC@ply_parser@ply@io@pcl@@@Z) [C:\Users\mrussell\.conan\data\pcl\1.7.2\ntc\stable\build\d63ff451cbfa147e3b952f2f3790530e1116d93c\io\pcl_io_ply.vcxproj]

It appears that BOOST_NO_EXCEPTIONS is set in boost\config\compiler\visualc.hpp, which prevents boost/throw_exception.hpp from defining it.

I've tried to set TPN_WIN32 to /EHsc (see this answer) both through CMake and via the project properties in Visual Studio to no avail, and even tried sneaking a definition into a high level PCL include (see this answer), nothing worked.

My CMake generator is Visual Studio 12 2013 Win64 and my definitions are:

-DBOOST_ROOT:PATH=%CONAN_BOOST%
-DCMAKE_INSTALL_PREFIX=%CONAN_PCL%
-DEIGEN3_DIR:PATH=%CONAN_EIGEN%\share\eigen3\cmake
-DEIGEN_INCLUDE_DIR:PATH=%CONAN_EIGEN%\include\eigen3
-DFLANN_INCLUDE_DIR:PATH=%CONAN_FLANN%\include
-DFLANN_LIBRARY:FILEPATH=%CONAN_FLANN%\lib\libflann_cpp.so
-DQHULL_INCLUDE_DIR:PATH=%CONAN_QHULL%\include
-DQHULL_LIBRARY:FILEPATH=%CONAN_QHULL%\lib\libqhull.so
-DGTEST_ROOT:PATH=%CONAN_GTEST%
-DBUILD_surface_on_nurbs:BOOL=ON

I've tried:

  • Removing Qt & VTK
  • With Boost 1.60, 1.66, and 1.59
  • Linking against a shared and static versions of boost. (PCL does not seem to like shared boost on Windows...)
  • Attempting to build shared and static versions of PCL

I feel like I'm chasing the wrong thing, or am missing something. Maybe I'm missing a _CPPUNWIND define for exceptions? I'm really just stuck.

Matt
  • 1,928
  • 24
  • 44
  • 1
    I ran into this just now, but I wasn't working with PCL, just boost. The problem was that I just installed vs2017, but went back to vs2015. Apparently the vs2017 installer messes with the vs2015 installation, so I had to uninstall vs2017 and repair vs2015. After that the error went away. I hope this helps. – Javanator Mar 09 '18 at 02:46
  • hmm, that does probably help actually. I've taken a break from that build this week, but next week when I have to go back to it, I'm going to try on another (fresh) Windows computer with msvc. Thanks! – Matt Mar 09 '18 at 14:13
  • I don't think anything really changed.. But after taking a break on this for a week, this bug seemed to have disappeared. The only thing I might have changed (so much back and forth that it was hard to keep track) was being more explicit with the C++11 flag. But I really have no useful comments for anyone else fighting this issue. :( – Matt Mar 19 '18 at 15:56

1 Answers1

0

TPN_WIN32 is a user defined variable on that post you reference. You need to append /EHsc to your CMAKE_CXX_FLAGS to pass it to the compiler.

Unrelated but really suspicious -DFLANN_LIBRARY:FILEPATH=%CONAN_FLANN%\lib\libflann_cpp.so is a unix dynamic library. You can't link it on windows with MSVC.

  • About the `.so`, you're totally right. I did *edit* the command (to make it more readable) before posting, but it was copied.. I completely missed that, is definitely should be the `.lib`s that exist there. I'll try make that fix asap. Thanks. – Matt Mar 11 '18 at 18:42