guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use GUIX installed packages / libraries in Guile


From: Zelphir Kaltstahl
Subject: Re: Use GUIX installed packages / libraries in Guile
Date: Mon, 14 Jan 2019 00:52:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Hello,

On 1/12/19 7:58 PM, daniel szmulewicz wrote:
> > >     A while ago I installed Guix, initially only to be able to install
> > >     GNUTLS, to be able to make HTTPS requests with the standard
> library's
> > >     web client procedures http-get and similar.
>
> I did the same last week, and for the same reason. It worked out of
> the box. Other people have given you good recommendations, I just
> wanted to chime in in order to confirm that what you tried to do makes
> sense. I'd just make sure to install guile with guix first.
>
> guix package -i guile
> guix package -i gnutls
>
> Daniel

Thank you Daniel!

I did install Guile by building it manually, so I dared an experiment
following your advice and installed it in Guix, simply hoping for the
best: "everything to simply work magically" :D

When installing Guile using Guix, it then printed some recommendation of
what to put in my ~/.profile. This is probably what swedebugia meant,
only that I did not get it at first, because I did not install Guile via
Guix and cannot remember having installed any Guix packages with
environment variable hints after installation being shown before
installing Guix.

Then I fumbled around with my ~/.bashrc and ~/.profile, and in the end
everything was in ~/.profile. Here is the result, in case anyone needs it:

~~~ my ~/.profile:

# ============
# GUIX & GUILE
# ============

# GUIX profile
# (1. Why is this needed? 2. What is it needed for?)
export GUIX_PROFILE="$HOME/.guix-profile"
source "$GUIX_PROFILE/etc/profile"

# Set the locales path, so that Guix can find the locales.
export GUIX_LOCPATH="$GUIX_PROFILE/lib/locale"

# Add directory of Guix to path, so that we can use Guix.
export PATH="${GUIX_PROFILE}/bin${PATH:+:}$PATH"¬

# Guile load path
# The load path points to where Guix installs packages.
export 
GUILE_LOAD_PATH="${HOME}/.guix-profile/share/guile/site/2.2${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"

# The load compiled path points to where compiled libraries, installed by Guix, 
are.
export 
GUILE_LOAD_COMPILED_PATH="${HOME}/.guix-profile/lib/guile/2.2/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"

# This might be required by guile-colorized, according to post-installation 
information displayed by Guix.
export 
TERMINFO_DIRS="${HOME}/.guix-profile/share/terminfo${TERMINFO_DIRS:+:}$TERMINFO_DIRS"

# ======
# LOCALE
# ======
# change locale to US English
export LC_ALL="en_US.UTF-8"

~~~

This, followed by a:

source ~/.profile

Did the trick!

Then I installed readline (maybe unnecessary, only did it because I
forgot to type guile- in front of it), guile-readline and, because my
guile would complain about not finding any code for colorized,
guile-colorized and voilá, my Guile works just like before. However, the
most important question was, whether it would pick up GNUTLS, which is
also installed via Guix … So I went into my example code directory and
tried running that code:

~~~ requests with https example code:

(use-modules (web client)
             #;(ice-9 receive))

(call-with-values
    (lambda ()
      (http-get "https://duckduckgo.com";
                #:port (open-socket-for-uri "https://duckduckgo.com";)
                #:version '(1 . 1)
                #:keep-alive? #f
                #:headers '()
                #:decode-body? #t
                #:streaming? #f))
  (lambda (response response-text)
    (display response)
    (display response-text)))

~~~

And that worked as well! This is great! Now I can use GNUTLS it seems!

If this had not worked I would have written on the Guix list as was
suggested. Initially I was not sure which list would be best, Guile or
Guix and decided to go for the Guile list, as I already wrote there
before and had good experience. After this problem being solved, it is
also clear to me, that it would have been better on the Guix help list.
Sorry for that!

I want to relate to what Catonano wrote as well, as I read their mail:

> […] So I built Gnutls myself. […]

This is what someone else also mentioned here on the Guile user list
before, but which I wanted to avoid, because I don't want to keep
security relevant libraries up to date manually.

> […] there are a couple of threads I opened on the Gnutls-help mailing
list […]

Not sure I was aware of there being a mailing list specifically for
Gnutls, good to know!

> […] You have to put a file in /etc/ld.so.conf.d containing the path to
your custom lib directory […]

When I read that, I felt uncomfortable, because I would add something
somewhere, that I do not understand currently how it works. Maybe this
would have worked too, but I am quite happy that everything works
currently afaik, so I would rather not risk anything to try.

Thanks everyone for your help and advice!

Regards,

Zelphir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]