View Ticket
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 2f7cbd01c30ab9417bcff4053c88c169345add05
Title: tcl8.6.1 fails to build on FreeBSD 10.0
Type: Bug Version: 8.6.1
Submitter: anonymous Created on: 2014-03-07 03:04:33
Subsystem: 53. Configure and Build Tools Assigned To: jan.nijtmans
Priority: 8 Severity: Severe
Status: Closed Last Modified: 2014-06-03 07:54:45
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2014-06-03 07:54:45
Description:
On a FreeBSD 10.0 system, I attempted to build tcl8.6.1 in the usual way, in a subdirectory of tcl8.6.1/unix:

    ../configure
    make

This failed because the build created libtcl86.so.1, but then attempted to link with -ltcl86:

rm -f libtcl86.so.1
cc -shared -o libtcl86.so.1 regcomp.o regexec.o regfree.o regerror.o tclAlloc.o  tclAssembly.o tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o  tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o  tclCompCmds.o tclCompCmdsGR.o tclCompCmdsSZ.o tclCompExpr.o  tclCompile.o tclConfig.o tclDate.o tclDictObj.o  tclEncoding.o tclEnsemble.o  tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o  tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o tclIOCmd.o  tclIORChan.o tclIORTrans.o tclIOGT.o tclIOSock.o tclIOUtil.o  tclLink.o tclListObj.o  tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o  tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o  tclPkg.o tclPkgConfig.o tclPosixStr.o  tclPreserve.o tclProc.o tclRegexp.o  tclResolve.o tclResult.o tclScan.o tclStringObj.o  tclStrToD.o tclThread.o  tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o  tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o  tclTomMathInterface.o tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o  tclUnixFile.o tclUnixPipe.o tclUnixSock.o  tclUnixTime.o tclUnixInit.o tclUnixThrd.o  tclUnixCompat.o tclUnixNotfy.o   tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o  tclOOMethod.o tclOOStubInit.o tclLoadDl.o bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o  bn_fast_s_mp_sqr.o bn_mp_add.o bn_mp_and.o  bn_mp_add_d.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o  bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o  bn_mp_cnt_lsb.o bn_mp_copy.o  bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o  bn_mp_div_2d.o bn_mp_div_3.o  bn_mp_exch.o bn_mp_expt_d.o bn_mp_grow.o bn_mp_init.o  bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o  bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o  bn_mp_karatsuba_sqr.o  bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mul.o bn_mp_mul_2.o  bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.o  bn_mp_radix_size.o bn_mp_radix_smap.o  bn_mp_read_radix.o bn_mp_rshd.o bn_mp_set.o bn_mp_set_int.o  bn_mp_shrink.o  bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o  bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o  bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix_n.o  bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o  bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o -Wl,-soname=libtcl86.so.1 -lz -lpthread -lm  -Wl,-rpath,/usr/local/lib
cc -c -DNDEBUG -O2  -pipe -fvisibility=hidden -Wall -fPIC -DBUILD_tcl  -I"." -I/usr0/dws/tcltk/src/tcl8.6.1/unix -I/usr0/dws/tcltk/src/tcl8.6.1/generic -I/usr0/dws/tcltk/src/tcl8.6.1/libtommath  -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.6\" -DPACKAGE_STRING=\"tcl\ 8.6\" -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 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -DTCL_THREADS=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DHAVE_ZLIB=1 -DMODULE_SCOPE=extern -DHAVE_CAST_TO_UNION=1 -DTCL_SHLIB_EXT=\".so\" -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_MKSTEMP=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETNAMEINFO=1 -DHAVE_GETADDRINFO=1 -DHAVE_FREEADDRINFO=1 -DHAVE_GAI_STRERROR=1 -DHAVE_STRUCT_ADDRINFO=1 -DHAVE_STRUCT_IN6_ADDR=1 -DHAVE_STRUCT_SOCKADDR_IN6=1 -DHAVE_STRUCT_SOCKADDR_STORAGE=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_GETHOSTBYNAME_R_6=1 -DHAVE_GETHOSTBYNAME_R=1 -DHAVE_GETHOSTBYADDR_R_8=1 -DHAVE_GETHOSTBYADDR_R=1 -DHAVE_TERMIOS_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=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_CHFLAGS=1 -DHAVE_MKSTEMPS=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DTCL_UNLOAD_DLLS=1 -DHAVE_CPUID=1     /usr0/dws/tcltk/src/tcl8.6.1/unix/tclAppInit.c
cc -DNDEBUG -O2  -pipe -fvisibility=hidden  tclAppInit.o  -L/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10 -ltcl86 libtclstub86.a -lz -lpthread -lm   -Wl,-rpath,/usr/local/lib -o tclsh
/usr/bin/ld: cannot find -ltcl86


