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

Use string(JOIN) to avoid semicolons in pc file. #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikepurvis
Copy link

@mikepurvis mikepurvis commented Jul 9, 2021

An issue was encountered (NixOS/nixpkgs#129491) when updating the Nix package for FLANN, where a list-separating semicolon was making it into the pkgconfig file:

Name: flann
Description: Fast Library for Approximate Nearest Neighbors
Version: 1.9.1
Requires:
Libs: -L${libdir} -L/nix/store/3nf85zf44vyvwr32hx53v7swljxysyjm-lz4-1.9.3/lib;-llz4 -lflann -lflann_cpp
Cflags: -I${includedir}

This semicolon breaks the flag parsing logic in the linker and needs to be filtered out, either with a string replacement or by doing a string(JOIN) as in this PR, for which CMake 3.12 is required. Note that 3.12 was released in July 2018, so this change would break a user building master from source on Ubuntu 18.04, but is fine on 20.04 or anything newer than that.

This should go in after #369; that change is being patched into Debian, Nix, Homebrew, buildroot, and probably elsewhere.

FYI @jspricke

nh2 added a commit to nh2/flann that referenced this pull request Sep 26, 2023
lz4 is an unconditional dependency of flann (see flann-lib#399),
but until now was not correctly generated into the
`Requires: lz4` line of `flann.pc`,
because the `PKG_EXTERNAL_DEPS` variable used in `flann.pc.in`
was not defined at all.

This fixes build error `lz4.h: No such file or directory`
for properly sandboxed builds, in which undeclared dependencies
are not made available.

Same thing for HDF5, but conditionally.

For lz4, also remove the hardcode of `@LZ4_STATIC_LDFLAGS@`
from `flann.pc.in`, as this is no longer necessary.
That fixes an incorrect `-L` flag being generated in there, e.g.
`-L/usr/lib;-llz4`. Thus fixes flann-lib#480.
nh2 added a commit to nh2/flann that referenced this pull request Sep 27, 2023
lz4 is an unconditional dependency of flann (see flann-lib#399),
but until now was not correctly generated into the
`Requires: lz4` line of `flann.pc`,
because the `PKG_EXTERNAL_DEPS` variable used in `flann.pc.in`
was not defined at all.

This fixes build error `lz4.h: No such file or directory`
for properly sandboxed builds, in which undeclared dependencies
are not made available.

Same thing for HDF5, but conditionally.

For lz4, also remove the hardcode of `@LZ4_STATIC_LDFLAGS@`
from `flann.pc.in`, as this is no longer necessary.
That fixes an incorrect `-L` flag being generated in there, e.g.
`-L/usr/lib;-llz4`. Thus fixes flann-lib#480.
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

Successfully merging this pull request may close these issues.

None yet

1 participant