pcl
pcl copied to clipboard
[compile error] "PCL_ONLY_CORE_POINT_TYPES not working as expected"
Compiling PCL with Visual Studio 2022,
Even if I set PCL_ONLY_CORE_POINT_TYPES = False in the CMakeSettings.json
i keep getting defined PCL_ONLY_CORE_POINT_TYPES
and so my app that links to PCL does not link correctly with XZYRGB points , specifically
unresolved external symbol "public: bool __cdecl pcl::MomentOfInertiaEstimation<struct pcl::PointXYZRGB>::getMassCenter
and similar errors
if i bypass the thing by renaming all
#ifdef PCL_ONLY_CORE_POINT_TYPES
#ifdef PCL_ONLY_CORE_POINT_TYPES_
i get this
[1/45] Linking CXX shared library bin\pcl_features.dll FAILED: bin/pcl_features.dll lib/pcl_features.lib cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_dll --intdir=features\CMakeFiles\pcl_features.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo features\CMakeFiles\pcl_features.dir\src\board.cpp.obj features\CMakeFiles\pcl_features.dir\src\flare.cpp.obj features\CMakeFiles\pcl_features.dir\src\brisk_2d.cpp.obj features\CMakeFiles\pcl_features.dir\src\boundary.cpp.obj features\CMakeFiles\pcl_features.dir\src\cppf.cpp.obj features\CMakeFiles\pcl_features.dir\src\cvfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\our_cvfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\crh.cpp.obj features\CMakeFiles\pcl_features.dir\src\don.cpp.obj features\CMakeFiles\pcl_features.dir\src\fpfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\from_meshes.cpp.obj features\CMakeFiles\pcl_features.dir\src\gasd.cpp.obj features\CMakeFiles\pcl_features.dir\src\gfpfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\integral_image_normal.cpp.obj features\CMakeFiles\pcl_features.dir\src\intensity_gradient.cpp.obj features\CMakeFiles\pcl_features.dir\src\intensity_spin.cpp.obj features\CMakeFiles\pcl_features.dir\src\linear_least_squares_normal.cpp.obj features\CMakeFiles\pcl_features.dir\src\moment_invariants.cpp.obj features\CMakeFiles\pcl_features.dir\src\moment_of_inertia_estimation.cpp.obj features\CMakeFiles\pcl_features.dir\src\multiscale_feature_persistence.cpp.obj features\CMakeFiles\pcl_features.dir\src\narf.cpp.obj features\CMakeFiles\pcl_features.dir\src\normal_3d.cpp.obj features\CMakeFiles\pcl_features.dir\src\normal_based_signature.cpp.obj features\CMakeFiles\pcl_features.dir\src\organized_edge_detection.cpp.obj features\CMakeFiles\pcl_features.dir\src\pfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\ppf.cpp.obj features\CMakeFiles\pcl_features.dir\src\shot.cpp.obj features\CMakeFiles\pcl_features.dir\src\shot_lrf.cpp.obj features\CMakeFiles\pcl_features.dir\src\spin_image.cpp.obj features\CMakeFiles\pcl_features.dir\src\principal_curvatures.cpp.obj features\CMakeFiles\pcl_features.dir\src\rift.cpp.obj features\CMakeFiles\pcl_features.dir\src\rops_estimation.cpp.obj features\CMakeFiles\pcl_features.dir\src\rsd.cpp.obj features\CMakeFiles\pcl_features.dir\src\grsd.cpp.obj features\CMakeFiles\pcl_features.dir\src\statistical_multiscale_interest_region_extraction.cpp.obj features\CMakeFiles\pcl_features.dir\src\vfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\esf.cpp.obj features\CMakeFiles\pcl_features.dir\src\3dsc.cpp.obj features\CMakeFiles\pcl_features.dir\src\usc.cpp.obj features\CMakeFiles\pcl_features.dir\src\range_image_border_extractor.cpp.obj features\CMakeFiles\pcl_features.dir_\pcl_features_version.rc.res /out:bin\pcl_features.dll /implib:lib\pcl_features.lib /pdb:bin\pcl_features.pdb /dll /version:1.13 /machine:x64 /NODEFAULTLIB:LIBCMTD /INCREMENTAL:NO /OPT:REF delayimp.lib lib\pcl_filters.lib lib\pcl_search.lib lib\pcl_kdtree.lib C:\Users\STELL\source\repos\vcpkg\installed\x64-windows\lib\flann_cpp.lib C:\Users\STELL\source\repos\vcpkg\installed\x64-windows\lib\lz4.lib lib\pcl_octree.lib lib\pcl_sample_consensus.lib lib\pcl_common.lib delayimp.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\Users\STELL\source\repos\Pr\pcl\out\build\x64-Release\features && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/Users/STELL/source/repos/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/STELL/source/repos/Pr/pcl/out/build/x64-Release/bin/pcl_features.dll -installedDir C:/Users/STELL/source/repos/vcpkg/installed/x64-windows/bin -OutVariable out"" LINK: command "C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo features\CMakeFiles\pcl_features.dir\src\board.cpp.obj features\CMakeFiles\pcl_features.dir\src\flare.cpp.obj features\CMakeFiles\pcl_features.dir\src\brisk_2d.cpp.obj features\CMakeFiles\pcl_features.dir\src\boundary.cpp.obj features\CMakeFiles\pcl_features.dir\src\cppf.cpp.obj features\CMakeFiles\pcl_features.dir\src\cvfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\our_cvfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\crh.cpp.obj features\CMakeFiles\pcl_features.dir\src\don.cpp.obj features\CMakeFiles\pcl_features.dir\src\fpfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\from_meshes.cpp.obj features\CMakeFiles\pcl_features.dir\src\gasd.cpp.obj features\CMakeFiles\pcl_features.dir\src\gfpfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\integral_image_normal.cpp.obj features\CMakeFiles\pcl_features.dir\src\intensity_gradient.cpp.obj features\CMakeFiles\pcl_features.dir\src\intensity_spin.cpp.obj features\CMakeFiles\pcl_features.dir\src\linear_least_squares_normal.cpp.obj features\CMakeFiles\pcl_features.dir\src\moment_invariants.cpp.obj features\CMakeFiles\pcl_features.dir\src\moment_of_inertia_estimation.cpp.obj features\CMakeFiles\pcl_features.dir\src\multiscale_feature_persistence.cpp.obj features\CMakeFiles\pcl_features.dir\src\narf.cpp.obj features\CMakeFiles\pcl_features.dir\src\normal_3d.cpp.obj features\CMakeFiles\pcl_features.dir\src\normal_based_signature.cpp.obj features\CMakeFiles\pcl_features.dir\src\organized_edge_detection.cpp.obj features\CMakeFiles\pcl_features.dir\src\pfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\ppf.cpp.obj features\CMakeFiles\pcl_features.dir\src\shot.cpp.obj features\CMakeFiles\pcl_features.dir\src\shot_lrf.cpp.obj features\CMakeFiles\pcl_features.dir\src\spin_image.cpp.obj features\CMakeFiles\pcl_features.dir\src\principal_curvatures.cpp.obj features\CMakeFiles\pcl_features.dir\src\rift.cpp.obj features\CMakeFiles\pcl_features.dir\src\rops_estimation.cpp.obj features\CMakeFiles\pcl_features.dir\src\rsd.cpp.obj features\CMakeFiles\pcl_features.dir\src\grsd.cpp.obj features\CMakeFiles\pcl_features.dir\src\statistical_multiscale_interest_region_extraction.cpp.obj features\CMakeFiles\pcl_features.dir\src\vfh.cpp.obj features\CMakeFiles\pcl_features.dir\src\esf.cpp.obj features\CMakeFiles\pcl_features.dir\src\3dsc.cpp.obj features\CMakeFiles\pcl_features.dir\src\usc.cpp.obj features\CMakeFiles\pcl_features.dir\src\range_image_border_extractor.cpp.obj features\CMakeFiles\pcl_features.dir_\pcl_features_version.rc.res /out:bin\pcl_features.dll /implib:lib\pcl_features.lib /pdb:bin\pcl_features.pdb /dll /version:1.13 /machine:x64 /NODEFAULTLIB:LIBCMTD /INCREMENTAL:NO /OPT:REF delayimp.lib lib\pcl_filters.lib lib\pcl_search.lib lib\pcl_kdtree.lib C:\Users\STELL\source\repos\vcpkg\installed\x64-windows\lib\flann_cpp.lib C:\Users\STELL\source\repos\vcpkg\installed\x64-windows\lib\lz4.lib lib\pcl_octree.lib lib\pcl_sample_consensus.lib lib\pcl_common.lib delayimp.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1189) with the following output: C:\Users\STELL\source\repos\Pr\pcl\out\build\x64-Release\LINK : fatal error LNK1189: library limit of 65535 objects exceeded
ninja: build stopped: subcommand failed.
i am going now to disable only in specific modules i need the
#ifdef PCL_ONLY_CORE_POINT_TYPES
by substituing it with #ifdef PCL_ONLY_CORE_POINT_TYPES_ but that is an hard coded tricky awful temp work around
Have you considered switching to pcl::PointXYZRGBA (which is instantiated), or defining PCL_NO_PRECOMPILE in your program?
I will take a look why you seemingly cannot set PCL_ONLY_CORE_POINT_TYPES to false
yes in the end i had to define PCL_NO_PRECOMPILE but it would be better to be able to use the option PCL_ONLY_CORE_POINT_TYPES = false but it seems the lib becomes too big in terms nr. of objects??
The define is added here, no matter if the CMake option is set to true or false. We could change that, but yes, apparently it is impossible to compile PCL for all point types with MSVC because of the library limit.
So using PCL_NO_PRECOMPILE or including the implementation header <pcl/features/impl/moment_of_inertia_estimation.hpp> is the way to go.
Yes, its a limitation of the windows linker. See https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1189?view=msvc-170
So we could try to split the dll into multiple ones or live with the limited amout of pointtypes.
We could also make it configureable throuh cmake and some preprocessor magic. So you can build for only the pointtype that you use. But that might impose other issues, ie some algorithm requiring specific point types.
Also see https://github.com/PointCloudLibrary/pcl/issues/833 for reference and history 😀
ok understood. i don't think i ll have much time in the next week to invest on this. what are the drawbacks according to you of using the NO_PRECOMPILE? the fact that you don't see some errors at build time but only when you link PCL to an application? what else?
XYZRGB is a very much used point in real world application so maybe we could add that alone to the CORE_POINT_TYPES ?
So we could try to split the dll into multiple ones
That seems like it would be quite difficult and could cause a lot of problems
We could also make it configureable throuh cmake and some preprocessor magic. So you can build for only the pointtype that you use
That is an interesting idea, making PCL_POINT_TYPES, PCL_RGB_POINT_TYPES, PCL_XYZ_POINT_TYPES, etc configurable by CMake
what are the drawbacks according to you of using the NO_PRECOMPILE?
Most importantly, I would say, that your project takes a bit longer to compile.