Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compile error] "PCL_ONLY_CORE_POINT_TYPES not working as expected" #5928

Open
mynickmynick opened this issue Jan 12, 2024 · 10 comments
Open
Labels
kind: compile error Type of issue status: triage Labels incomplete

Comments

@mynickmynick
Copy link
Contributor

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::getMassCenter

and similar errors

@mynickmynick mynickmynick added kind: compile error Type of issue status: triage Labels incomplete labels Jan 12, 2024
@mynickmynick
Copy link
Contributor Author

mynickmynick commented Jan 12, 2024

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:\PROGRA2\WI3CF21\10\bin\1002261.0\x64\rc.exe --mt=C:\PROGRA2\WI3CF21\10\bin\1002261.0\x64\mt.exe --manifests -- C:\PROGRA1\MIB0551\2022\PROFES1\VC\Tools\MSVC\14381.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:\PROGRA1\MIB0551\2022\PROFES1\VC\Tools\MSVC\14381.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.

@mynickmynick
Copy link
Contributor Author

mynickmynick commented Jan 12, 2024

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

@mvieth
Copy link
Member

mvieth commented Jan 12, 2024

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

@mynickmynick
Copy link
Contributor Author

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??

@mvieth
Copy link
Member

mvieth commented Jan 12, 2024

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.

@larshg
Copy link
Contributor

larshg commented Jan 13, 2024

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.

@larshg
Copy link
Contributor

larshg commented Jan 13, 2024

Also see #833 for reference and history 😀

@mynickmynick
Copy link
Contributor Author

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?

@mynickmynick
Copy link
Contributor Author

XYZRGB is a very much used point in real world application so maybe we could add that alone to the CORE_POINT_TYPES ?

@mvieth
Copy link
Member

mvieth commented Jan 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: compile error Type of issue status: triage Labels incomplete
Projects
None yet
Development

No branches or pull requests

3 participants