csiro-robotics / treetools

Command line tools for manipulating geometrical descriptions of forests. Used to analyse and process the forest reconstructions primarily from raycloudtools.
Other
4 stars 4 forks source link

compiling treetools in conda environment #3

Open tiagodc opened 1 month ago

tiagodc commented 1 month ago

Hi there. I just installed raycloudtools and treetools under a custom conda environment.

raycloudtools installed and tested fine after I compiled all necessary dependencies adding -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX to all cmake calls.

However, when trying to compile treetools I had issues linking to the PROJ and GeoTIFF libraries.

To solve the PROJ issue I just added a find_package(PROJ REQUIRED CONFIG) directive to the CMakeLists.txt

In the GeoTIFF case I had alter the raycloudtools-targets.cmake file manually after building raycloudtools, replacing geotiff_library by the full path to the libgeotiff.so file in the INTERFACE_LINK_LIBRARIES variable.

Those steps solved the issue and I'm able to run treetools inside my conda environment, but I couldn't track the source of the GeoTIFF issue to fix it. I checked the raycloudtools-targets.cmake in my local Docker image and the libgeotiff.so path was correctly listed in INTERFACE_LINK_LIBRARIES, so the issue seems to occur when building raycloudtools in a custom environment not using the system's default paths.

Any ideas on the origin of the GeoTIFF linking issue and how to solve it?

Best regards, Tiago

thomas-lowe commented 1 month ago

Hi Tiago, The Geotiff (and proj) libraries are only needed if you want to render a cloud or tree file to a geotiff, they are disabled by default as they have historically been a tricky dependancy to get right. So if you don't need to render to a geotiff image it should all compile and link fine as WITH_TIFF is off by default.

If you do want to render geotiffs then use the build option WITH_TIFF on both raycloudtools and on treetools. For the latter it then includes the line: find_package(PROJ REQUIRED COMPONENTS proj). Are you saying that you required the extra line "find_package(PROJ REQUIRED CONFIG)"?

The docker folder in raycloudtools (https://github.com/csiro-robotics/raycloudtools) contains a DockerFile which shows the linux commands for including the geotiff library if this helps.

Otherwise I am afraid I will not be much help as I'm not very well versed in the dependency part of cmake, such as the .cmake files and how FIND_PACKAGE operates etc. If you do manage to find a fix that also works outside of a conda environment then please do submit it as a pull request and others can benefit from your fix.