OSGeo / homebrew-osgeo4mac

Mac homebrew tap for maintaining a stable work environment for the OSGeo.org geospatial toolset
https://git.io/fhh3X
BSD 3-Clause "New" or "Revised" License
363 stars 111 forks source link

liblas fails with --with-laszip option #304

Closed Ylannl closed 6 years ago

Ylannl commented 6 years ago
CMake Error at cmake/modules/FindLASzip.cmake:94 (MESSAGE):
  Failed to open /usr/local/include/laszip/laszip.hpp file

I believe this is due to a change in laszip, since the latest version no longer includes that header file.

Ylannl commented 6 years ago

It installs correctly if I manually change the dependency to laszip@2. However that one may conflict with the newer laszip.

nickrobison commented 6 years ago

@Ylannl Can you try installing the liblas-gdal2 formula? Looks like homebrew has a liblas formula in the core tap, whereas we have one that bundles the older version of laszip and builds against it.

Ylannl commented 6 years ago

Sorry for my late response. I coincidentally tried this yesterday. And liblas-gdal2 does build correctly with the --with-laszip option. However, this is getting rather messy, i.e. cmake doesn't automatically find this version of liblas.

nickrobison commented 6 years ago

@Ylannl Glad to hear it's building for you!

Can you clarify your last comment?

cmake doesn't automatically find this version of liblas.

Do you mean that non-homebrew projects using cmake are unable to find the liblas headers?

Because homebrew core ships its own versions of gdal and liblas, we can't automatically link the headers into /usr/local/lib. There are two workaround though.

  1. You can set the include and lib flags to point make to the correct location:

    LDFLAGS:  -L/usr/local/opt/liblas-gdal2/lib
    CPPFLAGS: -I/usr/local/opt/liblas-gdal2/include
  2. You can force link the formula to place the liblas library into /usr/local/lib, which should be automatically detected by cmake.

brew link --force liblas-gdal2

You should only to that know if you know for sure that you don't have any other installed versions of liblas or gdal. You can add the --dry-run flag before hand, to see what might be overwritten.

Ylannl commented 6 years ago

Yes that is what I meant. Thank you for your detailed answer.