| Ticket UUID: | 3522894 | ||
| Title: | Solaris build fails: TclBN_mp_init_set_int not found | ||
| Type: | Bug | Created on: | 2012-05-02 02:29:33 |
| Submitter: | markatc | Assigned to: | dgp |
| Subsystem: | 53. Configuration and Build Tools | Severity: | |
| Priority: | 5 Medium | Last modified: | 2026-10-21 09:06:36 |
| Status: | Closed | Closed by: | dgp |
| Resolution: | Fixed | Closed on: | 2012-05-03 21:03:37 |
| Version: | obsolete: 8.5.11 | ||
| Description: | ||||
This occurs on Solaris 10 + 11 x86 and SPARC, using the Sun Studio 12.x compilers.
[...]
cc -c -O -I/usr/local/include -L/usr/local/lib -KPIC -I"." -I/var/tmp/tcl8.5.11/unix/../unix -I/var/tmp/tcl8.5.11/unix/../generic -I/var/tmp/tcl8.5.11/unix/../libtommath -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.5\" -DPACKAGE_STRING=\"tcl\ 8.5\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -D_REENTRANT=1 -D_POSIX_PTHREAD_SEMANTICS=1 -DTCL_SHLIB_EXT=\".so\" -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_DIRENT64=1 -DHAVE_STRUCT_STAT64=1 -DHAVE_OPEN64=1 -DHAVE_LSEEK64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETADDRINFO=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_BLKCNT_T=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DNO_UNION_WAIT=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DTCL_UNLOAD_DLLS=1 /var/tmp/tcl8.5.11/unix/../unix/tclAppInit.c
cc -O -I/usr/local/include -L/usr/local/lib -I/usr/local/include -L/usr/local/lib tclAppInit.o -L/var/tmp/tcl8.5.11/unix -ltcl8.5 -ldl -lsocket -lnsl -lsunmath -lm \
-Wl,-R,/tcl/lib -o tclsh
host:/var/tmp/tcl8.5.11/unix root# gmake install
Making directory /tcl/lib
Making directory /tcl/bin
Installing libtcl8.5.so to /tcl/lib/
Installing tclsh as /tcl/bin/tclsh8.5
Installing tclConfig.sh to /tcl/lib/
Installing libtclstub8.5.a to /tcl/lib/
Installing message catalogs
ld.so.1: tclsh: fatal: relocation error: file /var/tmp/tcl8.5.11/unix/libtcl8.5.so: symbol TclBN_mp_init_set_int: referenced symbol not found
gmake: *** [install-msgs] Killed
# nm libtcl8.5.so
[...]
[2646] | 1124908| 172|FUNC |GLOB |0 |9 |TclBN_mp_grow
[2287] | 1125104| 104|FUNC |GLOB |0 |9 |TclBN_mp_init
[2428] | 1125208| 52|FUNC |GLOB |0 |9 |TclBN_mp_init_copy
[1683] | 1125260| 204|FUNC |GLOB |0 |9 |TclBN_mp_init_multi
[2324] | 1125464| 48|FUNC |GLOB |0 |9 |TclBN_mp_init_set
[1516] | 0| 0|FUNC |GLOB |0 |UNDEF |TclBN_mp_init_set_int
[1807] | 1125580| 156|FUNC |GLOB |0 |9 |TclBN_mp_init_size
[2640] | 1125736| 2720|FUNC |GLOB |0 |9 |TclBN_mp_karatsuba_mul
[2083] | 1128456| 1688|FUNC |GLOB |0 |9 |TclBN_mp_karatsuba_sqr
[2735] | 1130168| 892|FUNC |GLOB |0 |9 |TclBN_mp_lshd
[2170] | 1131060| 144|FUNC |GLOB |0 |9 |TclBN_mp_mod
[...]
host:/var/tmp/tcl8.5.11 root# find . -print | xargs grep TclBN_mp_init_set_int
./generic/tclTomMathDecls.h:#define mp_init_set_int TclBN_mp_init_set_int
./generic/tclTomMathDecls.h:#ifndef TclBN_mp_init_set_int_TCL_DECLARED
./generic/tclTomMathDecls.h:#define TclBN_mp_init_set_int_TCL_DECLARED
./generic/tclTomMathDecls.h:EXTERN int TclBN_mp_init_set_int(mp_int*a, unsigned long i);
./generic/tclTomMathDecls.h:#ifndef TclBN_mp_init_set_int
./generic/tclTomMathDecls.h:#define TclBN_mp_init_set_int \
./generic/tclStubInit.c: TclBN_mp_init_set_int, /* 61 */
./generic/tclTomMath.decls: int TclBN_mp_init_set_int(mp_int* a, unsigned long i)
| ||||
| User Comments: | ||||
dgp added on 2012-05-03 00:32:47:
Precisely what are you building? Where did it come from? dgp added on 2012-05-04 03:45:07:
I see this is a build as root? Do you have the same troubles building as a non-superuser? dgp added on 2012-05-04 04:03:37:
Can't reproduce on a Solaris 10 sparc system with Forte Developer 7 C 5.4 and a regular user account. If you've got more details that can tell us what can help, attach them. markatc added on 2012-05-04 07:48:57:
This is the recipe:
cd /var/tmp
rm -rf /tcl tcl8.5.11
untgz /usr/local/src/tcl/tcl8.5.11-src.tar.gz
mkdir /tcl
cd tcl8.5.11/unix/
./configure \
--prefix=/tcl \
--enable-shared \
--enable-dtrace
gmake
gmake test
gmake install
The tclsh problem doesn't occur when compiling as a non-root user. It compiles and installs as expected. What's in the build that makes a difference to that?
markatc added on 2012-05-04 07:54:05:
# cc -V cc: Sun C 5.11 SunOS_i386 145355-01 2010/10/11 # uname -a SunOS x86host 5.10 Generic_142901-13 i86pc i386 i86pc # cc -V cc: Sun C 5.11 SunOS_sparc 145354-01 2010/10/11 # uname -a SunOS host 5.10 Generic_142909-17 sun4v sparc SUNW,T5240 # env LANG=en_US.UTF-8 LC_COLLATE=C USER=root GROUP=root HOST=host JAVA_HOME=/usr/java LD_RUN_PATH=/usr/local/lib:/lib:/usr/lib CC=cc CXX=CC LDFLAGS=-I/usr/local/include -L/usr/local/lib CPPFLAGS=-I/usr/local/include -L/usr/local/lib stwo added on 2012-05-06 11:02:51:
Please attach a full build log. pooryorick added on 2012-06-14 06:34:16:
I got this same error when compiling tcl-8.5.11 on a Linux host. After making sure that CPPFLAGS included ...tcl8.5.11/generic prior to other directories that contained older versions of tclTomMath.h, the problem went away. stwo added on 2012-06-16 03:08:25:
Looks like the presence of CPPFLAGS and LDFLAGS in your environment is causing the build to use different (installed) includes and libs. Should these flags be placed after Tcl's in compiler/linker invocations? pooryorick added on 2012-06-18 23:34:21:
I think the sane approach might be to have key directories like ...tcl8.5.11/generic (where ... probably represents some variable guaranteed to resolve to the build-time source directory) unequivocally appear before CPPFLAGS. in the Makefiles. Nearly always, when a user is specifying CPPFLAGS, they intend to supplement the distribution header files, not override them. The user who actually wants to override distribution header files will probably have the skills to find a way to do that. dkf added on 2012-06-19 19:32:23:
If it works when building as non-root, do that. Only installation to a shared directory requires elevated privileges. dkf added on 2012-06-19 19:40:51:
Also, Tcl's configure merges the CPPFLAGS into the definition of CFLAGS for you (as long as you don't override directly; check the generated Makefile and try unsetting before the make step) and the Makefile only uses LDFLAGS when linking. dkf added on 2012-06-19 20:40:42:
Umm, by "unsetting" I mean "unsetting it in your environment variables"; remember, they _override_ the makefile if present. serhiy.storchaka added on 2026-10-21 09:06:36:
The cause was the user's CPPFLAGS (-I/usr/local/include with older installed Tcl headers) coming before Tcl's own include directories. Since [8619c767c0] (8.6.12, and in 9.0) Tcl's own -I directories come first. Checked on Linux with a directory of decoy tcl.h/tclInt.h/tclPort.h passed in CPPFLAGS: 8.6.11 picks them up and fails, 8.6.12, core-8-6-branch and main build fine. Closing as fixed. | ||||
