c++ - Nix Gradle dist - 无法为 Linux amd64 加载 native 库 'libnative-platform.so'

标签 c++ c gradle nix nixos

我正在尝试基于 Freemind 构建 Freeplane 派生,请参阅: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;
  };
}

在 gradle 构建步骤中,它抛出以下错误:

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 building

FAILURE: 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

从终端运行 gradle dist 工作正常。我猜测可能是全局安装的 Nix 软件包之一提供了该问题的修复程序,但在构建过程中它们是不可见的。

我搜索了很多,但找不到任何可行的解决方案。例如,删除 ~/.gradle 文件夹没有帮助。

更新

要重现问题,只需 git clone https://github.com/razvan-panda/nixpkgs,检查 freeplane 分支并运行 nix-build -A freeplane在存储库的根目录中。

Link to GitHub issue

最佳答案

也许你只是没有文件夹/文件的权限

sudo chmod 777 你的文件夹路径

您还可以:sudo chmod 777 yourFolderPath/*(所有文件夹)

文件夹不会被锁定,可以正常使用

[至少我成功了。。。]

例如:

enter image description here

sudo chmod 777 ruby /

enter image description here

现在,没关系

关于c++ - Nix Gradle dist - 无法为 Linux amd64 加载 native 库 'libnative-platform.so',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48652914/

相关文章:

c++ - 自动编译 MS visual c++

c - 如何编辑proc文件?

c - 在 C 中使用可变文件名从具有相似名称的多个文件中读取?

android-studio - Gradle 任务未显示在 Android Studio 4.2 的 gradle 工具窗口中

c++ - 在 C++ 中使用集合与使用数组

c++ - FFmpeg 中 RGB 到 YUV 的转换错误

c++ - 检查 fgets 是否会阻塞

gradle - 我的Gitlab CI/CD管道无法通过FATAL进行高速缓存:文件不存在错误

android - [Android Studio]Gradle 好像编码错误

c++ - 为什么 delete[] 会导致堆损坏错误?