用Flatpak打包scipy或lapack

时间:2018-09-11 19:34:40

标签: scipy flatpak

我正在尝试将使用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

1 个答案:

答案 0 :(得分:0)

我在查看其他项目方面取得了一些进展。我在https://github.com/flathub/org.jamovi.jamovi找到的配置似乎可以完美地工作。以下是一些可能有助于您的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" ]
    }