ghc fails to compile packages when installed into profile

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Anonymous
  • Simon Tournier
Owner
unassigned
Submitted by
Anonymous
Severity
normal
A
A
Anonymous wrote on 12 Jul 2018 07:12
(address . bug-guix@gnu.org)
48f7e837-be75-66b2-8535-636f40c62327@cock.li
This bug can be reproduced by doing

    guix package -i ghc
    echo 'main=return()' > test.hs
    ghc test.hs

The expected output is that the program will be compiled, but instead we
get the error message

    gcc: error trying to exec 'as': execvp: No such file or directory
    `gcc' failed in phase `C Compiler'. (Exit code: 1)

The error is caused, of course, by as not being found in the path.
Interestingly, though, the error occurs in gcc, which fails to find as.
The general path for compiling things with gcc is to use gcc-toolchain,
which brings as and others into the profile, but as ghc calls gcc
directly (with no gcc-toolchain), ghc fails to actually compile anything.
L
L
Ludovic Courtès wrote on 12 Jul 2018 17:58
(name . Anonymous)(address . mcrfan96@cock.li)(address . 32131@debbugs.gnu.org)
87sh4otphc.fsf@gnu.org
Hello,

Anonymous <mcrfan96@cock.li> skribis:

Toggle quote (19 lines)
> This bug can be reproduced by doing
>
>     guix package -i ghc
>     echo 'main=return()' > test.hs
>     ghc test.hs
>
> The expected output is that the program will be compiled, but instead
> we get the error message
>
>     gcc: error trying to exec 'as': execvp: No such file or directory
>     `gcc' failed in phase `C Compiler'. (Exit code: 1)
>
> The error is caused, of course, by as not being found in the
> path. Interestingly, though, the error occurs in gcc, which fails to
> find as. The general path for compiling things with gcc is to use
> gcc-toolchain, which brings as and others into the profile, but as ghc
> calls gcc directly (with no gcc-toolchain), ghc fails to actually
> compile anything.

Indeed. Does running:

guix package -i glibc binutils ld-wrapper

help?

Regardless I agree that it should just work.

Thanks for reporting the issue,
Ludo’.
H
H
Hogenson, Raymond E (334H-Affiliate) wrote on 12 Jul 2018 18:20
(name . Ludovic Court=C3=A8s)(address . ludo@gnu.org)(address . 32131@debbugs.gnu.org)
15059048-31A2-41B0-B38D-7AE947C23DA6@cock.li
On 7/12/18, 8:59 AM, "Ludovic Court=C3=A8s" <ludo@gnu.org> wrote:
Toggle quote (12 lines)
> Hello,
>
> Anonymous <mcrfan96@cock.li> skribis:
>
> [...]
>
> Indeed. Does running:
>
> guix package -i glibc binutils ld-wrapper
>
> help?

Actually, it does not. Doing that, I get the error

ld: cannot find crt1.o: No such file or directory
ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

However, if I also set

LIBRARY_PATH=<path to glibc>/lib

then compilation proceeds just fine. It seems like just bringing glibc
into the profile does not correctly set LIBRARY_PATH.
S
S
Simon Tournier wrote on 22 Sep 2023 18:13
(name . Anonymous)(address . mcrfan96@cock.li)(address . 32131-done@debbugs.gnu.org)
878r8y89ua.fsf@gmail.com
Hi,

This old bug #32131,


is not a bug. It is because gcc-toolchain is missing.

On Wed, 11 Jul 2018 at 22:12, Anonymous <mcrfan96@cock.li> wrote:
Toggle quote (9 lines)
> This bug can be reproduced by doing
>
>     guix package -i ghc
>     echo 'main=return()' > test.hs
>     ghc test.hs
>
> The expected output is that the program will be compiled, but instead we get
> the error message

Toggle snippet (9 lines)
$ echo 'main=return()' > test.hs

$ guix shell -C ghc gcc-toolchain -- ghc test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...

$ ./test

Closing. Let me know if I am missing something.

Cheers,
simon
Closed
?