Tcl Source Code

View Ticket
Login
Ticket UUID: 3148192
Title: [load] broken
Type: Bug Version: obsolete: 8.6b1.1
Submitter: dgp Created on: 2010-12-30 15:33:14
Subsystem: 53. Configuration and Build Tools Assigned To: nijtmans
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2011-01-05 15:32:17
Resolution: Fixed Closed By: nijtmans
    Closed on: 2010-12-31 16:39:51
Description:
Something happened to the HEAD in the last month:

$ cd tcl/unix
$ make distclean
$ ./configure --disable-shared
...
$ make test-tcl TESTFLAGS="-file load.test"
...
==== load-2.1 basic loading, with guess for package name FAILED
==== Contents of test case:

    load [file join $testDir pkga$ext]
    list [pkga_eq abc def] [lsort [info commands pkga_*]]

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: cannot find symbol "Pkga_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkga.so: undefined symbol: _Pkga_Init
    while executing
"load [file join $testDir pkga$ext]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $script"
---- errorCode: TCL LOOKUP LOAD_SYMBOL Pkga_Init
==== load-2.1 FAILED



==== load-2.2 loading into a safe interpreter, with package name conversion FAILED
==== Contents of test case:

    load [file join $testDir pkgb$ext] pKgB child
    list [child eval pkgb_sub 44 13] [catch {child eval pkgb_unsafe} msg] $msg  [catch {pkgb_sub 12 10} msg2] $msg2

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: cannot find symbol "Pkgb_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkgb.so: undefined symbol: _Pkgb_Init
    while executing
"load [file join $testDir pkgb$ext] pKgB child"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $script"
---- errorCode: TCL LOOKUP LOAD_SYMBOL Pkgb_Init
==== load-2.2 FAILED



==== load-2.4 loading with no _SafeInit procedure FAILED
==== Contents of test case:

    list [catch {load [file join $testDir pkga$ext] {} child} msg] $msg

