#2126: Tcl-8.4.17/Tcl-8.5.0
------------------------------------------+---------------------------------
Reporter: [EMAIL PROTECTED] | Owner: [email protected]
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0
Component: Book | Version: SVN
Severity: normal | Resolution:
Keywords: |
------------------------------------------+---------------------------------
Comment (by Bryan Kadzban):
Yep, that's a classic missing-library type problem ("undefined reference"
errors from the linker). According to nm, those symbols are defined in
<tcl prefix>/lib/libtcl8.5.so, and my current system (which was built
using Tcl 8.4) has the same /tools/lib/libtcl8.4.so file with the same
symbols in it. Of course, the command you posted *does* link against
-ltcl8.5, so this *should* all be working fine...
Oh, hang on, there is one difference between 8.4 and 8.5 that I see:
Running nm on the 8.5 library shows these two symbols with a "t" before
them (i.e. they're in the text (code) section), but running it on the 8.4
library shows these symbols with a "T" before them (which also means in
the text section). According to the nm manpage, uppercase means the
symbol is "global (external)", and lowercase means it's "local"; I assume
that "local" means other code can't link to it, and if that's true, that
explains the problem with Expect.
Now, as for why Tcl made those symbols "local", and how that flag gets
set: I'm pretty sure it's some gcc attribute or other, but I'm not sure
which one. Looking at the CVS history for generic/tclInt.h, it looks like
Tcl_CloseObjCmd has been declared MODULE_SCOPE since about August 2004
(before that it was EXTERN), so the usage of MODULE_SCOPE itself isn't
new. And MODULE_SCOPE is defined in generic/tclInt.h to be "extern" if
it's not already defined, and "extern" would not cause the symbol to be
local. So I'm guessing that macro is already defined somewhere else in
8.5...
Searching through the rest of the Tcl files for MODULE_SCOPE shows usages
all over the place, but only a few definitions; the relevant one is in
unix/tcl.m4:
{{{
AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
AC_DEFINE(MODULE_SCOPE,
[extern __attribute__((__visibility__("hidden")))],
[Compiler support for module scope symbols])
])
}}}
which sets it to use the {{{__visibility__}}} attribute if that
$tcl_cv_cc_... variable is set. That variable gets set earlier, via the
autoconf cache and a simple link-test program, so if we need to, we can
override this definition by adding:
{{{
echo tcl_cv_cc_visibility_hidden=no >config.cache
}}}
before running configure. (We may also need to add a --cache-
file=config.cache or similar to the configure command line.)
This is all new code as of
[http://tcl.cvs.sourceforge.net/tcl/tcl/unix/tcl.m4?r1=1.179&r2=1.180&pathrev=MAIN
revision 1.180]. Before that, only Mac machines would have MODULE_SCOPE
defined to anything at all (which means that generic/tclInt.h would set it
to just plain "extern" on Linux). Apparently nobody uses Expect on Macs?
Hmm...
Anyway, there are probably a couple of options here too. First would be
to override the check for the hidden-visibility support (make configure
think it's not supported, so it doesn't use it), but that's *really* not
what the Tcl people intend. Plus I'm not sure whether anything else in
the Tcl package will use that value -- nothing does right now, but that
doesn't rule it out in the future either. (Besides, Expect really only
needs those two functions.)
Second would be to remove the MODULE_SCOPE from the declaration of those
two functions, and replace it with EXTERN (before compiling Tcl). This
would also not be what I expect the Tcl people intend, but it would be a
lot more minimal of a change than neutering all the MODULE_SCOPE
declarations.
Third would be to see if there's a way to patch Expect so that it doesn't
need these symbols -- that would probably be what the Tcl team would
recommend, but I don't know if it's possible or not. Let me do some more
digging in Expect...
--
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2126#comment:7>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page