-
Notifications
You must be signed in to change notification settings - Fork 136
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
Compiling FORM with --enable-static-link #456
Comments
There is a similar problem for building Windows native binary (mingw-w64-x86_64) where the static version of the MPFR library is unavailable. In such a case, an option would be to build a static library of MPFR (maybe GMP, too) from the source in such a way that it is "universal" (or "fat"). I haven't tried but vcpkg may be helpful for that. Edit: indeed, our macOS binaries on the GitHub Release page use static libraries from Homebrew. Maybe a similar trick would work on Linux(?) |
Many thanks for your reply! Creating a static build of MPFR turned out to be much simpler than I thought. Following this https://gapcoin-project.github.io/mining/2021/04/09/compiling-static-libgmp-and-libmpfr/ I succeeded in compiling a fat tform binary :) Surprisingly, in this case the For the sake of completeness, here's the full instruction that I used on Fedora 37 Need to create static builds of mpfr and gmp first
Installing the necessary libraries on Fedora
Creating a universal fat form/tform binary (to be run from a FORM repo)
|
Thanks for the try. I think there are 2 problems with your commands.
docker run -it --rm fedora:37 export MYLIBDIR=/opt/tmp-mylib
dnf install -y automake bzip2 diffutils gcc-c++ git glibc-static gmp-devel libstdc++-static make ruby rubygem-test-unit xz zlib-devel zlib-static
curl -O https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz
tar Jxf gmp-6.3.0.tar.xz
pushd gmp-6.3.0
./configure --prefix=$MYLIBDIR/gmp --enable-static --disable-shared --enable-cxx --with-pic
make -j $(nproc)
make check
make install
popd
curl -O https://www.mpfr.org/mpfr-current/mpfr-4.2.0.tar.bz2
tar jxf mpfr-4.2.0.tar.bz2
pushd mpfr-4.2.0
./configure --prefix=$MYLIBDIR/mpfr --enable-static --disable-shared --with-pic --with-gmp=$MYLIBDIR/gmp
make -j $(nproc)
make check
make install
popd
git clone https://github.com/vermaseren/form
pushd form
autoreconf -i
./configure --disable-native --enable-static-link --with-mpfr=$MYLIBDIR/mpfr # fails
make -j $(nproc)
make check TEST_OPTS=--stat # fails due to #441 which gave me
because I had not installed the ./configure --disable-native --enable-static-link --with-gmp=$MYLIBDIR/gmp --with-mpfr=$MYLIBDIR/mpfr worked well and the subsequent compilation succeeded ( |
Many thanks for your analysis. It's interesting that when running
I actually get
But indeed, I had gmp-static in the version 6.2.1 installed, so perhaps it works just because it's ABI compatible with 6.3.0 Recompiling gmp and FORM using the flags you mentioned works as well. I guess since Fedora ships a static flavor of libgmp one could probably just go with mpfr alone, but for the sake of completeness it's good to have a full instruction that might be useful for other distros as well. |
I think this is because you haven't installed Ruby, which is required to run the test suite; so only the benchmark test ( |
Actually I do have ruby installed
so I really don't know why the other part of the test wasn't invoked. If it is of relevance, here's the tform binary that I got |
Can you see whether the configure script found Ruby's "test/unit" in |
Thanks, BTW, it seems like not all tests pass in my case even though I'm using a vanilla version of form
Is this expected? |
We know some test cases fail in the master branch. This is for development and is not guaranteed to work correctly. We need to understand what was changed from the stable version to fix the regressions. |
I see, thanks for the clarification. |
Dear developers,
I remember having successfully created a statically linked FORM binary in the past (to have something
that can be used on most machines/clusters without recompiling), but it seems that with the recent snapshot
from the repository this doesn't work anymore.
I tried the following
on Fedora 37 with gcc 12.3.1 but apparently this fails because a static version of libmpfr is missing:
In the past it was sufficient to install the static versions of libstdc++, glibc and zlib
but since Fedora doesn't offer a static build of libmpfr, I'm wondering if there's perhaps some workaround one could come up with.
Cheers,
Vlad
The text was updated successfully, but these errors were encountered: