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

1.4.0 Installs pkgconfig and cmake files into wrong locations #161

Closed
yurivict opened this issue Jan 4, 2022 · 13 comments
Closed

1.4.0 Installs pkgconfig and cmake files into wrong locations #161

yurivict opened this issue Jan 4, 2022 · 13 comments

Comments

@yurivict
Copy link

yurivict commented Jan 4, 2022

Before they were installed into:
``
lib/cmake/nanoflann/nanoflannConfig.cmake
lib/cmake/nanoflann/nanoflannConfigVersion.cmake
lib/cmake/nanoflann/nanoflannTargets.cmake
libdata/pkgconfig/nanoflann.pc


Now they are installed into:

share/cmake/nanoflann/nanoflannConfig.cmake
share/cmake/nanoflann/nanoflannConfigVersion.cmake
share/cmake/nanoflann/nanoflannTargets.cmake
share/pkgconfig/nanoflann.pc


pkg-config doesn't find nanoflann. cmake files that are installed by nanoflann into share/cmake are the only application specifix cmake files there, so this appears to be a wrong location too.
@jlblancoc
Copy link
Owner

You're right, it seems e.g. from https://packages.ubuntu.com/jammy/all/libeigen3-dev/filelist
That the order of subdirectories should be swapped.

I'll provide a fix and release again, or feel free to propose a PR !

@jlblancoc
Copy link
Owner

For the records: I changed it from lib to share since that's the more appropriate path for a headers only lib

@yurivict
Copy link
Author

yurivict commented Jan 5, 2022

Yes, please release again. Thanks!

@jlblancoc
Copy link
Owner

v1.4.1 has been verified to correctly provide working cmake and pkgconfig files. There are now two examples with the two build systems under examples/*.

@yurivict
Copy link
Author

yurivict commented Jan 6, 2022

1.4.1 installs .pc file into share/pkgconfig/nanoflann.pc where pkg-config isn't looking.

$ ls /usr/local/share/pkgconfig/
nanoflann.pc
$ pkg-config --cflags nanoflann
Package nanoflann was not found in the pkg-config search path.
Perhaps you should add the directory containing `nanoflann.pc'
to the PKG_CONFIG_PATH environment variable
Package 'nanoflann', required by 'virtual:world', not found

.pc files should be in libdata/pkgconfig/.

@jlblancoc
Copy link
Owner

Mmm... in which distribution is that?
I tested it (on an Ubuntu 20.04), and:

$ sudo make install
...
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/share/nanoflann/cmake/nanoflannTargets.cmake
-- Up-to-date: /usr/local/share/pkgconfig/nanoflann.pc
-- Up-to-date: /usr/local/share/nanoflann/cmake/nanoflannConfig.cmake
-- Up-to-date: /usr/local/share/nanoflann/cmake/nanoflannConfigVersion.cmake
-- Up-to-date: /usr/local/include/nanoflann.hpp

$ pkg-config nanoflann --cflags
-I/usr/local/include

Just to make sure it's that .pc file the one pkg-config saw:

$ sudo make uninstall
-- Uninstalling "/usr/local/share/nanoflann/cmake/nanoflannTargets.cmake"
-- Uninstalling "/usr/local/share/pkgconfig/nanoflann.pc"
-- Uninstalling "/usr/local/share/nanoflann/cmake/nanoflannConfig.cmake"
-- Uninstalling "/usr/local/share/nanoflann/cmake/nanoflannConfigVersion.cmake"
-- Uninstalling "/usr/local/include/nanoflann.hpp"

$ pkg-config nanoflann --cflags
Package nanoflann was not found in the pkg-config search path.
No package 'nanoflann' found

??

@jlblancoc jlblancoc reopened this Jan 7, 2022
@jlblancoc
Copy link
Owner

Stupid question... FreeBSD :-)

Could you check where does the well-known library eigen3 install its .pc file in that distribution?

In Debian-based ones, architecture-independent files go into share, arch-dependent into lib, that's why it makes more sense to install this headers-only library on the former...

@yurivict
Copy link
Author

yurivict commented Jan 7, 2022

FreeBSD 13, but I don't think this matters.

share/pkgconfig/ is not where .pc files are installed.
Why did you move it from libdata/pkgconfig/?

@yurivict
Copy link
Author

yurivict commented Jan 7, 2022

Eigen installs it here: /usr/local/libdata/pkgconfig/eigen3.pc

jlblancoc added a commit that referenced this issue Jan 7, 2022
@jlblancoc
Copy link
Owner

Ah, I think I see the issue (I still would compare to eigen3, which is a "reference" headers-only library used by many):

So, I think that with:

  • this commit a12946e ,
  • adding CMAKE_ARGS= -DPKGCONFIG_INSTALL_DIR:PATH="libdata/pkgconfig" to math/nanoflann/Makefile
  • Perhaps adding %%DATADIR%% to PLIST_FILES ??

will work for FreeBSD, w/o breaking existing policies in other distros...
Do you agree?

@yurivict
Copy link
Author

yurivict commented Jan 7, 2022

Why don't you just bring back the previous .pc location libdata/pkgconfig/ ?

@jlblancoc
Copy link
Owner

jlblancoc commented Jan 7, 2022

It's weird: according to pkgconfig docs,

1.1. Search paths
By default, pkg-config will search for modules installing data files in two directories: one for the architecture-specific modules,
that is installed in a sub-directory of the libdir (usually /usr/lib/pkgconfig), and one for non-architecture specific modules, that
can be shared among multiple architectures (usually /usr/share/pkgconfig).

the /usr/share/pkgconfig should work too and would be preferred for non-architecture specific...

But if it causes problems in that distribution, I could roll back it for the .pc file; I think cmake being "smarter" and more up-to-date shouldn't have any problems to locate its own stuff under /usr/share/nanoflann/cmake/*.cmake

@jlblancoc
Copy link
Owner

Closed (again XD) by fa97cab

Will release again soon, after some further time for testing.

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

2 participants