---- Result was:
1 {cannot find symbol "Pkga_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkga.so: undefined symbol: _Pkga_Init}
---- Result should have been (exact matching):
1 {can't use package in a safe interpreter: no Pkga_SafeInit procedure}
==== load-2.4 FAILED



==== load-3.1 error in _Init procedure, same interpreter FAILED
==== Contents of test case:

    list [catch {load [file join $testDir pkge$ext] pkge} msg]  $msg $::errorInfo $::errorCode

---- Result was:
1 {cannot find symbol "Pkge_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkge.so: undefined symbol: _Pkge_Init} {cannot find symbol "Pkge_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkge.so: undefined symbol: _Pkge_Init
    while executing
"load [file join $testDir pkge$ext] pkge"} {TCL LOOKUP LOAD_SYMBOL Pkge_Init}
---- Result should have been (exact matching):
1 {couldn't open "non_existent": no such file or directory} {couldn't open "non_existent": no such file or directory
    while executing
"open non_existent"
    invoked from within
"if 44 {open non_existent}"
    invoked from within
"load [file join $testDir pkge$ext] pkge"} {POSIX ENOENT {no such file or directory}}
==== load-3.1 FAILED



==== load-3.2 error in _Init procedure, slave interpreter FAILED
==== Contents of test case:

    catch {interp delete x}
    interp create x
    set ::errorCode foo
    set ::errorInfo bar
    set result [list [catch {load [file join $testDir pkge$ext] pkge x} msg]  $msg $::errorInfo $::errorCode]
    interp delete x
    set result

---- Result was:
1 {cannot find symbol "Pkge_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkge.so: undefined symbol: _Pkge_Init} {cannot find symbol "Pkge_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkge.so: undefined symbol: _Pkge_Init
    while executing
"load [file join $testDir pkge$ext] pkge x"} {TCL LOOKUP LOAD_SYMBOL Pkge_Init}
---- Result should have been (exact matching):
1 {couldn't open "non_existent": no such file or directory} {couldn't open "non_existent": no such file or directory
    while executing
"open non_existent"
    invoked from within
"if 44 {open non_existent}"
    invoked from within
"load [file join $testDir pkge$ext] pkge x"} {POSIX ENOENT {no such file or directory}}
==== load-3.2 FAILED



==== load-4.1 reloading package into same interpreter FAILED
==== Contents of test case:

    list [catch {load [file join $testDir pkga$ext] pkga} msg] $msg

---- Result was:
1 {cannot find symbol "Pkga_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkga.so: undefined symbol: _Pkga_Init}
---- Result should have been (exact matching):
0 {}
==== load-4.1 FAILED



==== load-4.2 reloading package into same interpreter FAILED
==== Contents of test case:

    list [catch {load [file join $testDir pkga$ext] pkgb} msg] $msg

---- Result was:
1 {cannot find symbol "Pkgb_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkga.so: undefined symbol: _Pkgb_Init}
---- Result should have been (exact matching):
1 {file "/home/dgp/cvs/tcl-only/unix/dltest/pkga.so" is already loaded for package "Pkga"}
==== load-4.2 FAILED



==== load-5.1 file name not specified and no static package: pick default FAILED
==== Contents of test case:

    catch {interp delete x}
    interp create x
    load [file join $testDir pkga$ext] pkga
    load {} pkga x
    set result [info loaded x]
    interp delete x
    set result

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: cannot find symbol "Pkga_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkga.so: undefined symbol: _Pkga_Init
    while executing
"load [file join $testDir pkga$ext] pkga"
    ("uplevel" body line 4)
    invoked from within
"uplevel 1 $script"
---- errorCode: TCL LOOKUP LOAD_SYMBOL Pkga_Init
==== load-5.1 FAILED



==== load-7.4 Tcl_StaticPackage procedure, redundant calls FAILED
==== Contents of test case:

        teststaticpkg Double 0 1
        teststaticpkg Double 0 1
        info loaded

---- Result was:
{{} Double} {{} More} {{} Another} {{} Test} {{} Tcltest}
---- Result should have been (exact matching):
{{} Double} {{} More} {{} Another} {{} Test} {/home/dgp/cvs/tcl-only/unix/dltest/pkge.so Pkge} {/home/dgp/cvs/tcl-only/unix/dltest/pkgb.so Pkgb} {/home/dgp/cvs/tcl-only/unix/dltest/pkga.so Pkga} {{} Tcltest}
==== load-7.4 FAILED



==== load-8.1 TclGetLoadedPackages procedure FAILED
==== Contents of test case:

    info loaded

---- Result was:
{{} Double} {{} More} {{} Another} {{} Test} {{} Tcltest}
---- Result should have been (exact matching):
{{} Double} {{} More} {{} Another} {{} Test} {/home/dgp/cvs/tcl-only/unix/dltest/pkge.so Pkge} {/home/dgp/cvs/tcl-only/unix/dltest/pkgb.so Pkgb} {/home/dgp/cvs/tcl-only/unix/dltest/pkga.so Pkga} {{} Tcltest}
==== load-8.1 FAILED



==== load-8.3 TclGetLoadedPackages procedure FAILED
==== Contents of test case:

    list [info loaded {}] [info loaded child]

---- Result was:
{{{} Double} {{} More} {{} Another} {{} Test} {{} Tcltest}} {{{} Test}}
---- Result should have been (exact matching):
{{{} Double} {{} More} {{} Another} {{} Test} {/home/dgp/cvs/tcl-only/unix/dltest/pkga.so Pkga} {{} Tcltest}} {{{} Test} {/home/dgp/cvs/tcl-only/unix/dltest/pkgb.so Pkgb}}
==== load-8.3 FAILED



==== load-8.4 TclGetLoadedPackages procedure FAILED
==== Contents of test case:

    load [file join $testDir pkgb$ext] pkgb
    list [info loaded {}] [lsort [info commands pkgb_*]]

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: cannot find symbol "Pkgb_Init": /home/dgp/cvs/tcl-only/unix/dltest/pkgb.so: undefined symbol: _Pkgb_Init
    while executing
"load [file join $testDir pkgb$ext] pkgb"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $script"
---- errorCode: TCL LOOKUP LOAD_SYMBOL Pkgb_Init
==== load-8.4 FAILED



==== load-10.1 load from vfs FAILED
==== Contents of test case:
list [catch {load simplefs:/pkgd$ext pkgd} msg] $msg
---- Result was:
1 {cannot find symbol "Pkgd_Init": /tmp/tclO8NLQT: undefined symbol: _Pkgd_Init}
---- Result should have been (exact matching):
0 {}
==== load-10.1 FAILED
...



A full `make test` run reveals similar failing test
symptoms in pkgMkIndex.test and unload.test as well.
User Comments: nijtmans added on 2011-01-05 15:32:17:
> ... simplification of the macros ...
This 'simplifcation' was necessary for bug-fix #3135271.
It appears that GCC > 4.0 was not a good criterion to
decide whether -fvisibility=hidden is properly supported
or not. In Tcl 8.6, which the introduction of
-fvisibility=hidden, that shows horribly. TEA does
not have -fvisibility support yet (and I don't plan
to add that, as long as Tcl 8.6 is not mainstream).

The solution to undefine STATIC_BUILD is not
perfect. In fact, there is no reason to take over the
 -fvisibility=hidden flag, combination of both
is actually what caused the problem. I don't
know any extension - except tkImg ;-) - which
uses -fvisibility=hidden, it only might be
a problem with a GCC version which
does not know __attribute__ ((visibility..)),
But that means GCC < 3.3. See:
<http://www.ohse.de/uwe/articles/gcc-attributes.html#func-visibility>
And - even then - there is an easy workaround, -DNO_VIZ, which
is handled by the latest TEA exactly in that situation.

nijtmans added on 2011-01-05 15:08:02:
>_As I understand it_ ....

Yes, that understanding is correct. The problem is that the -DSTATIC_BUILD
is taken over by the pkg*.c makefile, just because they don't have their
own configure script. Maybe a better solution would be not to take over
CFLAGS from Tcl anyway, I don't think any of them are really needed.
Hmmm....

dkf added on 2011-01-04 23:34:27:
_As I understand it_, what changed is that there was some simplification of the macros that govern visibility of symbols. For most code, it will continue as before and have no problems, but the pkg*.c files are extensions that are compiled with Tcl's own makefile, which is a bit of an unusual combination. (It's not an issue for the contributed packages because they use their own build systems; they have a different CFLAGS...)

dgp added on 2011-01-04 23:17:45:
Hmmm... The "fix" was to make changes to the
pkg*.c files.  This means that something changed
in Tcl so that now something has to be changed in
source code of extensions to make them work again
with Tcl 8.6 ?  That doesn't sound like a good thing to
me.  What am I not getting?

I fear that any existing extensions out there that were
produced by copying the patterns of pkg*.c are going
to be broken when used with Tcl 8.6.  Please assure
me that's not the case.

nijtmans added on 2010-12-31 23:39:51:

allow_comments - 1

nijtmans added on 2010-12-31 23:39:50:
The problem was that unix/dltest shares it's configure script with
unix, which defines STATIC_BUILD in this case. But those packages
should never built statically at all, even though Tcl is built statically.
This STATIC_BUILD was causing the troubles here.

Fixed in HEAD, it indeed was a problem in the test case, not
with the load command.

nijtmans added on 2010-12-31 15:54:15:
I'll have a look. My first guess is that the test dll's are built using BUILD_tcl, which would indicate a problem with the test case, not really with Tcl.

kennykb added on 2010-12-30 23:52:14:

File Added - 397214: 3135271.undo

kennykb added on 2010-12-30 23:50:52:
Problem was introduced by Jan Nijtmans's build system changes dated 2010-12-13 addressing Bug 3135271. The attached patch reverts the offending change

Attachments: