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

Produce a static binary #375

Open
jankatins opened this issue Dec 10, 2022 · 3 comments
Open

Produce a static binary #375

jankatins opened this issue Dec 10, 2022 · 3 comments

Comments

@jankatins
Copy link

I came to love the static binaries produced by go/rust apps. You can download them directly from GitHub releases and put them into your local path and be done. It would be nice to have this for grive, too.

Currently I have to rebuild grive (debian packages) a lot because some of the dependencies on debian unstable has an api change and so changes the soname version and grive is not in debian and therefore not automatically rebuild in such transitions.

I can build github pipelines to produce binaries for different platform, but I have no idea how to change the build pipeline to produce a static binary instead of a dynamically linked one.

@jumoog
Copy link

jumoog commented Dec 13, 2022

I have been working on this a little bit. You have to build almost all dependencies yourself so they are not dynamic. I have given up on it.

@hubyhuby
Copy link

Dear @jumoog
Do you have a binary for the current grive2 installation o Ubuntu 22 AMD ?
Thanks for your help, for now I am strungeling with compilation :
#374

@jankatins
Copy link
Author

This is a very quick and dirty way to build an appimage for grive, which includes all relevant libraries (debian unstable)...

# Prepare dependencies and tools
λ  wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
λ  chmod +x linuxdeploy*.AppImage
λ  sudo apt install --mark-auto cmake pkg-config zlib1g-dev libcurl4-openssl-dev  libboost-filesystem-dev libboost-program-options-dev libboost-test-dev libboost-regex-dev libexpat1-dev libgcrypt-dev libyajl-dev

# Install into ./AppDir
λ  cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DHAVE_SYSTEMD=1
λ  make -j`nproc`  install DESTDIR=AppDir

# Create necessary desktop file -> AppImages do not work without, for whatever reason
λ  printf "[Desktop Entry]\nName=grive\nExec=grive\nIcon=grive\nType=Application\nTerminal=true\nCategories=Utility;\n" > grive.desktop

# xterm icon chosen at random... :-/
# For some reason the version cannot be computed 
λ  VERSION=0.5.3 ./linuxdeploy-x86_64.AppImage --appdir AppDir -e AppDir/usr/bin/grive -d ./grive.desktop -i /usr/share/icons/hicolor/48x48/apps/xterm.png --output appimage

# Just to see if it works
λ  ./grive-0.5.3-x86_64.AppImage --help

grive-0.5.3-x86_64.AppImage is 23MB compared to the 1.5MB of the grive binary itself.

I haven't tested this further, but I really like this... The only problem is that I would have to manually get the systemd/script files to run it as a service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants