Hi Sébastien,
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.
Packages can only write to $HOME and the package output(s). Since
Ant is trying to make a directory in /, the build fails, since it
has no permission to do that.
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).
The correct course of action depensd on what the file is needed
for:
If it’s user configuration: Delete the code which puts the file in
user.home. Guix packages can’t affect anything outside their
output path. If this user configuration is required to use the
package, you’ll need a Guix Home service to configure the package
and write it to the expected location within the user’s $HOME.
If it’s a default configuration used by the package: It needs to
go into the package outputs.
When I manually build this application from its code sources, it
end
successfully. In this case, I use this command:
ant package-linux
The Guix build environment is much more restricted than building
directly on the host, so it’s expected that behavior will be
different.
My hypothesis is when Guix run Ant, Ant cannot define
"user.home".
I’m not sure how ant-build-system works, but since packages
shouldn’t be putting things in $HOME, it wouldn’t surprise me if
this was the case.
Does someone had the same problem ?
You may be able to find some other packages dealing with similar
situations if you grep for ant-build-system in gnu/packages in the
Guix repo.
-- Ian