OS/2, eCS & ArcaOS - Technical > Programming
gcc - building libarchive
Andi B.:
I try to build *nix library libarchive and get the following error about unresolved '_pthread_mutex_unlock'.
--- Code: ---....
CC libarchive/archive_write_set_passphrase.lo
CC libarchive/filter_fork_posix.lo
CC libarchive/xxhash.lo
CCLD libarchive.la
./libtool: 2643: ./libtool: func__fatal_error: not found
weakld: error: Unresolved symbol (UNDEF) '_pthread_mutex_unlock'.
weakld: info: The symbol is referenced by:
P:\dev\ports\libarchive-3.3.3\libarchive\.libs\archive_random.o
weakld: error: Unresolved symbol (UNDEF) '_pthread_mutex_lock'.
weakld: info: The symbol is referenced by:
P:\dev\ports\libarchive-3.3.3\libarchive\.libs\archive_random.o
Ignoring unresolved externals reported from weak prelinker.
Error! E2028: _pthread_mutex_lock is an undefined reference
Error! E2028: _pthread_mutex_unlock is an undefined reference
file P:\dev\ports\libarchive-3.3.3\libarchive\.libs\archive_random.o(archive_random.o): undefined symbol _pthread_mutex_lock
file P:\dev\ports\libarchive-3.3.3\libarchive\.libs\archive_random.o(archive_random.o): undefined symbol _pthread_mutex_unlock
make.exe[1]: *** [libarchive.la] Error 1
make.exe[1]: Leaving directory `P:/dev/ports/libarchive-3.3.3'
make.exe: *** [all] Error 2
--- End code ---
"P:\usr\lib\pthread.a" includes these functions. Seems this file isn't linked.
Any ideas?
Dave Yeo:
Look in the configure.in script to see how pthreads is linked in. Just went through that with a different program that Lewis was building, in that case needed to add an OS/2 section with a special pthreads link line (-lpthread) and removing the -pthreads line.
BTW, doing make V=1 (or set V=1 first) will give a more informative output.
jailbird:
It should be possible to edit the gcc specs file so that -pthreads automatically enables -lpthreads. That way you don't have to hack every app separately.
Dave Yeo:
--- Quote from: jailbird on February 04, 2022, 09:52:09 pm ---It should be possible to edit the gcc specs file so that -pthreads automatically enables -lpthreads. That way you don't have to hack every app separately.
--- End quote ---
Yeh, most of the time it just works currently but there's like 4 ways to invoke pthreads and the maintainers haven't fixed the specs. IIRC, -pthread works and -pthreads doesn't. Sometimes just adding libs=-lpthread or LDFLAGS=-lpthread is all that is needed and most of the time not even that. Having an OS/2 section in some configure scripts is also a good place to add other flags such as -Zomf
Dave Yeo:
Built for me with make LDFLAGS=-lpthread V=1 haven't looked at configure closely though it looks like it just checks for pthread.h without actually linking it.
Navigation
[0] Message Index
[#] Next page
Go to full version