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

no libdl nor librt on OpenBSD #5390

Open
ajacoutot opened this issue May 12, 2019 · 4 comments
Open

no libdl nor librt on OpenBSD #5390

ajacoutot opened this issue May 12, 2019 · 4 comments

Comments

@ajacoutot
Copy link
Contributor

Hi.

The unit tests use a few of -ldl and -lrt:

test_compiler_args_class_gnuld
test_pkgconfig_parse_libs
test_compiler_args_class
fake_call_pkgbin
test_compiler_libs_static_dedup

These libraries don't exist and aren't needed on (at least) OpenBSD.
I am not sure what the best course of action is to fix the tests. Choose libraries that we know are part of all Unix-like systems or make an exception for BSDs?

For example, in test_compiler_libs_static_dedup I could change this line:

for lib in ('-ldl', '-lm', '-lc', '-lrt'):

so that it includes only existing libraries but before doing an exception, I'd rather have your input.

Thank you :-)

@jpakkane
Copy link
Member

AFAIK the only platform still using -lm et al is Linux and even there the GNU people are working on getting rid of them. Maybe those should only be tested on Linux?

I thought about checking whether the actual files exist but then realized that every OS and distro puts them in a different directory so reliably checking for that would be a nightmare. :(

@ajacoutot
Copy link
Contributor Author

Hi @jpakkane . Thanks for the fast feedback :-)
I don't think Linux is the only platform using -lm, we do it as well.
I agree that checking whether the file exists isn't really doable.
I am open to whatever you gals think is the best, I've bee walking over the meson regress test suite to make sure OpenBSD is 100% (or so) compliant. There's a couple of things I'd like to push at some point but first I want the rest suite to finish ;-)

@jscott0
Copy link
Contributor

jscott0 commented Jun 7, 2022

POSIX states that these libraries (-lm, -ldl, -lxnet, etc.) need not actually exist on the system, but that these compiler options must be supported and expose the pertinent functionality. It would seem that Meson should be smart with these special cases, and handle these dependencies specially by passing the appropriate command-line argument, as opposed to performing an actual search of the library.

If this doesn't work on OpenBSD, that is an OpenBSD bug.

@eli-schwartz
Copy link
Member

-ldl specifically is not defined by POSIX, though c, l, pthread, m, rt, trace, xnet, and y are.

Meson will try to pass the -l option for these arglist.UNIXY_COMPILER_INTERNAL_LIBS, but I do not remember offhand if Meson detects them as present when using cc.find_library() and they are not actually files on disk.

Either way, for general portability reasons it turns out that actually passing the appropriate command-line argument doesn't work for non-POSIX systems, such as Windows. :( The general recommendation is to use find_library('m', required: false) anyway.

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

4 participants