* trivial-build-system: ld can't find existing store files
@ 2024-01-14 11:10 Christina O'Donnell
2024-01-14 21:28 ` Felix Lechner via
2024-01-17 16:40 ` Simon Tournier
0 siblings, 2 replies; 5+ messages in thread
From: Christina O'Donnell @ 2024-01-14 11:10 UTC (permalink / raw)
To: help-guix
[-- Attachment #1: Type: text/plain, Size: 4037 bytes --]
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 #2: evhz.scm --]
[-- Type: text/x-scheme, Size: 6720 bytes --]
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014, 2015, 2017, 2018, 2020 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2015 Cyrill Schenkel <cyrill.schenkel@gmail.com>
;;; Copyright © 2016, 2017, 2019-2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Nikita <nikita@n0.is>
;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016, 2017 John Darrington <jmd@gnu.org>
;;; Copyright © 2017-2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
;;; Copyright © 2017, 2020 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2018–2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
;;; Copyright © 2018, 2020, 2022 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
;;; Copyright © 2019 nee <nee@cock.li>
;;; Copyright © 2019 Yoshinori Arai <kumagusu08@gmail.com>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Copyright © 2020, 2021 Michael Rohleder <mike@rohleder.de>
;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Jean-Baptiste Note <jean-baptiste.note@m4x.org>
;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Lu Hui <luhux76@gmail.com>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2023 John Kehayias <john.kehayias@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages evhz)
#:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system trivial)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages commencement)
#:use-module (gnu packages gcc)
#:use-module (gnu packages glib)
#:use-module (gnu packages linux)
#:use-module (gnu packages xorg))
(define-public evhz
(let ((commit "35b7526e0655522bbdf92f6384f4e9dff74f38a0")
(revision "1"))
(package
(name "evhz")
(version (git-version "0.0.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://git.sr.ht/~iank/evhz")
(commit commit)))
(sha256
(base32
"1m2m60sh12jzc8f38g7g67b3avx2vg8ff0lai891jmjqvxw04bcl"))))
(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"))
":"))
;; (setenv "LD_LIBRARY_PATH"
;; (string-join
;; (list (string-append glibc "/lib")
;; (getenv "LD_LIBRARY_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")
;; In an attempt to get it working. I know this shouldn't be necessary!
;; "-l" (string-append glibc "/lib/crt1.o")
;; "-l" (string-append glibc "/lib/crti.o")
(string-append source "/evhz.c"))
#t))))
(inputs
(list binutils
gcc
gcc-toolchain
glibc
linux-libre-headers))
;; (native-inputs
;; (list binutils
;; gcc
;; gcc-toolchain
;; glibc
;; linux-libre-headers))
(home-page "https://git.sr.ht/~iank/evhz")
(synopsis "Show mouse refresh rate under linux + evdev.")
(description
"A simple diagnostic utility to show mouse refresh rate under linux +
evdev.")
(license license:apsl2))))
[-- Attachment #3: build-evhz.out --]
[-- Type: text/plain, Size: 2063 bytes --]
cdo@peter ~/src/guix$ guix shell -CW --pure --share=/var/guix/daemon-socket
guix shell: loading environment from '/home/cdo/src/guix/manifest.scm'...
cdo@peter ~/src/guix [env]$ ./pre-inst-env guix build evhz
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
The following derivation will be built:
/gnu/store/krh1sk0zn9z517971cim6ld1mp9cimi4-evhz-0.0.0-1.35b7526.drv
building /gnu/store/krh1sk0zn9z517971cim6ld1mp9cimi4-evhz-0.0.0-1.35b7526.drv...
/gnu/store/cv571kkg5hyk98yw48857h1d0zi9azni-binutils-2.38/bin/ld: cannot find crt1.o: No such file or directory
/gnu/store/cv571kkg5hyk98yw48857h1d0zi9azni-binutils-2.38/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
Backtrace:
2 (primitive-load "/gnu/store/9nnndgaddiy668h5jdr5y1szzb1?")
In ice-9/eval.scm:
619:8 1 (_ #(#<directory (guile-user) 7ffff77f7c80> "/gnu/st?" ?))
In guix/build/utils.scm:
812:6 0 (invoke "/gnu/store/4xzyl951wdy25rgk0ppsn4nisglw3207-g?" ?)
guix/build/utils.scm:812:6: In procedure invoke:
ERROR:
1. &invoke-error:
program: "/gnu/store/4xzyl951wdy25rgk0ppsn4nisglw3207-gcc-11.3.0/bin/gcc"
arguments: ("-o" "/gnu/store/cx1jfsphrpak2zvs6c5d3v0zj723jhc0-evhz-0.0.0-1.35b7526/bin/evhz" "-I" "/gnu/store/sjq77rvlryjgksni6ry1648xkj807ynv-linux-libre-headers-5.15.49/include" "-L" "/gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib" "/gnu/store/2aji8wq4c7ix1b5g2g10b2wj1yghf4kl-git-checkout/evhz.c")
exit-status: 1
term-signal: #f
stop-signal: #f
builder for `/gnu/store/krh1sk0zn9z517971cim6ld1mp9cimi4-evhz-0.0.0-1.35b7526.drv' failed with exit code 1
build of /gnu/store/krh1sk0zn9z517971cim6ld1mp9cimi4-evhz-0.0.0-1.35b7526.drv failed
Could not find build log for '/gnu/store/krh1sk0zn9z517971cim6ld1mp9cimi4-evhz-0.0.0-1.35b7526.drv'.
guix build: error: build of `/gnu/store/krh1sk0zn9z517971cim6ld1mp9cimi4-evhz-0.0.0-1.35b7526.drv' failed
cdo@peter ~/src/guix [env]$
[-- Attachment #4: manual-gcc.out --]
[-- Type: text/plain, Size: 1241 bytes --]
cdo@peter ~$ guix shell -CW binutils gcc gcc-toolchain glibc linux-libre-headers guile --pure
cdo@peter ~ [env]$ exit
cdo@peter ~$ rm evhz
cdo@peter ~$ guix shell -CW binutils gcc gcc-toolchain glibc linux-libre-headers guile --pure
cdo@peter ~ [env]$ guile
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (use-modules (guix build utils))
scheme@(guile-user)> (invoke "/gnu/store/4xzyl951wdy25rgk0ppsn4nisglw3207-gcc-11.3.0/bin/gcc" "-o" "evhz" "-I" "/gnu/store/sjq77rvlryjgksni6ry1648xkj807ynv-linux-libre-headers-5.15.49/include" "-L" "/gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib" "/gnu/store/2aji8wq4c7ix1b5g2g10b2wj1yghf4kl-git-checkout/evhz.c")
$1 = #t
scheme@(guile-user)>
cdo@peter ~ [env]$ exit
cdo@peter ~$ sudo ./evhz
Press CTRL-C to exit.
event0: Power Button
event1: Power Button
event2: SINO WEALTH Gaming KB
event3: SINO WEALTH Gaming KB System Control
event4: SINO WEALTH Gaming KB Consumer Control
event5: SINO WEALTH Gaming KB Keyboard
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trivial-build-system: ld can't find existing store files
2024-01-14 11:10 trivial-build-system: ld can't find existing store files Christina O'Donnell
@ 2024-01-14 21:28 ` Felix Lechner via
2024-01-17 16:40 ` Simon Tournier
1 sibling, 0 replies; 5+ messages in thread
From: Felix Lechner via @ 2024-01-14 21:28 UTC (permalink / raw)
To: Christina O'Donnell, help-guix
Hi Christina,
On Sun, Jan 14 2024, Christina O'Donnell wrote:
> /gnu/store/cv571kkg5hyk98yw48857h1d0zi9azni-binutils-2.38/bin/ld: cannot find crt1.o: No such file or directory
> /gnu/store/cv571kkg5hyk98yw48857h1d0zi9azni-binutils-2.38/bin/ld: cannot find crti.o: No such file or directory
The code below worked for me (with 'guix build -f evhz.scm') although
I'm a novice myself.
Thanks for using Guix!
Kind regards
Felix
* * *
(define-module (gnu packages evhz)
#:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system trivial)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages commencement)
#:use-module (gnu packages gcc)
#:use-module (gnu packages glib)
#:use-module (gnu packages linux)
#:use-module (gnu packages xorg))
(define-public evhz
(let ((commit "35b7526e0655522bbdf92f6384f4e9dff74f38a0")
(revision "1"))
(package
(name "evhz")
(version (git-version "0.0.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://git.sr.ht/~iank/evhz")
(commit commit)))
(sha256
(base32
"1m2m60sh12jzc8f38g7g67b3avx2vg8ff0lai891jmjqvxw04bcl"))))
(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"))
":"))
(setenv "LIBRARY_PATH" (string-join
(list (string-append glibc "/lib"))
":"))
(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")
(string-append source "/evhz.c"))
#t))))
(native-inputs
(list binutils
gcc
gcc-toolchain
glibc
linux-libre-headers))
(home-page "https://git.sr.ht/~iank/evhz")
(synopsis "Show mouse refresh rate under linux + evdev.")
(description
"A simple diagnostic utility to show mouse refresh rate under linux +
evdev.")
(license license:apsl2))))
evhz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trivial-build-system: ld can't find existing store files
2024-01-14 11:10 trivial-build-system: ld can't find existing store files Christina O'Donnell
2024-01-14 21:28 ` Felix Lechner via
@ 2024-01-17 16:40 ` Simon Tournier
2024-01-17 20:49 ` Christina O'Donnell
2024-01-17 23:55 ` Clément Lassieur
1 sibling, 2 replies; 5+ messages in thread
From: Simon Tournier @ 2024-01-17 16:40 UTC (permalink / raw)
To: Christina O'Donnell, help-guix
Hi,
On Sun, 14 Jan 2024 at 11:10, Christina O'Donnell <cdo@mutix.org> wrote:
> So I'm trying to write a package with a single C file using
> trivial-build-system[1].
Despite its name, trivial-build-system is the less trivial
build-system. Hum, gnu-build-system appears to me better for one single
C file, even if there is no Makefile.
Felix provided how to use trivial-build-system. Well – aside I am not
convinced that %build-inputs is a good way – as we see, many thing need
to be configured by hand, when gnu-build-system does it for you.
Cheers,
simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trivial-build-system: ld can't find existing store files
2024-01-17 16:40 ` Simon Tournier
@ 2024-01-17 20:49 ` Christina O'Donnell
2024-01-17 23:55 ` Clément Lassieur
1 sibling, 0 replies; 5+ messages in thread
From: Christina O'Donnell @ 2024-01-17 20:49 UTC (permalink / raw)
To: Simon Tournier, help-guix
Hi Simon,
Okay I can believe this, I'm only just learning about the autoconf and
co. I've already submitted a patch, but I'm happy to change it to
gnu-build-system if it'll make it simpler. autoconf is more automatic
than I've given it credit for!
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68502
I've put it on my list of things to get back to when I next have a clean
checkout.
Kind regard,
Christina O'Donnell
On 17/01/2024 16:40, Simon Tournier wrote:
> Hi,
>
> On Sun, 14 Jan 2024 at 11:10, Christina O'Donnell <cdo@mutix.org> wrote:
>
>> So I'm trying to write a package with a single C file using
>> trivial-build-system[1].
> Despite its name, trivial-build-system is the less trivial
> build-system. Hum, gnu-build-system appears to me better for one single
> C file, even if there is no Makefile.
>
> Felix provided how to use trivial-build-system. Well – aside I am not
> convinced that %build-inputs is a good way – as we see, many thing need
> to be configured by hand, when gnu-build-system does it for you.
>
> Cheers,
> simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trivial-build-system: ld can't find existing store files
2024-01-17 16:40 ` Simon Tournier
2024-01-17 20:49 ` Christina O'Donnell
@ 2024-01-17 23:55 ` Clément Lassieur
1 sibling, 0 replies; 5+ messages in thread
From: Clément Lassieur @ 2024-01-17 23:55 UTC (permalink / raw)
To: Simon Tournier; +Cc: Christina O'Donnell, help-guix
On Wed, Jan 17 2024, Simon Tournier wrote:
> Hi,
>
> On Sun, 14 Jan 2024 at 11:10, Christina O'Donnell <cdo@mutix.org> wrote:
>
>> So I'm trying to write a package with a single C file using
>> trivial-build-system[1].
>
> Despite its name, trivial-build-system is the less trivial
> build-system. Hum, gnu-build-system appears to me better for one single
> C file, even if there is no Makefile.
>
> Felix provided how to use trivial-build-system. Well – aside I am not
> convinced that %build-inputs is a good way – as we see, many thing need
> to be configured by hand, when gnu-build-system does it for you.
There is the copy-build-system too :) Which is like the
gnu-build-system, without bootstrap, configure, build, check, install.
And you don't need all those stuff so...
Thanks for your contribution!
Clément
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-17 23:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-14 11:10 trivial-build-system: ld can't find existing store files Christina O'Donnell
2024-01-14 21:28 ` Felix Lechner via
2024-01-17 16:40 ` Simon Tournier
2024-01-17 20:49 ` Christina O'Donnell
2024-01-17 23:55 ` Clément Lassieur
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.