1

我正在尝试打包一个使用 Scipy 和 Flatpak 的程序。我不知道如何定义 lapack/blas 依赖项。构建失败的错误消息在错误上非常清楚:

numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

我当前(WIP)配置的提交在这里:https ://github.com/innstereo/innstereo/commit/7f0272a70584e919546c4fdd07531d2c5c063d52

当我将它添加到模块数组的开头时:

{
   "name": "lapack",
   "buildsystem": "cmake",
   "sources": [
      {
        "type": "git",
         "url": "https://github.com/Reference-LAPACK/lapack"
      }
    ]
 }

我收到此错误:

-- The Fortran compiler identification is unknown -- The C compiler identification is GNU 6.2.0 CMake Error at CMakeLists.txt:3 (project): No CMAKE_Fortran_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "FC" or the CMake cache entry CMAKE_Fortran_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.


-- Check for working C compiler: /run/ccache/bin/cc
-- Check for working C compiler: /run/ccache/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring incomplete, errors occurred!
See also "/run/build/lapack/CMakeFiles/CMakeOutput.log".
See also "/run/build/lapack/CMakeFiles/CMakeError.log".
Error: module lapack: Child process exited with code 1

https://github.com/Reference-LAPACK/lapack有一个 cmake 配置。这应该开箱即用吗?是否有必要覆盖其中的一部分才能让 Flatpak 构建运行?

编辑 1

我添加了

"sdk-extensions": [
    "org.freedesktop.Sdk.Extension.gfortran-62"
]

"modules": [
    {
        "name": "lapack",
        "buildsystem": "simple",
        "append-path": "/usr/lib/sdk/gfortran-62/bin",
        "build-commands": [
            "/usr/lib/sdk/gfortran-62/use.sh"
        ],
        "sources": [
            {
                "type": "git",
                "url": "https://github.com/Reference-LAPACK/lapack"
            }
        ]
    }

到我的flatpak json。这似乎是解决方案的一部分。但是当 numpy 尝试在容器内编译时它仍然丢失(我假设)。

相关讨论:https ://github.com/flatpak/flatpak/issues/1913

4

1 回答 1

1

我在其他项目上取得了一些进展。我在https://github.com/flathub/org.jamovi.jamovi找到的配置似乎非常适合 scipy。以下是一些可能有助于您的 flatpak 清单的重要内容:

您需要 fortran SDK 扩展:

"sdk-extensions": [
    "org.freedesktop.Sdk.Extension.gfortran-62"
],

在构建选项中,您需要设置 gfortran 编译器的路径:

"build-options": {
    "append-path": "/usr/lib/sdk/gfortran-62/bin",
    "env": {
        "PATH": "/app/bin:/usr/bin:/usr/lib/sdk/gfortran-62/bin"
    }
},

您构建的第一个模块应该是 fortran 编译器:

"modules": [
    {
        "name": "gfortran",
        "buildsystem": "simple",
        "build-commands": [ "/usr/lib/sdk/gfortran-62/install.sh" ]
    },

接下来是lapack。此配置似乎有效:

    {
        "name": "lapack",
        "buildsystem": "cmake",
        "builddir": true,
    "append-path": "/usr/lib/sdk/gfortran-62/bin",
    "config-opts": [
            "-DCMAKE_INSTALL_PREFIX=/app",
            "-DCMAKE_INSTALL_LIBDIR=lib",
            "-DCMAKE_BUILD_TYPE=Release",
            "-DBUILD_SHARED_LIBS=ON",
            "-DBUILD_TESTING=OFF",
            "-DCMAKE_Fortran_COMPILER=/usr/lib/sdk/gfortran-62/bin/gfortran",
            "-DLAPACKE=ON",
            "-DCBLAS=ON"
        ],
        "sources": [
            {
                "type": "archive",
                "url": "http://www.netlib.org/lapack/lapack-3.8.0.tar.gz",
                "sha512": "17786cb7306fccdc9b4a242de7f64fc261ebe6a10b6ec55f519deb4cb673cb137e8742aa5698fd2dc52f1cd56d3bd116af3f593a01dcf6770c4dcc86c50b2a7f"
            }
        ],
        "cleanup": [ "/lib/cmake" ]
    }
于 2018-09-15T09:34:16.577 回答