Sébastien Gendre <[email protected]> writes: > Hello everyone, > > I try to define a Guix package for the JMRI application and I get an > error during the build of the Guix package. But when I build manually > this application from it's source code, it work. > > JMRI is a Java application that use the Ant build system. > > Here is how I defined the Guix package in a file named "train.scm": > > (define-module (gnu packages train) > #:use-module ((guix licenses) #:prefix license:) > #:use-module (guix utils) > #:use-module (guix packages) > #:use-module (guix git-download) > #:use-module (guix build-system ant) > #:use-module (gnu packages) > #:use-module (gnu packages version-control)) > > > (define-public java-jmri > (package > (name "JMRI") > (version "5.12") > (source (origin > (method git-fetch) > (uri (git-reference > (url "https://github.com/JMRI/JMRI") > (commit (string-append "v" version)))) > (file-name (git-file-name name version)) > (sha256 > (base32 > "0hd8sl81w1i2c1qhyz55bfdsjf1zbw0l6crg206ik7fv5qsnwsxp")))) > (build-system ant-build-system) > (arguments > (list #:build-target "package-linux")) > (native-inputs > (list git)) > (home-page "https://www.jmri.org") > (synopsis "Set of community-developed tools for configuring and > running your model railroad") > (description > "...") > (license license:gpl2))) > > java-jmri > > > When I try to install the package with this command: > > guix package --install-from-file=train.scm > > I get an error: > > guix package: erreur : build of > `/gnu/store/5c4xjyi0jsdwbipz88gghb9ghvjsfgah-JMRI-5.12.drv' failed > > > The build log explain in more details what error I get: > > starting phase `build' > Buildfile: /tmp/guix-build-JMRI-5.12.drv-0/source/build.xml > [exec] Result: 128 > [echo] settings.dir assumed to be //.jmri > > BUILD FAILED > /tmp/guix-build-JMRI-5.12.drv-0/source/build.xml:125: Directory > /.jmri/lib creation was not successful for an unknown reason > > Total time: 0 seconds > error: in phase 'build': uncaught exception: > %exception #<&invoke-error program: "ant" arguments: ("package-linux") > exit-status: 1 term-signal: #f stop-signal: #f> > phase `build' failed after 0.5 seconds > command "ant" "package-linux" failed with status 1 > build process 10 exited with status 256 > > > Apparently, Ant try to create a directory as "/.jmri/lib", which fail. > In the `build.yml` file, line 125, the directory is set as > "${settings.dir}/lib". And "settings.dir" is set as > "${user.home}/.jmri" (line 121). > > When I manually build this application from its code sources, it end > successfully. In this case, I use this command: > > ant package-linux > > > My hypothesis is when Guix run Ant, Ant cannot define "user.home". > > Does someone had the same problem ? > > > Best regards > > ------- > Gendre Sébastien
Hi Sébastien,
To add to Ian’s answer, $HOME is not defined by default in build
environments.
Its possible that adding a phase like the following example to your
package can provide an easy fix.
(add-before 'build 'set-home
(lambda _
(setenv "HOME" "/tmp")))
The root cause of your issue being that "${user.home}/.jmri" would
expand to /.jmri since $HOME is not set.
Good day,
Noé
signature.asc
Description: PGP signature
