bug-guix
[Top][All Lists]
Advanced

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

bug#72669: gcc-toolchain environment variables


From: Thomas Schwinge
Subject: bug#72669: gcc-toolchain environment variables
Date: Thu, 07 Nov 2024 10:20:40 +0100
User-agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.4 (x86_64-pc-linux-gnu)

Indeed this is a problem, when attempting to build GCC in a Guix profile
with 'gcc-toolchain' installed.  What you may do is create wrapper
binaries so that the Guix GCC's 'etc/profile' is only active if using the
Guix GCC (that is, when building your cross-GCC's compilers), but isn't
active (and therefore 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
'LIBRARY_PATH' etc. not defined) when your cross-GCC builds its target
libraries.  This means, you have to invoke the Guix GCC from outside of
the Guix profile.  Something like this:

    $ guix install -p "$GUIX_GCC" gcc-toolchain

..., and then script something like:

    rm -rf "$GUIX_GCC"_bin
    mkdir "$GUIX_GCC"_bin
    for f in "$GUIX_GCC"/bin/* "$GUIX_GCC"/sbin/*; do
      f_=$(basename "$f")
      case "$f" in
        */c++ \
        | */g++ \
        | */gcc \
        | */*-c++ \
        | */*-g++ \
        | */*-gcc )
          cat > "$GUIX_GCC"_bin/"$f_" <<EOF
    #!/bin/sh
    
    set -e
    
    d=\$(dirname "\$0")
    
    . "\$d"/../$GUIX_GCC/etc/profile
    
    "\$d"/../$f "\$@"
    EOF   
          chmod +x "$GUIX_GCC"_bin/"$f_"
          ;;
        *)
          ln -s ../"$f" "$GUIX_GCC"_bin/"$f_"
          ;;
      esac
    done

..., and instead of '"$GUIX_GCC"/bin/gcc' etc. then use
'"$GUIX_GCC"_bin/gcc' etc.


In my opinion, the Guix-profile-wide setting of these environment
variables (via Guix GCC's 'etc/profile') doesn't feel quite right -- but
I'm still new to Guix, so...





reply via email to

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