Tcl Source Code

View Ticket
Login
Ticket UUID: 3598282
Title: unix: make install fails when DESTDIR is used
Type: Bug Version: current: 8.6.0
Submitter: roflz Created on: 2012-12-24 05:06:06
Subsystem: 53. Configuration and Build Tools Assigned To: stwo
Priority: 8 Severity:
Status: Closed Last Modified: 2013-01-31 20:59:20
Resolution: Fixed Closed By: stwo
    Closed on: 2013-01-31 13:59:20
Description:
while doing make install, ./tclsh gets invoked. however that assumes that the dynamic linker knows the location of libtcl8.6.so

if no previous installation of tcl is available on the host, and DESTDIR is used, this shared object cannot be found, the tclsh binary not started and subsequently the build breaks.
(the dynlinker searches in /lib or /usr/lib, but when DESTDIR is e.g. /opt/tcl, it won't find any shared objects there)

thus, LD_LIBRARY_PATH must be used when invoking the tclsh binary.

as a temporary workaround:
export LD_LIBRARY_PATH=.
make install DESTDIR=xxx

makes the build succeed.
User Comments: stwo added on 2013-01-31 20:59:20:

allow_comments - 1

Fixed in [70995bd619] (trunk) and [0f098031c3] (core-8-5-branch).
There are no longer any users of installData.tcl in unix/Makefile.in.

ferrieux added on 2013-01-27 16:53:55:
Looks perfectly okay to me. Maybe move it out to a separate script file instead of makefile-inlining, for readability. But that's personal taste ;)

stwo added on 2013-01-27 15:00:27:
I'd like to wrap this up in a few days.
Soliciting suggestions for better scripting; it's not my forte.

roflz added on 2012-12-30 12:54:55:
thanks, this looks very well (apart from mixed spaces/tabs which mess up the indentation)

stwo added on 2012-12-30 11:51:02:
I've attached code to do the install sans tclsh.
It's not pretty but it does the job.
Improvements welcome :)

stwo added on 2012-12-30 11:47:08:

File Added - 458531: install-tzdata

dkf added on 2012-12-29 22:07:26:
For information: 'make html' isn't intended to *ever* be run as part of a sequence leading up to 'make install'; it's closer to the 'make dist' side of things (and is used to build the content of the HTML documentation archive that we distribute and the HTML docs we put up on www.tcl.tk). This should be clear from the fact that it's writing to a hardcoded location in /tmp/dist :-)

Can't comment on the tzdata stuff; that's not my code at all.

stwo added on 2012-12-28 19:39:48:
Also, we probably could've arrived at the answer quicker if you'd have shown some lines from the install process where it was failing.

stwo added on 2012-12-28 19:36:24:
The problem is that the install-tzdata target is the last remaining user of installData.tcl.
I remember discussing this some time ago.
One solution is a slightly ugly couple of loops.
I guess I never went ahead with it because of the ugliness and that I don't normally need/use the install-tzdata target. ;)

roflz added on 2012-12-28 18:17:37:
stwo: exactly.
relying on the generated binary to do anything during build / installation is not good, as it will prevent from cross compilation and needs tricks like LD_LIBRARY_PATH to work at all.

whatever tclsh does at this install step should be achieved by other portable means, or postponed to first-usage time.

stwo added on 2012-12-28 18:08:57:
Install shouldn't need or use *any* tclsh.
Something's trying to build html docs maybe.

roflz added on 2012-12-28 15:16:05:
DESTDIR != prefix

DESTDIR is a way for packagers to install stuff into a different location than where it will be used finally, so it doesn't clutter their build machine, and so that the can see which files are getting installed.

in my specific case, my distribution uses prefix=/ and DESTDIR=/opt/packagename for any package that gets built.
then a filelist of /opt/packagename is created, and all files in /opt/packagename get symlinked into / (prefix).
this way, installing a binary package is as easy as untarring it into /opt (or some alternative location), and then call a script which creates the filelist and symlinks it into place.
if i would use prefix for this, internal dependencies in the generated libraries and binaries would point to /opt/packagename instead of the intended prefix.

packages using autoconf (approx 95-98% of all packages on debian) automatically provide the distinct prefix and DESTDIR functionality, which makes them very easy to handle for packagers.

a proper Makefile which adheres to these widely accepted and used standard just install its files into $(DESTDIR)$(prefix) (note that there are no slashes)

so the combination prefix="" (empty) and DESTDIR=/opt/tcl would install tclsh into /opt/tcl/bin
and the line in the makefile would look like:
install -D -m 755 tclsh $(DESTDIR)$(prefix)/bin/

dkf added on 2012-12-28 05:31:20:
Why are you setting DESTDIR in the first place? Why not just use the --exec-prefix option to configure?

dgp added on 2012-12-28 02:40:16:
Looks like something broken in the use of
NATIVE_TCLSH

Attachments: