I am trying to build a Freeplane derivation based on Freemind, see: https://github.com/razvan-panda/nixpkgs/blob/freeplane/pkgs/applications/misc/freeplane/default.nix
{ stdenv, fetchurl, jdk, jre, gradle }:
stdenv.mkDerivation rec {
name = "freeplane-${version}";
version = "1.6.13";
src = fetchurl {
url = "mirror://sourceforge/project/freeplane/freeplane%20stable/freeplane_src-${version}.tar.gz";
sha256 = "0aabn6lqh2fdgdnfjg3j1rjq0bn4d1947l6ar2fycpj3jy9g3ccp";
};
buildInputs = [ jdk gradle ];
buildPhase = "gradle dist";
installPhase = ''
mkdir -p $out/{bin,nix-support}
cp -r ../bin/dist $out/nix-support
sed -i 's/which/type -p/' $out/nix-support/dist/freeplane.sh
cat >$out/bin/freeplane <<EOF
#! /bin/sh
JAVA_HOME=${jre} $out/nix-support/dist/freeplane.sh
EOF
chmod +x $out/{bin/freeplane,nix-support/dist/freeplane.sh}
'';
meta = with stdenv.lib; {
description = "Mind-mapping software";
homepage = https://www.freeplane.org/wiki/index.php/Home;
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}
During the gradle build step it is throwing the following error:
building path(s)
‘/nix/store/9dc1x2aya5p8xj4lq9jl0xjnf08n7g6l-freeplane-1.6.13’
unpacking sources unpacking source archive
/nix/store/c0j5hgpfs0agh3xdnpx4qjy82aqkiidv-freeplane_src-1.6.13.tar.gz
source root is freeplane-1.6.13 setting SOURCE_DATE_EPOCH to timestamp
1517769626 of file freeplane-1.6.13/gitinfo.txt patching sources
configuring no configure script, doing nothing buildingFAILURE: Build failed with an exception.
What went wrong: Failed to load native library 'libnative-platform.so' for Linux amd64.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. builder for ‘/nix/store/id4vfk3r6fd4zpyb15dq9xfghf342qaa-freeplane-1.6.13.drv’
failed with exit code 1 error: build of
‘/nix/store/id4vfk3r6fd4zpyb15dq9xfghf342qaa-freeplane-1.6.13.drv’
failed
Running gradle dist
from terminal works fine. I'm guessing that maybe one of the globally installed Nix packages provides a fix to the issue and they are not visible during the build.
I searched a lot but couldn't find any working solution. For example, removing the ~/.gradle
folders didn't help.
To reproduce the issue just git clone https://github.com/razvan-panda/nixpkgs
, checkout the freeplane branch and run nix-build -A freeplane
in the root of the repository.
More information in SO question comments: https://stackoverflow.com/q/48652914/750216
"x86_64-linux"
Linux 4.9.78, NixOS, 17.09.2905.c1d9aff56e0 (Hummingbird)
yes
no
nix-env (Nix) 1.11.16
"nixpkgs-unstable-18.03pre126798.42b9b8f7c86, nixos-17.09.2905.c1d9aff56e0, nixos-unstable-18.03pre118631.66b63d2f5a"
""
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
Can you try setting $GRADLE_USER_HOME
(as per #20802)?
I wonder if you're just running into the missing $HOME
directory.
That would be the only thing I can think of...
@NeQuissimus I tried following the instructions from that ticket but still got the same error (possible I did not apply the changes correctly).
Other instances of this Failed to load native library 'libnative-platform.so'
issue:
madveru from #nixos IRC tried to build it from my git clone and got a different error:
~/github/nixos/nixpkgs(:10915ff1919|…) % g cd razvan-panda/freeplane
Previous HEAD position was 10915ff1919... Freetype GL: init at 2017-08-10
HEAD is now at a8e528684b8... Freeplane
~/github/nixos/nixpkgs(:a8e528684b8|…) % nix-build -A freeplane
these derivations will be built:
/nix/store/i3x16vnhf3q58qg5yqfigzxgi34050z0-freeplane-1.6.13.drv
building '/nix/store/i3x16vnhf3q58qg5yqfigzxgi34050z0-freeplane-1.6.13.drv'...
unpacking sources
unpacking source archive /nix/store/c0j5hgpfs0agh3xdnpx4qjy82aqkiidv-freeplane_src-1.6.13.tar.gz
source root is freeplane-1.6.13
setting SOURCE_DATE_EPOCH to timestamp 1517769626 of file freeplane-1.6.13/gitinfo.txt
patching sources
configuring
no configure script, doing nothing
building
Starting a Gradle Daemon (subsequent builds will be faster)FAILURE: Build failed with an exception.
Where:
Build file '/build/freeplane-1.6.13/build.gradle' line: 2What went wrong:
Plugin [id: 'nebula.ospackage', version: '4.4.0'] was not found in any of the following sources:Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'nebula.ospackage:nebula.ospackage.gradle.plugin:4.4.0')
Searched in the following repositories:
Gradle Central Plugin RepositoryTry:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.Get more help at https://help.gradle.org
BUILD FAILED in 2s
Possibly libnative-platform.so
was loaded during his build and it continued with the gradle plugins.
I think the issue is that I am using Gradle wrong, my nix expression is the only one using , gradle
as input to the derivation. Struggling to find an example using Gradle.
@NeQuissimus Your suggestion worked in the end by setting GRADLE_USER_HOME
I just did not apply at the right place, had to go before gradle dist
:
buildPhase = ''
export GRADLE_USER_HOME="/tmp"
gradle dist
'';
Thank you. I think the issue can be closed now.
Awesome! I am glad you worked it out!
Most helpful comment
Awesome! I am glad you worked it out!