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

gdal.pc contains wrong paths if CMAKE_INSTALL_<dir> is absolute #6004

Closed
dotlambda opened this issue Jun 29, 2022 · 1 comment
Closed

gdal.pc contains wrong paths if CMAKE_INSTALL_<dir> is absolute #6004

dotlambda opened this issue Jun 29, 2022 · 1 comment
Assignees

Comments

@dotlambda
Copy link
Contributor

Expected behavior and actual behavior.

I'm building gdal on NixOS and obtaining the following in lib/pkgconfig/gdal.pc:

CONFIG_VERSION=3.5.0
CONFIG_INST_PREFIX=/nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3
CONFIG_INST_LIBS=-L/nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3//nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3/lib -lgdal
CONFIG_INST_CFLAGS=-I/nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3//nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3/include
CONFIG_INST_DATA=/nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3/share/gdal
prefix=${CONFIG_INST_PREFIX}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include
datadir=${CONFIG_INST_DATA}

Name: libgdal
Description: Geospatial Data Abstraction Library
Version: ${CONFIG_VERSION}
Libs: ${CONFIG_INST_LIBS}
Libs.private: -lcryptopp -lssl -lcrypto -llzma -ldeflate -llz4 -larmadillo -lqhull_r -lgeotiff -ltiff -lheif -lLerc -lzstd -lbrunslienc-c -lbrunslidec-c -ljpeg -lpoppler -lpng -lgif -lnetcdf -lblosc -lcfitsio -lhdf5 -lcurl -lwebp -lhdf -lmfhdf -lz -lopenjp2 -L/nix/store/iyf9g7w9r448wimavwwbdjw320wlrjc4-tiledb-2.3.3/lib64 -ltiledb -lIlmImf -lIlmImfUtil -lHalf -lIex -lpcre2-8 -lspatialite -lsqlite3 -lxerces-c -L/nix/store/fmbxbsil9y1dvgl0ph7llirdz7mx29f0-mariadb-connector-c-3.2.5/lib/mysql -lmysqlclient -lpq -lparquet -larrow -ldl -lexpat -lxml2 -lgeos_c -lproj -ljson-c -lstdc++ -lm
Cflags: ${CONFIG_INST_CFLAGS}

I would expect

CONFIG_INST_LIBS=-L/nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3/lib -lgdal
CONFIG_INST_CFLAGS=-I/nix/store/crsca8wbc9c0g3kmjcpc6b7pgxxygkz7-gdal-3.5.0.3/include

See also https://github.com/jtojnar/cmake-snips#assuming-cmake_install_dir-is-relative-path.
This was not an issue when using autotools with GDAL 3.4.

Steps to reproduce the problem.

Run nix-build -A gdal on NixOS/nixpkgs#179406.

Operating system

NixOS 22.11-pre

GDAL version and provenance

3.5.0.3 from GitHub tarball

@Artturin
Copy link

We also have a large pr fixing other packages so you can use that as a reference NixOS/nixpkgs#172150 when fixing this issue

@rouault rouault self-assigned this Jul 5, 2022
@rouault rouault closed this as completed in 2c19601 Jul 5, 2022
rouault added a commit that referenced this issue Jul 5, 2022
CMake: fix gdal.pc and gdal-config generation when CMAKE_INSTALL_xxxx is an absolute path (fixes #6004)
rouault added a commit that referenced this issue Jul 5, 2022
rouault added a commit that referenced this issue Jul 7, 2022
[Backport release/3.5] CMake: fix gdal.pc and gdal-config generation when CMAKE_INSTALL_xxxx is an absolute path (fixes #6004)
g8sqh pushed a commit to g8sqh/gdal that referenced this issue Aug 20, 2022
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

3 participants