help-guix
[Top][All Lists]
Advanced

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

trivial-build-system: ld can't find existing store files


From: Christina O'Donnell
Subject: trivial-build-system: ld can't find existing store files
Date: Sun, 14 Jan 2024 11:10:03 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

Hey Guix!

I've been banging my head against this one for a while and I'd appreciate if
someone could take a look at it quickly, and spot where I went wrong.

So I'm trying to write a package with a single C file using
trivial-build-system[1]. I feel like I'm almost there, except when building the linker fails to find the glibc object files that I definitely specified. What makes this seem odd to me is: the same command succeeds if I run in a container
shell with only the dependencies and guile used.

I've attached the following files:

 - evhz.scm - containing the package definition that I just have in
   /gnu/packages/ in my checkout. (this is the only change)
 - build-evhz.out - the output of ./pre-inst-env guix build evhz
 - manual-gcc.out - the output of the command running the invoke gcc command
   in a guix-shell container

I've tried the following:

 - make clean and tried a few different master branch versions to see if that
   might shake it into action, but no avail.
 - Setting LD_LIBRARY_PATH, no effect
 - Specifying the library files explicitly with -l, still can't find them
 - Specifying native-inputs instead of just inputs, no change

If someone could take a look at my package definition, I've included the body
snippet below (full code attached):

        (build-system trivial-build-system)
        (arguments
         `(#:modules ((guix build utils))
           #:builder (begin
                         (use-modules (guix build utils))
                         (let ((source (assoc-ref %build-inputs "source"))
                               (glibc (assoc-ref %build-inputs "glibc"))
                               (gcc (assoc-ref %build-inputs "gcc"))
                               (binutils (assoc-ref %build-inputs "binutils"))                                (linux-libre-headers (assoc-ref %build-inputs "linux-libre-headers"))
                               (output (assoc-ref %outputs "out")))
                           (setenv "PATH" (string-join
                                           (list (string-append gcc "/bin")
                                                 (string-append binutils "/bin")
                                                 (getenv "PATH"))
                                           ":"))
                           (mkdir-p (string-append output "/bin"))
                           (invoke (string-append gcc "/bin/gcc")
                                   "-o" (string-append output "/bin/evhz")
                                   "-I" (string-append linux-libre-headers "/include")
                                   "-L" (string-append glibc "/lib")
                                   (string-append source "/evhz.c"))
                           #t))))
        (inputs
         (list binutils
               gcc
               gcc-toolchain
               glibc
               linux-libre-headers))

Thanks for making Guix awesome!

Christina O'Donnell

[1] It's my first attempt packaging and this looked the easiest on to start
with. There's no make file, so trivial-build-system seemed like it'd be the
right fit.[2]

[2] Aside: I saw that none of the trivial-build-system packages in Guix use
Gexp. Is Gexp compatible with trivial-build-system? I couldn't make it work.

Attachment: evhz.scm
Description: Text Data

Attachment: build-evhz.out
Description: Text document

Attachment: manual-gcc.out
Description: Text document


reply via email to

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