Tk Source Code

View Ticket
Login
Ticket UUID: 1334613
Title: -lX11 link order is wrong
Type: Bug Version: obsolete: 8.5a4
Submitter: georgeps Created on: 2005-10-22 01:19:10
Subsystem: 84. Unix Build Assigned To: jenglish
Priority: 6 Severity:
Status: Closed Last Modified: 2006-03-08 14:10:08
Resolution: Fixed Closed By: jenglish
    Closed on: 2006-03-08 07:10:08
Description:
NetBSD builds of libtk fail to work properly in tclsh
with [package require Tk].  This also makes it more
difficult to build a tclkit.  -lX11 is used only when
building wish.  The proper way to build is to link
*libtk* with -lX11, so that the runtime linker will be
able to load all dependencies in the tclkit or tclsh
cases of [package require Tk]
User Comments: jenglish added on 2006-03-08 14:10:08:
Logged In: YES 
user_id=68433

Looks like this was recently fixed on core-8-4-branch
(1.96.2.36, patthoyts 2006/03/02).  Also fixed now on CVS
HEAD (tcl/unix/tcl.m4, tk/unix/tcl.m4) and in TEA
(tclconfig/tcl.m4 r1.90).

georgeps added on 2006-03-02 14:16:34:
Logged In: YES 
user_id=585068

This lists a few NetBSD ports that don't support ELF, and
probably the Inter-Library dependencies that Joe wrote about:
http://www.netbsd.org/developers/features/

Most of those ports are to older systems though, so I think
we can probably safely just assume SHLIB_LD_LIBS='${LIBS}'
is correct. The pkgsrc people patch things if needed.  They
already hack Tcl to use libtool, so it may not even affect them.

patthoyts added on 2006-03-02 07:54:03:
Logged In: YES 
user_id=202636

I have been building tclkit on netbsd and find that for
NetBSD 2.0 and 3.0 if we set SHLIB_LD_LIBS='${LIBS}' then
this problem is solved. This is also necessary for OpenBSD
and probably all BSD type systems. We also need to have
-rpath set (via LD_SEARCH_FLAGS). This is already set for
the NetBSD branch so it is only necessary to update
SHLIB_LD_LIBS.

jenglish added on 2005-12-22 10:45:10:
Logged In: YES 
user_id=68433

nobody added on 2005-12-22 06:15:26:
Logged In: NO 

Thank you for looking into this.  That does seem to be the
problem.  

Incidentally the pkgsrc version of Tcl/Tk uses libtool.  It
also has the same package require Tk problem, and it seems
they didn't patch Tk.

jenglish added on 2005-12-21 13:27:25:
Logged In: YES 
user_id=68433

Turns out Tk's configure script already accounts for this
platform difference -- it sets SHLIB_LD_LIBS to ${LIBS} if
shared libraries should be linked against dependent shared
libraries, "" otherwise.  Looks like the NetBSD case in
SC_CONFIG_CFLAGS sets it incorrectly to "" (or, rather, sets
it to what *was* correct for NetBSD a long time ago.)

jenglish added on 2005-12-21 13:15:46:
Logged In: YES 
user_id=68433

This depends on the platform.  I suspect linking libtk
against -lX11 is the right thing on most current ELF-based
Unixes, but on some systems (SunOS?  AIX for sure) shared
libraries can't be linked against other shared libraries.

The section "Inter-library dependencies" in the libtool
manual discusses this a bit.