Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Oct 95 09:58 PDT
From:      jdp@polstra.com (John Polstra)
To:        imp@village.org
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Problem with ptk-b8 .. ld problems already fixed?
Message-ID:  <m0t7QDC-000078C@seattle.polstra.com>

next in thread | raw e-mail | index | archive | help
> I'm trying to get pTk-p8 up and running on my FreeBSD 2.0 and got the
> following error.  Look familiar to anybody?
> 
> ld.so: Undefined symbol "__XInitImageFuncPtrs" in perl:./blib/auto/Tk/Tk.so
> 
> Tk.so looks to be referencing X11, but can't seem to find this in libX11,
> even though it is in my copy (per nm output).

I think the problem you're seeing is caused by a combination of an old
version of ld.so, and an improperly-built tk library.  First I should
confess that while I know a lot about ld.so, I don't know anything about
pTk-p8.  So I'm flying half blind here.  But it looks like
"./blib/auto/Tk/Tk.so" is a shared object which perl is trying to load at
runtime via dlopen(), and that's the assumption I'll use.  Please
correct me if I'm wrong about that.

First, the problem in ld.so.  The version in 2.0.5 did not do so-called
"cascade loading" properly.  As an example, if Tk.so needs -ltk, and
-ltk needs -lX11, ld.so should load -ltk and -lX11 automatically when
it is called upon by dlopen() to load Tk.so.  But it did not quite do
that right in 2.0.5.

The situation is improved in the version of ld.so that is in
-current at the present time.  It's still not 100% right, but it's
usable anyway.  It's definitely worth getting the latest version.

(Actually, I think you must already have a more recent version.  I'm
pretty sure that the version of ld.so that came with 2.0.5 would have
simply said "ld.so failed" rather than telling you about the undefined
symbol.)

Second, the problem in the "tk" library.  How could ld.so possibly know
that when it loads Tk.so that it will also need to load the other
libraries such as -ltk and -lX11?  The answer is that such "shared
object dependencies" are recorded in the shared objects themselves.  For
example, when you build the "tk" library, you should do it something
like this:

    ld -Bshareable  ... -ltcl -lX11

The dependencies on the "tcl" and "X11" libraries are then recorded in
the "tk" library itself, so that ld.so will know it has to load those
other libraries too.

The current "tk" library that is distributed with the FreeBSD packages
wasn't built that way, and that's a problem.  (I apologize for failing
to bring this up with Satoshi Asami, our friendly ports czar.  It's not
his fault!)

Actually, there's a third problem as well.  The static linker "ld" has a
bug, in that it doesn't detect some undefined symbols when building a shared
library.  Really, it should not be possible to even build the "tk"
shared library without specifying the libraries it depends on in the
"ld" command line.  "ld" should complain about undefined symbols in that
case.  But it doesn't.

I'm working on all these things, so please be patient.

Meanwhile, I think you can work around your present problem by:

    * Installing an up-to-date version of "ld.so", and

    * Specifying "-ltk -ltcl -lX11" on the "ld" command line that you
      use to build "Tk.so".

Please let me know if that doesn't work.

   John Polstra                                       jdp@polstra.com
   Polstra & Co., Inc.                        Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0t7QDC-000078C>