[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
c-strtod, c-strtof, c-strtold: Fix link error on AIX
From: |
Bruno Haible |
Subject: |
c-strtod, c-strtof, c-strtold: Fix link error on AIX |
Date: |
Sun, 02 Jun 2024 22:40:43 +0200 |
On AIX 7.1, in a testdir of all of gnulib, I see these link errors, both
with gcc and xlc:
gcc -Wno-error -g -O2 -L/home/haible/prefix32/lib -o test-c-strtod
test-c-strtod.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a
libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm
ld: 0711-224 WARNING: Duplicate symbol: .rpl_duplocale
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_wait
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_signal
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_broadcast
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_settype
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_once
collect2: error: ld returned 8 exit status
gmake[4]: *** [Makefile:18224: test-c-strtod] Error 1
gcc -Wno-error -g -O2 -L/home/haible/prefix32/lib -o test-c-strtof
test-c-strtof.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a
libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm
ld: 0711-224 WARNING: Duplicate symbol: .rpl_duplocale
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_wait
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_signal
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_broadcast
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_settype
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_once
collect2: error: ld returned 8 exit status
gmake[4]: *** [Makefile:18236: test-c-strtof] Error 1
gcc -Wno-error -g -O2 -L/home/haible/prefix32/lib -o test-c-strtold
test-c-strtold.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a
libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm
ld: 0711-224 WARNING: Duplicate symbol: .rpl_duplocale
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_wait
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_signal
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_broadcast
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_settype
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_destroy
ld: 0711-317 ERROR: Undefined symbol: .pthread_once
collect2: error: ld returned 8 exit status
gmake[4]: *** [Makefile:18248: test-c-strtold] Error 1
The cause is that
- c-strtod.o needs rpl_newlocale, which pulls in localename-unsafe.o.
- localename-unsafe.o needs glthread_rwlock_*_multithreaded, which pulls in
lock.o, as well as pthread_mutex_lock, pthread_mutex_unlock (directly).
This patch fixes the link errors.
2024-06-02 Bruno Haible <bruno@clisp.org>
c-strtod, c-strtof, c-strtold: Fix link error on AIX.
* lib/c-strtod.c (newlocale): Undefine before use.
diff --git a/lib/c-strtod.c b/lib/c-strtod.c
index 4089ccd79b..ae74a5bd4d 100644
--- a/lib/c-strtod.c
+++ b/lib/c-strtod.c
@@ -47,6 +47,9 @@
# define STRTOD strtod
#endif
+/* Here we don't need the newlocale override that supports gl_locale_name().
*/
+#undef newlocale
+
#if defined LC_ALL_MASK && (HAVE_GOOD_STRTOD_L || HAVE_WORKING_USELOCALE)
/* Cache for the C locale object.
- c-strtod, c-strtof, c-strtold: Fix link error on AIX,
Bruno Haible <=