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

Debbugs page

Anonymous wrote 7 years ago
(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.
Ludovic Courtès wrote 7 years ago
(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’.
Hogenson, Raymond E (334H-Affiliate) wrote 7 years ago
(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.
Simon Tournier wrote 1 years ago
(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
?
Your comment

This issue is archived.

To comment on this conversation send an email to 32131@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 32131
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help