Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to generate a standalone tarball with all dependencies #123

Open
certik opened this issue Jul 16, 2020 · 4 comments
Open

Allow to generate a standalone tarball with all dependencies #123

certik opened this issue Jul 16, 2020 · 4 comments
Labels
specification Issue regarding fpm manifest and model

Comments

@certik
Copy link
Member

certik commented Jul 16, 2020

fpm should have a feature like fpm tarball --include-deps that will create a tarball of the current fpm package together with all dependencies and a build system such as CMake (#69), so that one can unpack this tarball at a machine without internet connection, and build everything from scratch (all the dependencies and the main application).

There are many usages of this feature:

  • an application that must run on an HPC machine without internet connection, and I want to distribute it as a tarball that is built using cmake (a common expectation)
  • fpm itself --- we can distribute fpm source code like this, and anybody with cmake can then build it from source (no other dependencies needed)
@awvwgk
Copy link
Member

awvwgk commented Nov 22, 2020

I was trying to figure out what it takes to implement a command like this, but there are a some things that are unclear. First, I would propose to name the command fpm dist rather than fpm tarball.

The second thing that comes to mind is, in case we use fpm dist --cmake and generate a CMake based build system, how do we make CMake fetch the dependencies? FetchContent works fine, but only if the upstream project supports CMake as well.
On solution would be to rely on a release artefact created by fpm and uploaded somewhere instead of the default git-archive.

Finally, how do we handle the case of fpm dist --cmake --include-deps? Of course we can recursively generate the CMake files for all the projects and include them in a tarball, but some dependencies come with their own CMake files, would we overwrite (maybe with a fpm dist --cmake --include-deps --overwrite)?

As a note, in case anyone wants to give this a real try. Implementing a fpm dist --meson will probably be way less painful than implementing robust CMake.

@certik certik mentioned this issue Nov 27, 2020
3 tasks
@band-a-prend
Copy link

Is there a way to build fpm fully offline? If I do git clone and do bootstrap procedure as described and then run

./build/bootstrap/fpm build

the build is OK.

If I tried to build in isolated environment against system installed /usr/include/toml-f and /usr/include/m_cli2 modules with following fpm.toml instead of base:

name = "fpm"
version = "0.7.0"
license = "MIT"
author = "fpm maintainers"
maintainer = ""
copyright = "2020 fpm contributors"

[build]
external-modules = ["tomlf", "m_cli2"]

and command, e.g.

./build/bootstrap/fpm build --flag "-I/usr/include/toml-f -I/usr/include/m_cli2"

(where tomlf*.mod and m_cli2.mod are respected to the same git commit_sha tarballs as within initial fpm.toml) then on linking phase I got multiple errors like undefined reference to __m_cli2_MOD_... and undefined reference to __tomlf_....

P.S.
After built bootstrap version under build/booststrap directory the tomlf*.mod and m_cli2.mod files are presented too.

@band-a-prend
Copy link

Well it's seems the problem is with m_cli2 as exteranl demo1.f90 of m_cli2 doesn't compile for me (I don't see library built only .mod file).

The problem with toml-f was due to I forgot to link toml-f library and it was fixed by addition link = "toml-f to [build] section

name = "fpm"
version = "0.7.0"
license = "MIT"
author = "fpm maintainers"
maintainer = ""
copyright = "2020 fpm contributors"

[build]
external-modules = ["tomlf", "m_cli2"]
link = "toml-f"

@band-a-prend
Copy link

I solve the problem:
M_CLI2 Makefile doesn't build shared library that is required for other external projects.
I have to build object file M_CLI2.o with additional flag -fPIC and then to build shared library with command:

gfortran -Wl,-soname,libm_cli2.so.1 -shared -o libm_cli2.so.1 M_CLI2.o

with creating symlink libm_cli2.so for libm_cli2.so.1.

[build]
external-modules = ["tomlf", "m_cli2"]
link = ["toml-f", "m_cli2"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
specification Issue regarding fpm manifest and model
Projects
None yet
Development

No branches or pull requests

3 participants