From: Sergiu Ivanov <sivanov@colimite.fr>
To: Emmanuel Medernach <Emmanuel.Medernach@iphc.cnrs.fr>
Cc: help-guix@gnu.org
Subject: Re: Error using gcc with trivial-build-system
Date: Tue, 08 Nov 2022 11:45:37 +0100 [thread overview]
Message-ID: <87o7thd8lt.fsf@colimite.fr> (raw)
In-Reply-To: <ef3b235a-acbb-b51e-8bef-d695bd1331b4@iphc.cnrs.fr>
Hi,
I have little experience with Guix packages, but I ran into a similar
issue using guix shell --pure recently, and I believe that you need to
add glibc to your dependencies.
I suppose that guix shell works for you because you already have glibc
available in the active profile. I'd expect guix shell --pure to fail
with the same error.
-
HTH,
Sergiu
Emmanuel Medernach <Emmanuel.Medernach@iphc.cnrs.fr> [2022-11-08T11:23:16+0100]:
> Hello Guix,
>
> I have a local package with a compile script that
> I need to add to our local GUIX packages.
>
> I tried to use trivial-build-system with
> gcc-toolchain input, all works well when I compile
> it manually in a 'guix shell' but when I try to
> define a package I ran into this 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
>
> I cannot produce correct binaries with
> gcc-toolchain, here is a minimal package
> definition with the above problem. Could you
> please tell me how to solve this problem ?
>
> (define-public SimpleTest
> (package
> (name "SimpleTest")
> (version "0.0.0")
> (source
> (origin
> (method url-fetch)
> (uri ".../simpletest.tgz")
> (sha256
> (base32 "0nx8dgs5n4s1alp8lnp7a96czdll8bb7ljbg152yk7m0mr07728d"))))
> (inputs `(("gcc-toolchain" ,gcc-toolchain-9)
> ("gzip" ,gzip)
> ("tar" ,tar)))
> (build-system trivial-build-system)
> (arguments
> `(#:modules
> ((guix build utils))
> #:builder
> (begin
> (use-modules (guix build utils))
>
> (let* ((source (assoc-ref %build-inputs "source"))
> (out (assoc-ref %outputs "out"))
> (gzip (assoc-ref %build-inputs "gzip"))
> (gunzip-bin (string-append gzip "/bin/gunzip"))
> (tar (assoc-ref %build-inputs "tar"))
> (tar-bin (string-append tar "/bin/tar"))
> (gcc-dir (assoc-ref %build-inputs "gcc-toolchain"))
> (gcc-bin (string-append gcc-dir "/bin/gcc")))
>
> (let* ((packages (alist-delete "source" %build-inputs))
> (packages-path (map cdr packages)))
> (setenv
> "PATH"
> (apply
> string-append
> (getenv "PATH") ":"
> (map (lambda (p) (string-append p "/bin:"))
> packages-path))))
>
> ;; (setenv "GCC_EXEC_PREFIX" gcc-dir)
> ;; gcc: fatal error: cannot execute 'cc1': execvp: No such
> file or directory
>
> (display (list "gcc-bin" gcc-bin)) (newline)
>
> (mkdir-p out) (chdir out)
> (copy-file source "simpletest.tar.gz")
> (invoke gunzip-bin "simpletest.tar.gz")
> (invoke tar-bin "xvf" "simpletest.tar")
> (delete-file "simpletest.tar")
> (chdir "simpletest")
> (invoke gcc-bin "simpletest.c" "-o" "simpletest")
>
> #t))))
>
> (synopsis "Simple Test")
> (description "Simple Test")
> (home-page "None")
> (license license:gpl3+)))
>
> Best regards,
>
> Emmanuel Medernach
next prev parent reply other threads:[~2022-11-08 10:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 10:23 Error using gcc with trivial-build-system Emmanuel Medernach
2022-11-08 10:45 ` Sergiu Ivanov [this message]
2022-11-08 10:58 ` Emmanuel Medernach
2022-11-08 11:39 ` Wojtek Kosior via
2022-11-08 13:01 ` Emmanuel Medernach
2022-11-08 14:10 ` Tobias Geerinckx-Rice
2022-11-08 14:48 ` Emmanuel Medernach
2022-11-08 21:16 ` zimoun
2022-11-09 7:18 ` Emmanuel Medernach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7thd8lt.fsf@colimite.fr \
--to=sivanov@colimite.fr \
--cc=Emmanuel.Medernach@iphc.cnrs.fr \
--cc=help-guix@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).