Build with LAS problem

I assume that this is a very simple question - once I know how to proceed!

Intention: Build ParaView with LAS data file import, currently on Linux, later Windows intended.

Turning the option on, CMake will ask for libLAS, which can be found and provided. In order to really go for a supported version, I downloaded it directly from where the ParaView Superbuild is getting it.

Building is very simple: with CMake including “generate”, then ninja - no problem so far.

But then the ParaView Build (still at 5.9.1, but probably this is not the issue) I am getting the error message:

libLAS configuration, version 1.8.1
CMake Error at /home/cornelis/Main/develop/libLAS/release/cmake/liblas-config.cmake:22 (include):
  include could not find load file:

    /home/cornelis/Main/develop/libLAS/release/cmake/liblas-depends.cmake
Call Stack (most recent call first):
  VTK/CMake/vtkModule.cmake:4222 (find_package)
  VTK/IO/LAS/CMakeLists.txt:1 (vtk_module_find_package)

Well, liblas-depende.cmake exists, but not where the tool is looking for it, but rather in

/home/cornelis/Main/develop/libLAS/release/cmake/CMakeFiles/Export/share/cmake/libLAS

So something seems to be somehow misaligned. Simply copying it to the location where it is expected will result in looking for the library (.so) file in the wrong location - and even in a place where I really do not want to copy it manually.

…and above all: This manually fiddling around and moving files is exactly not what is the intention of working with CMake & Co!

Bottom line: Is there still some magic “ninja install export mega $$$” command that I am missing?

PS: I must admit that I am still after years fighting with the concepts of “installing”, “importing”, “exporting” etc. in CMake - and I am afraid I will never really get it! So the easiest way is always to have a working setup - somehow… (In the current case it looks almost like the easiest thing would be to simply copy the libLAS library and include files, but this is not working with the CMake build and superbuild setup…)

Did you specify the libLAS_DIR folder in cmake?

Yes, sure! It finds liblas-config.cmake perfectly. But that one wants to include liblas-depends.cmake, and looks for it in the wrong directory.

The liblas build works also perfectly, so I can run the test applications. The trouble is with the “interface”, i.e. with the way how the ParaView build “pulls in” the liblas stuff.

And the reason why I was assuming that somebody would be able to help here is the fact, that somehow the “superbuild” seems to do the trick without manually interfering and shifting single files from here to there!

My guess is that after the build I need to do some cmake --install magic stuff that might bring the files to where they are supposed to be for the “find_project” to work correctly withing the ParaView setup, but I am not able to find out what this magic command might be!

Because again:

  • The “superbuild” is able to do it, so there must be a way
  • Building liblas with first cmake configuration, then ninja generates binaries just fine
  • Also I built ParaView in the past many times, different versions, only not yet with the LAS support activated

This conundrum sounds similar to a problem I had building kitware CASTXML which depends on the CLang parser. The super-build works perfectly but I wanted to build different versions of LLVM independently. That was quite a long time ago but I think the trick was to make install the LLVM code and reference that target folder in the CASTXML build. Did you make install libLAS?

Actually this was my guess: “Installing” in CMake slang is something like moving certain files to some target location. I tried, but then I realized that I still have to check the instructions about how to specify that target directory. Maybe I also need to specify with some variables different target directories for binaries (like .so file) and headers (.h) etc.

So you are actually confirming my guess - and I will have to see how I can find out more details along that track.

https://cmake.org/cmake/help/latest/command/install.html

Here I see that there is an “install” command as part of the CMakeLists.txt stuff, so probably I will have to provide some variables about file moving targets during the CMake run, and afterwards during the build (which I am doing with ninja) I might have to do some additional build run like ninja install, which is then supposed to do that required file moving…

No idea yet, but something in that direction I think - with still some trial and error until the right files will really end up where they need to go…

Because so far it looks all perfect: All required files do exist, but not in the right location where the ParaView CMake run expects them!

Normally when you make install a project, after building it, the files get moved to the target install folder and arranged in a predetermined way. If you then reference that folder as your libLAS_dir it should work.

That’s why I asked if you did make install for libLAS or did you just build it and try to use the build folder in VTK?

No, I did not do make install, because I am not working with make.

What I see is that the CMake stuff has an install command, I was also already using it for own projects, but never with the feeling that I really know what I am doing, because within the CMakeLists.txt file, the commands do not have immediate effect, but will only do something later on “during the install phase” - whatever that is.

Ok, my understanding is that it means some step that might be triggered by a make install in a pre stone age Unix setup, but in my case it would be something like ninja install - if that exists (because ninja is my make tool).

If I look at cmake --help, I find that there is a command cmake --install , with the explanation: Install a CMake-generated project binary tree. Which sounds like exactly the thing that I might want to have! So I generated some …/install folder somewhere with mkdir, supposed to be the target of this operation, and type the command

cmake --install <that directory>

What I get is the error message: CMake Error: Error processing file: /cmake_install.cmake. Ah ok, so it wants there a directory with such a file, not just an empty target directory for “installing”. What I see with find -name cmake_install.cmake from my target build directory is that I am actually having there even 6 files with that name in 6 different folders, one even in the build target base directory, so I am trying another command:

cmake --install .

That one results now in an error message that tells me file cannot create directory: /usr/local/share/cmake/libLAS. Maybe need administrative privileges. But this is a location where I really do not want to fiddle around during my build: It looks like the command is trying to really achieve something that could indeed be called installing the liblas library and tools on my running system.

Meaning that there might still be a way to define a target directory for that install command which could play the role that you were writing: a folder which I can specify as LIBLAS_DIR for the ParaView configuration! The directory usr/local/share/… looks like it is some kind of default for the case that such a directory is not specified.

Wow - some progress - and maybe that was it??

  1. Within one of these cmake_install.cmake files I saw that there is a variable CMAKE_INSTALL_PREFIX that receives a default value if not predefined, so I tried to predefine it with my new empty …/install folder:

cmake -D "CMAKE_INSTALL_PREFIX=./install" --install .

  1. No more error message, but as a result, that ./install folder was still empty, so I tried not another command:

ninja install

  1. Which again did something without an error message: it filled my ./install folder with some stuff. No liblas-config.cmake file like it seems to have been the case for you, but there was one in ./install/share/cmake/libLAS.

And with this as LIBLAS_DIR, the ParaView configuration finally went through without an error message!

Let’s see if the build will go through now successfully: going to start it now…

Excellent result!

I used the term “make install” in a generic sense. I knew you were using ninja but I didn’t know what the equivalent command was. I also should have mentioned the CMAKE_INSTALL_PREFIX variable. You’re right it won’t install without administrator privileges if you use the default /use/local folder.

Hopefully you’re sorted now and you’ll know for next time. :slight_smile:

Yes, it looks like the thing is now “done”: The ParaView build was now successful, and reading LAS files was working nicely!

Thanks for your hints!