Undefined symbol "call_once"
djireland opened this issue · comments
Running in FreeBSD 13.1 it crashes when trying to exit with Undefined symbol "call_once"
For example:
link-grammar: Error: Could not open dictionary "C.UTF/4.0.dict"
link-grammar: Info: Dictionary found at ./data/en/4.0.dict
link-grammar: Info: Dictionary version 5.11.0, locale en_US.UTF-8
link-grammar: Info: Library version link-grammar-5.11.0. Enter "!help" for help.
linkparser> Hello World
ld-elf.so.1: /root/link-grammar-5.11.0/link-grammar/.libs/liblink-grammar.so.5: Undefined symbol "call_once"
The call_once
function is a part of C11
https://en.cppreference.com/w/c/thread/call_once
There are two possibilities: Either FreeBSD does not implement it (unlikely) or the -lpthreads
library should have been linked, but wasn't. Possibly it has a different name in FreeBSD, e.g. pthread (without the s) or just thread
(without the p). Of course, configure.ac
should have taken care of this, but ...
Can you confirm by hacking which case this is? To find a symbol, in a library, it would be nm libpthreads.a
(or .so, as the case may be) and see if call_once
appears with a capital T in front of it. If you can find it, then configure is broken....
The ugly details of what gets linked can be seen by saying VERBOSE=1 make
which will spew the actual compiler/linker flags.
Not a bother. As you follow up with the freebsd devs, the thing to track down is why configure
didn't automatically find it. It should be in the AX_PTHREAD
macro or maybe the AX_TLS
macro from the autoconf-archive
package.
@djireland -- any progress w/ why configure didn't automatically find -lstdthreads
?
I plan to issue a new release of LG "any day now" and would like to include any needed fixes in that.
I'm not sure how long it takes for them to get to it.
I strongly urge you to close this bug, and open a brand-new one with both the title of the bug, and the description of it rewritten. And also with the correct component. As written, it will never be fixed: people will look at it, think "its a link-grammar bug" and then ignore it or close it.
I'm certain this is a bug in the FreeBSD handling AX_PTHREAD
macro in the autotools/automake/autoconf package. It should have detected and automatically included -lstdthreads
.
So you want to open a bug report against autotools & friends, and say explicitly that "hey AX_PTHREAD
did not do the right thing" and then point at this bug for proof.
OK, so here's what I did: I just now pushed this fix: 8d864c6
It looks for FreeBSD, and if it finds it, it will then automatically tack on -lstdthreads
to the link line. It would be great if you can test it:
cd /where/ever/link-grammar
git pull
./autogen.sh --no-configure
mkdir build; cd build
../configure
make -j
sudo make install
make -j check
The above should work fine. The resulting link-grammar binary should work.
Let me know if it all works, now
OK, Thanks!