FS#42053 - [llvm] Error linking sparse-llvm: undefined references to pthread functions

Attached to Project: Arch Linux
Opened by Alain Kalker (ackalker) - Sunday, 21 September 2014, 17:22 GMT
Last edited by Evangelos Foutras (foutrelis) - Sunday, 21 September 2014, 18:53 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When building smatch-git from the AUR[1], and also when building sparse sparse from clean git master[2], I'm getting link errors involving undefined references to pthread functions.
As
I'm reporting this against llvm because smatch/sparse get their compile and link configuration from llvm-config, and don't add any pthread-related configuration of their own.

From some Googling, I found an upstream bug[3] that might be related, but I haven't fully investigated this, so it's a very long shot.

[1]: https://aur.archlinux.org/packages/smatch-git
[2]: git://git.kernel.org/pub/scm/devel/sparse/sparse.git
[3]: Bug 20287 – libc++abi dependency on pthread when -fuse-ld=gold used : http://llvm.org/bugs/show_bug.cgi?id=20287

Additional info:
* package version(s)
llvm 3.5.0-2.1
* config and/or log files etc.
build.log: Output of `make V=1` for [2], showing the link errors

Steps to reproduce:
   build.log (17.6 KiB)
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Sunday, 21 September 2014, 18:53 GMT
Reason for closing:  Not a bug
Comment by Alain Kalker (ackalker) - Sunday, 21 September 2014, 17:55 GMT
Resolved via [1]: `llvm-config --libs` -> `llvm-config --libs --system-libs` fixed the problem.
I don't know how recent this "--system-libs" option is, but I honestly would not expect the developers of sparse to have simply 'forgotten' about it.

[1]: c++ - Why am I getting "undefined reference to `dladdr'" even with -ldl for this simple program? - Stack Overflow : http://stackoverflow.com/questions/12993460/why-am-i-getting-undefined-reference-to-dladdr-even-with-ldl-for-this-simpl
Comment by Alain Kalker (ackalker) - Sunday, 21 September 2014, 18:00 GMT
The option "--system-libs" appears to be undocumented in llvm-config(1), but it is listed in `llvm-config --help`.
Comment by Evangelos Foutras (foutrelis) - Sunday, 21 September 2014, 18:06 GMT
This is not a bug but the result of a change in LLVM 3.5:

http://reviews.llvm.org/rL197664
Comment by Alain Kalker (ackalker) - Sunday, 21 September 2014, 18:31 GMT
Thanks for the quick reply :)
I guess this bug can be closed then, I will report to sparse-dev mailing list instead.
Sorry for wasting your time :)

Loading...