From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.user Subject: Re: guile-2.0 on mingw: the sequel Date: Sun, 25 Aug 2013 15:56:53 -0400 Message-ID: <87zjs58ry2.fsf@tines.lan> References: <83vc2wj4hz.fsf@gnu.org> <877gfccueo.fsf@tines.lan> <83d2p4ifow.fsf@gnu.org> <874nada6t1.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1377460646 26157 80.91.229.3 (25 Aug 2013 19:57:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Aug 2013 19:57:26 +0000 (UTC) Cc: guile-user@gnu.org To: Eli Zaretskii Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Aug 25 21:57:27 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VDgRD-0004aW-IE for guile-user@m.gmane.org; Sun, 25 Aug 2013 21:57:27 +0200 Original-Received: from localhost ([::1]:47467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDgRD-0006iL-74 for guile-user@m.gmane.org; Sun, 25 Aug 2013 15:57:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDgQz-0006hK-PP for guile-user@gnu.org; Sun, 25 Aug 2013 15:57:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDgQu-0007Vm-FM for guile-user@gnu.org; Sun, 25 Aug 2013 15:57:13 -0400 Original-Received: from world.peace.net ([96.39.62.75]:40272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDgQu-0007VS-BM; Sun, 25 Aug 2013 15:57:08 -0400 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VDgQn-0007p8-C3; Sun, 25 Aug 2013 15:57:01 -0400 In-Reply-To: <874nada6t1.fsf@tines.lan> (Mark H. Weaver's message of "Sun, 25 Aug 2013 15:50:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10701 Archived-At: Mark H Weaver writes: > Eli Zaretskii writes: > >>> From: Mark H Weaver >>> Cc: Eli Zaretskii , "guile-user\@gnu.org" >>> Date: Fri, 23 Aug 2013 11:13:19 -0400 >>> >>> Of course, ideally we would allow the entire Guile install to be freely >>> relocatable, as Windows users have come to expect. This would require >>> some help from a Windows developer. >> >> Why should this feature be limited to Windows builds of Guile? Why >> not make it work for Posix platforms as well? Some other projects >> already do, they use argv[0] and PATH search to find the place where >> the executable is installed, and record relative file names from >> there. > > Well, that's not generally how things are done on POSIX systems, and > furthermore I don't see how this could be made to work reliably on > POSIX. The location of the Guile executable is sometimes not found in > either argv[0] or PATH. For example, if you run the following script: > > #!/usr/local/bin/guile -s > !# > > (format #t "~s~%" (program-arguments)) > > argv[0] will point to the script, not the Guile executable. I suppose > we could detect if argv[0] points to a script and read the shebang (and > iterate, if the shebang points to another script), but even that doesn't > cover all cases. It's possible to pass any arbitrary value for argv[0] > using the 'exec' family of system calls. I forgot to mention a much more common case that would cause problems. Remember that Guile is a library, not just an executable. So argv[0] could point to any arbitrary executable that's linked with libguile. There are many different mechanisms available to do the linking, including static linking, LD_LIBRARY_PATH, rpaths, etc. Trying to portably figure out which copy of libguile was used, and where it is located, is a can of worms, to put it mildly. Having said that, we should probably come up with a solution for relocatable builds on MacOS X as well. Regards, Mark