Setup configure's test if library is available can spuriously fail in certain circumstances
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
To test if a library libfoo is installed, we try building a simple program with `gcc test.c -lfoo`. Ordinarily this will work even if foo depends on other libraries, because gcc will either (a) fail because foo doesn't exist, or (b) succeed, because foo exist, and ld is too lazy to actually try linking foo if none of the symbols are used.
However, if you pass `-Wl,-no-as-needed`, then gcc will eagerly link the library, and now you are in trouble, because this will fail unless you also pass all the other libraries you need. That's not right.
We should check autogoo to see what a robust way of testing if a library exists is.
I repro'd this from #4541, but #4541 is asking for something different (it is a meta-issue asking us to stop trying to be so clever here.)
CC @suzumiyasmith
Contributor guide
Assessment
This issue has not been assessed yet.