Based on what I saw in the base OS install, I strongly suspected that we could dispense with both the ".1" on the shared library suffix, and also with the whole TCL_TRIM_DOTS idiom altogether, so I tried this change:

: pa-bsd-6a; diff -u ../configure ../configure.freebsd
--- ../configure        2013-09-19 16:17:13.000000000 -0400
+++ ../configure.freebsd        2014-03-06 21:39:10.000000000 -0500
@@ -7829,10 +7829,10 @@
 fi

            # Version numbers are dot-stripped by system policy.
-           TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
-           UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
-           SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
-           TCL_LIB_VERSIONS_OK=nodots
+           # TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
+           # UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+           # SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
+           # TCL_LIB_VERSIONS_OK=nodots
            ;;
        Darwin-*)
            CFLAGS_OPTIMIZE="-Os"


With the above change in place, the build proceeds about 800 commands further, but fails to find a different library:

rm -f libtdbcmysql.so.1
cc -shared -o libtdbcmysql.so.1 tdbcmysql.o mysqlStubInit.o -L/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10/pkgs/tdbc1.0.0 -ltdbcstub100 -L/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10/pkgs/tdbc1.0.0 -ltdbcstub100 -L/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10 -ltclstub8.6
/usr/bin/ld: cannot find -ltdbcstub100

What the build has created in this case is libtdbcstub.a, but subsequent parts of the build are attempting to link with -ltdbcstub100.

There is evidence of this in pkgs/tdbc1.0.0/tdbcConfig.sh:

$ grep tdbcstub pkgs/tdbc1.0.0/tdbcConfig.sh
tdbc_STUB_LIB_FILE="libtdbcstub.a"
TDBC_STUB_LIB_FILE="libtdbcstub.a"
tdbc_BUILD_STUB_LIB_SPEC="-L/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10/pkgs/tdbc1.0.0 -ltdbcstub100"
TDBC_BUILD_STUB_LIB_SPEC="-L/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10/pkgs/tdbc1.0.0 -ltdbcstub100"
tdbc_STUB_LIB_SPEC="-L/usr/local/lib/tdbc1.0.0 -ltdbcstub100"
TDBC_STUB_LIB_SPEC="-L/usr/local/lib/tdbc1.0.0 -ltdbcstub100"
tdbc_BUILD_STUB_LIB_PATH="/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10/pkgs/tdbc1.0.0/libtdbcstub.a"
TDBC_BUILD_STUB_LIB_PATH="/usr0/dws/tcltk/src/tcl8.6.1/unix/x64_fbsd10/pkgs/tdbc1.0.0/libtdbcstub.a"
tdbc_STUB_LIB_PATH="/usr/local/lib/tdbc1.0.0/libtdbcstub.a"
TDBC_STUB_LIB_PATH="/usr/local/lib/tdbc1.0.0/libtdbcstub.a"

At this point I decided to give up and report the problem :)
User Comments: jan.nijtmans added on 2014-06-03 07:54:45:
tdbcmysql, tdbcpostgres and tdbcodbc are now updated with latest TEA modifications. So getting each of them from their own trunk should fix this.

Closing.

anonymous (claiming to be Gerhard Kraus (gkubu)) added on 2014-05-29 15:28:59:
after updating configure and tcl.m4 on FreeBSD 10, build still breaks with

rm -f libtdbcmysql.so.1
gcc -shared -o libtdbcmysql.so.1 tdbcmysql.o mysqlStubInit.o -L/usr/local/src/tcltk8.6.1/tcl8.6.1/unix/pkgs/tdbc1.0.0 -ltdbcstub100 -L/usr/local/src/tcltk8.6.1/tcl8.6.1/unix/pkgs/tdbc1.0.0 -ltdbcstub100 -L/usr/local/src/tcltk8.6.1/tcl8.6.1/unix -ltclstub8.6
/usr/bin/ld: cannot find -ltdbcstub100

Stop in 

pkgs/tdbcmysql1.0.0

jan.nijtmans added on 2014-04-01 08:54:13:

It looks like things work now as expected on FreeBSD 10, and any other currently supported version of FreeBSD. It might break earlier versions of FreeBSD (??). If someone finds that, please re-open this ticket (it's easy to change the expression here: http://core.tcl.tk/tcl/artifact/67cc05d5acf1179a?ln=1549).


dkf added on 2014-03-21 00:19:28:

Fixes have been committed; any confirmation that they're what was needed?


jan.nijtmans added on 2014-03-20 09:27:13:

Proposed fix: [e0b5b5cbd2] (for Tcl 8.5)


jan.nijtmans added on 2014-03-18 11:05:37:

Some changes submitted by Pietro Cerutti for FreeBSD are already applied to trunk. See:

http://sourceforge.net/p/tcl/mailman/message/31858097/ and http://core.tcl.tk/tcl/info/fc06c2939f8ef7e6

Does trunk still have this problem? If not, this ticket should be closed with "out-of-date".