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

CMake Error occurs in new PCLConfig.cmake #2059

Closed
UnaNancyOwen opened this issue Nov 7, 2017 · 9 comments
Closed

CMake Error occurs in new PCLConfig.cmake #2059

UnaNancyOwen opened this issue Nov 7, 2017 · 9 comments

Comments

@UnaNancyOwen
Copy link
Member

UnaNancyOwen commented Nov 7, 2017

The user own project can't creat using new PCLConfig.cmake, because an error has occurre when congfigure using CMake.
These options (Ensenso SDK, OpenNI) has been disabled when building PCL.
(WITH_ENSENSO and WITH_OPENNI is OFF.)
Strangely, These options (david SDK, DepthSense SDK, RealSense SDK) has also been disabled when building PCL, but no error occurs for these.
(WITH_DAVIDSDK, WITH_DSSDK and WITH_RSSDK is OFF.)

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ENSENSO_LIBRARY (ADVANCED)
    linked by target "project" in directory c:/sample
OPENNI_LIBRARY (ADVANCED)
    linked by target "project" in directory c:/sample

This problem can be fixed temporarily with the following changes in PCLConfig.cmake#L570.
(Remove ${OPENNI_LIBRARIES} and ${ENSENSO_LIBRARIES})
But, It is not desirable. :(

- list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${OPENNI2_LIBRARIES} ${ENSENSO_LIBRARIES} ${davidSDK_LIBRARIES} ${DSSDK_LIBRARIES} ${RSSDK_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES})
+ list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI2_LIBRARIES} ${davidSDK_LIBRARIES} ${DSSDK_LIBRARIES} ${RSSDK_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES})

Do you know anything about this problem?

Your Environment

  • Operating System and version: Windows
  • Compiler: Visual Studio
  • PCL Version: 1.8.1-dev (master/HEAD)
  • CMake version: 3.9.5
@taketwo
Copy link
Member

taketwo commented Nov 7, 2017

The only difference between Ensenso/OpenNI and the other grabbers that I can find are these lines:

pcl/io/CMakeLists.txt

Lines 371 to 379 in 7b3b571

if(WITH_OPENNI)
list(APPEND EXT_DEPS libopenni)
endif()
if(WITH_OPENNI2)
list(APPEND EXT_DEPS libopenni2)
endif()
if(WITH_ENSENSO)
list(APPEND EXT_DEPS ensenso)
endif()

But this does not offer any hints how to solve the problem. I will need to investigate more.

@taketwo
Copy link
Member

taketwo commented Nov 7, 2017

I checked the PCLConfig.cmake file and how it is generated. To be honest, I think it's a big mess and I'm not even sure how to approach cleaning it up.

As for this particular issue, it results from the sloppy way the dependencies are handled. Currently, we try to re-discover and link all optional dependencies, even if they were not found during library build time. And the linking in this config script is less robust than in the main CMakeLists, so we get errors when some of the libraries are not found.

Here is a workaround fix for Ensenso. Instead of improving the dependency handling I just make sure that the finder script does not set variables if the library is not found. Please give this patch a try. If it works, I'll produce similar fixes for OpenNI/OpenNI2 and submit a PR.

ensenso-patch.txt

@SergioRAgostinho
Copy link
Member

Sorry for all this trouble guys 😅 @taketwo had already warned that #1421 was gonna be a huge problem, but I really believe that now is the best time to clean it up for 1.9.0.

@taketwo
Copy link
Member

taketwo commented Nov 7, 2017

Oh wow, I just re-read my first comment in that thread. There I point to one example of what a potential issue can be: #1337. And guess what, this exact issue just hit us :D

@UnaNancyOwen
Copy link
Member Author

@taketwo PCLConfig.cmake will work correctly when applying that patch. CMake Error about Ensenso doesn't occur. Please submit Pull Request. Thanks,

Currently, we try to re-discover and link all optional dependencies, even if they were not found during library build time.

I think that we should solve this problem in the future.

taketwo added a commit to taketwo/pcl that referenced this issue Nov 8, 2017
* Make sure XXX_LIBRARIES and XXX_INCLUDE_DIRS variables are not defined
  if the packages are not found
* Make XXX_LIBRARIES and XXX_INCLUDE_DIRS advanced options
* Some reformatting

Fixes PointCloudLibrary#2059
@frozar
Copy link
Contributor

frozar commented Nov 8, 2017

@taketwo After applying the patch, I can pass the cmake configuration step 👍

UnaNancyOwen pushed a commit to UnaNancyOwen/pcl that referenced this issue Nov 24, 2017
* Make sure XXX_LIBRARIES and XXX_INCLUDE_DIRS variables are not defined
  if the packages are not found
* Make XXX_LIBRARIES and XXX_INCLUDE_DIRS advanced options
* Some reformatting

Fixes PointCloudLibrary#2059
@kgreenek
Copy link

kgreenek commented Jun 11, 2018

I am still seeing this issue with QHull (using current pcl master). If I don't have QHull installed, I can't have a cmake project that depends on PCL. PCL builds fine without QHull features, but the config script that PCL installs requires QHull to be installed.

@taketwo
Copy link
Member

taketwo commented Jun 12, 2018

Please file a new issue with all relevant information, error output, etc.

@kgreenek
Copy link

Done (#2343). Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants