mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.52k stars 1.6k forks source link

[suggestion] Add the "prefix" directory to the list of locations where find_library() looks for libraries by default #7746

Open yurivict opened 4 years ago

yurivict commented 4 years ago

On FreeBSD meson's find_library() doesn't find libraries in /usr/local/lib.

It seems to only search in the /usr/lib directory. On FreeBSD all package-installed libraries are in /usr/local/lib, or in ${prefix}/lib to be precise.

I suggest that Meson should add the ${prefix}/lib directory to the list of directories where it searches for libraries by default. When meson is called it is passed prefix through the --prefix {prefix-dir} argument.

Implementing this would match expectations of developers: when they use find_library() they mean to search in all common locations, not just in the base system.

Specific motivation: find_library() in the Zrythm project fails to find libraries installed by the fft3 package: https://github.com/zrythm/zrythm/blob/master/meson.build#L602

Thank you, Yuri

bitfehler commented 2 years ago

I also had the problem of a library not being found automatically on FreeBSD and looked a little closer at this. From what I understand, the problem is that /usr/local/lib is not in the compiler's search path by default (see e.g. cc --print-search-dirs). Apparently, this has long been a subject of discussion (see e.g. here). But apparently that's still the way it is, so the question is whether or not it makes sense to work around this in meson.

@yurivict I'd be curious what you mean by "When meson is called it is passed prefix through the --prefix {prefix-dir} argument." At what point does parameter get added? When meson is called from where?

Also, since your profile says FreeBSD committer, maybe the above discussion could be brought back to life? :slightly_smiling_face:

rgommers commented 10 months ago

This looks like a duplicate of gh-4468.