From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Append effective version to GUILE_LOAD[_COMPILED]_PATH Date: Fri, 04 Mar 2016 14:13:13 +0100 Message-ID: <87oaaupes6.fsf@drakenvlieg.flower> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1457097230 9595 80.91.229.3 (4 Mar 2016 13:13:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2016 13:13:50 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Mar 04 14:13:42 2016 Return-path: Envelope-to: guile-devel@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 1abpY5-0008Ps-4B for guile-devel@m.gmane.org; Fri, 04 Mar 2016 14:13:41 +0100 Original-Received: from localhost ([::1]:41127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abpY1-0004mX-9M for guile-devel@m.gmane.org; Fri, 04 Mar 2016 08:13:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abpXx-0004m9-Vl for guile-devel@gnu.org; Fri, 04 Mar 2016 08:13:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abpXt-00077q-Pp for guile-devel@gnu.org; Fri, 04 Mar 2016 08:13:33 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57289) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abpXg-00076z-1e; Fri, 04 Mar 2016 08:13:16 -0500 Original-Received: from peder.onsbrabantnet.nl ([88.159.206.46]:44232 helo=drakenvlieg.flower.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1abpXf-0000gP-Ct; Fri, 04 Mar 2016 08:13:15 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:18202 Archived-At: --=-=-= Content-Type: text/plain Hi, I am running guile-2.0 and guile-2.2 alongside each other which is causing me some pain*). This is what bits of my GUILE_LOAD_COMPILED_PATH look like /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/lib/guile/2.2/ccache --> /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/lib/guile/2.2/ccache/ice-9/and-let-star.go /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site/2.2/ --> /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site/2.2/os/process.go If `/' is always used as the suffix of each path element, and we/guix/packagers do not include that suffix in GUILE_*PATH elements, then Guile can append effective-prefix and different major Guile-versions can happily share the same GUILE_LOAD[_COMPILED]_PATH, e.g., having GUILE_LOAD_COMPILED_PATH=/gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site then guile-2.0 would get (os process) from /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site + /2.0 --> /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site/2.0/os/process.go and guile-2.2 would read /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site + /2.2 --> /gnu/store/7ml4psifv46pzxjxw56xfl7mwd47k277-profile/share/guile/site/2.2/os/process.go What do you think? No more pain! Find patch attached. Greetings, Jan *) Some of my pain My Debian host system has guile-2.0, guix depends on guile-2.0, guix's LD script depends on guile-2.0, the guile bits of my project depend on guile-2.2. I have some scripts to make this situation almost bearable, but still I regularly cannot find a basic library [1]13:53:25 janneke@janneke-ijzer:~ $ guile --no-auto-compile GNU Guile 2.0.11 Copyright (C) 1995-2014 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (use-modules (os proccess)) While compiling expression: ERROR: no code for module (os proccess) or some guile script (guix) aborts guix environment --ad-hoc ccache coreutils git guix emacs guile-next guile-next-lib Throw without catch before boot: Throw to key misc-error with args ("make_objcode_from_file" "bad header on object file: ~s" ("\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00") #f)Aborting. Aborted or linking breaks g++ -Wall -std=c++11 -g -I. -I out/alarm.project/c++ -I check/alarm.project/ out/alarm.project/c++/main.o out/alarm.project/c++/Alarm.o out/alarm.project/c++/AlarmSystem.o out/alarm.project/c++/pump.o out/alarm.project/c++/runtime.o -lboost_system -lboost_coroutine -lboost_thread -lboost_context -pthread -o out/alarm.project/c++/test collect2: error: ld terminated with signal 6 [Afgebroken] Throw without catch before boot: Aborting. and then I juggle installed guile versions and/or manually modify GUILE_LOAD_COMPILED_PATH. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Append-effective-version-to-GUILE_LOAD-_COMPILED-_PA.patch >From 81c8b35752235aeb26058c0baadd0ea58046f640 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 3 Mar 2016 18:18:55 +0100 Subject: [PATCH] Append effective version to GUILE_LOAD[_COMPILED]_PATH elements. * libguile/load.c (scm_path_append_effective_version): New function (scm_init_load_path): Use it. * am/guilec (moddir,ccachedir): Use GUILE_EFFECTIVE_VERSION as prefix. --- am/guilec | 4 ++-- libguile/load.c | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/am/guilec b/am/guilec index 5ef07fa..fa2b5ba 100644 --- a/am/guilec +++ b/am/guilec @@ -3,9 +3,9 @@ GOBJECTS = $(SOURCES:%.scm=%.go) $(ELISP_SOURCES:%.el=%.go) GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat -moddir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)/$(modpath) +moddir = $(pkgdatadir)/$(modpath)/$(GUILE_EFFECTIVE_VERSION) nobase_mod_DATA = $(SOURCES) $(ELISP_SOURCES) $(NOCOMP_SOURCES) -ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache/$(modpath) +ccachedir = $(pkglibdir)/ccache/$(GUILE_EFFECTIVE_VERSION)/$(modpath) nobase_ccache_DATA = $(GOBJECTS) EXTRA_DIST = $(SOURCES) $(ELISP_SOURCES) $(NOCOMP_SOURCES) ETAGS_ARGS = $(SOURCES) $(ELISP_SOURCES) $(NOCOMP_SOURCES) diff --git a/libguile/load.c b/libguile/load.c index d26f9fc..055f3c4 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -1,5 +1,6 @@ /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2008, - * 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + * 2009, 2010, 2011, 2012, 2013, 2014, 2016 Free Software Foundation, + * Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -312,6 +313,28 @@ scm_i_mirror_backslashes (char *path) return path; } +/* Append effective_version to each element in PATH. This allows using + one single heterogeneous path for different effective versions of + Guile, i.e., running different versions of guile alongside each other + from one shell, without juggling GUILE_LOAD_COMPILED_PATH. */ +static SCM +scm_path_append_effective_version (SCM path) +{ + SCM vpath = SCM_EOL; + SCM version = scm_effective_version (); + SCM slash = scm_from_utf8_string ("/"); + for (path = scm_reverse (path); scm_is_pair (path); + path = SCM_CDR (path)) + { + SCM dir = SCM_CAR (path); + SCM vdir = scm_string_append (scm_list_3 (dir, slash, version)); + /* keep non-M.M suffixed dir as fallback for compatibility. */ + vpath = scm_cons (dir, vpath); + vpath = scm_cons (vdir, vpath); + } + return vpath; +} + /* Initialize the global variable %load-path, given the value of the SCM_SITE_DIR and SCM_LIBRARY_DIR preprocessor symbols and the GUILE_LOAD_PATH environment variable. */ @@ -393,7 +416,9 @@ scm_init_load_path () if (env) cpath = scm_parse_path_with_ellipsis (scm_from_locale_string (env), cpath); + path = scm_path_append_effective_version (path); *scm_loc_load_path = path; + cpath = scm_path_append_effective_version (cpath); *scm_loc_load_compiled_path = cpath; } -- 2.6.3 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20 --=-=-=--