Subject: Re: bug#26062: Spurious "environment variable may be needed" output

From: [email-masked] (Taylan Ulrich Bayırlı/Kammer)
Date: Fri, 17 Mar 2017 21:34:54 +0100

[email-masked] (Ludovic Courtès) writes:

> Hello Taylan,
>
> [email-masked] (Taylan Ulrich "Bayırlı/Kammer") skribis:
>
>> taylan@T420:~$ guix package -r nano
>> [... snip ...]
>> 75 packages in profile
>> The following environment variable definitions may be needed:
>>    export GUILE_LOAD_COMPILED_PATH="/home/taylan/.guix-profile/lib/guile/2.0/site-ccache:/home/taylan/.guix-profile/share/guile/site/2.0${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
>> taylan@T420:~$ echo $GUILE_LOAD_COMPILED_PATH
>> /home/taylan/.guix-profile/lib/guile/2.0/site-ccache:/home/taylan/.guix-profile/share/guile/site/2.0
>> taylan@T420:~$ 
>
> Weird, I don’t seem to have this problem.
>
> Could you add a few ‘pk’ in ‘search-path-environment-variables’ in (guix
> scripts package) to see what’s happening?

After some poking around, I found the issue; it's the following in the
guix-0.12.0 recipe:

    (wrap-program (string-append out "/bin/guix")
      `("GUILE_LOAD_PATH" ":" prefix (,path))
      `("GUILE_LOAD_COMPILED_PATH" ":" = (,path)))

As you see, it sets GUILE_LOAD_COMPILED_PATH to an absolute value rather
than prefixing it.  So whenever I execute 'guix package ...' from the
shell, the installed wrapper overrides my correct value of
GUILE_LOAD_COMPILED_PATH with something insufficient.

FWIW, it overrides it with the following (split for readability):

"/gnu/store/f4pw2jr2ial53awa34rjj3wb4b4k3nag-guile-json-0.6.0/share/guile/site/2.0:
/gnu/store/y9k9l62cf8hhr5m3np3756swrbxws0dl-guile-ssh-0.10.2/share/guile/site/2.0:
/gnu/store/iyvx2rpyndi3k7dzbl4jnv7k6ddkx88a-gnutls-3.5.8/share/guile/site/2.0"

Should the 'wrap-program' call simply use 'prefix' instead of '='?  I'm
not sure if there's a reason it uses '='.

Taylan