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
Added support for building standalone executable with warp #69
base: master
Are you sure you want to change the base?
Conversation
Looks good! It needs to be rebased (and the version in the relx configy should be 7.1.0) |
|
||
Warp also supports windows x86, but this is not tested. | ||
|
||
Warp currently does not support arm64. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using gh actions we can build a standalone executable for every platform.
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
[sasl, aesophia_cli, aesophia, aeserialization, eblake2]}, | ||
|
||
{dev_mode, false}, | ||
{include_erts, true}, % To include Erlang runtime system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is possible to include Erlang runtime into executable, why do we need warp in macOS and Linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a single executable like a C program. It creates a self extracting tar file with the command
|
||
{dev_mode, false}, | ||
{include_erts, true}, % To include Erlang runtime system | ||
{extended_start_script, true}, % Should be true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why it should be true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is warp-packer maintained? I see the last release was in 2018, and the last commit was in 2019.
I've built it for different platforms according to the readme, but it is not working well for me.
The packed size for all architectures is 37M, aesophia_cli by itself is only 1.4M.
Ubuntu
$ ./aesophia_cli-linux
/root/.local/share/warp/packages/aesophia_cli-linux/erts-13.2.2.1/bin/erl: 1: /root/.local/share/warp/packages/aesophia_cli-linux/erts-13.2.2.1/bin/dyn_erl: Exec format error
/root/.local/share/warp/packages/aesophia_cli-linux/erts-13.2.2.1/bin/erl: 57: exec: ./erts-13.2.2.1/bin/erlexec: not found
$ uname -a
Linux denis-VirtualBox 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
macOS
$ ./aesophia_cli-macos
/Users/denis/Library/Application Support/warp/packages/aesophia_cli-macos/launch: line 6: /Users/denis/Library/Application: No such file or directory
/Users/denis/Library/Application Support/warp/packages/aesophia_cli-macos/launch: line 6: exec: /Users/denis/Library/Application: cannot execute: No such file or directory
$ uname -a
Darwin adsl-172-10-0-56.dsl.sndg02.sbcglobal.net 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64
It looks like the path needs to be escaped or quoted, it fails because of space in "Application Support".
Windows
.\aesophia_cli-windows.exe
Error: Os { code: 193, kind: Other, message: "%1 is not a valid Win32 application." }
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19044 N/A Build 19044
System Type: x64-based PC
warp-packer seems to work, although I agree not much activity for a few years. Worst case if it stops working eventually we find something else, or this all ends up re-written in Rust. linux works fine for me. macOS indeed needs some quotes in the script. I have a fix. It works but still creates a warning on each run. windows I don't plan to support at all in this PR Regarding the size, 37M is larger than the simple escript, but it does include all the parts of the erlang system including the beam runtime and libraries. |
Reproduction of error on Ubuntu #!/bin/bash
set -e
./rebar3 escriptize
./rebar3 release
wget -O warp-packer https://github.com/dgiagio/warp/releases/download/v0.3.0/macos-x64.warp-packer
chmod +x ./warp-packer
./warp-packer -a linux-x64 -i _build/default/rel/aesophia_cli -e launch -o warp/aesophia_cli
echo "
FROM ubuntu:22.04
ADD ./warp/aesophia_cli ./
RUN ./aesophia_cli --help
" > Dockerfile
docker build -t compiler-ubuntu-test . Its output
|
This PR was sponsored by the ACF