-
Notifications
You must be signed in to change notification settings - Fork 17
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
[PKG REQUEST] SimpleX Chat CLI for x86_64 #34
Comments
Unfortunately, that Dockerfile you linked doesn't build for me. I have also requested this pkg over at @leleliu008 's leleliu008/ppkg-formula-repository-official-core#6 I am hopeful that there's a way we can compile it statically, however if not, I will probably consider using staticx on it. Edit: 🌀 ❯ sha256sum simplex-chat
f66eb32be56a08cb83ddac3c5224110f7a73ee2af4503153816575ef52b30a13 simplex-chat do let me know if this works as expected |
This is quite strange, as it appears to build just fine for me. Can you confirm that this fails aswell? If yes, what's the error?
|
I didn't use the Dockerfile directly, I copied the steps so it would be reproducible for both aarch64 & x86_64 and wouldn't rely on an external source. Running docker build using the docker file directly: #/tmp/toolpacks/Uwa4SFh_linux_x86_64 is an empty dir
/tmp/toolpacks/Uwa4SFh_linux_x86_64$ git clone --depth 1 https://github.com/simplex-chat/simplex-chat.git simplex-chat
cd simplex-chat
rm -fv Dockerfile
wget https://raw.githubusercontent.com/simplex-chat/simplex-chat/2abee7edf8cd1c975c9336aa7885f6f818b88d7e/Dockerfile
DOCKER_BUILDKIT=1 docker build .
Cloning into 'simplex-chat'...
remote: Enumerating objects: 2647, done.
remote: Counting objects: 100% (2647/2647), done.
remote: Compressing objects: 100% (2270/2270), done.
remote: Total 2647 (delta 285), reused 1551 (delta 194), pack-reused 0 (from 0)
Receiving objects: 100% (2647/2647), 91.13 MiB | 24.66 MiB/s, done.
Resolving deltas: 100% (285/285), done.
removed 'Dockerfile'
--2024-09-20 04:21:32-- https://raw.githubusercontent.com/simplex-chat/simplex-chat/2abee7edf8cd1c975c9336aa7885f6f818b88d7e/Dockerfile
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.110.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1720 (1.7K) [text/plain]
Saving to: 'Dockerfile'
Dockerfile 100%[===========================================================>] 1.68K --.-KB/s in 0s
2024-09-20 04:21:32 (25.9 MB/s) - 'Dockerfile' saved [1720/1720]
[+] Building 521.9s (16/18) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.76kB 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [build-stage 1/13] FROM docker.io/library/alpine:latest 0.0s
=> [internal] load build context 1.6s
=> => transferring context: 227.75MB 1.5s
=> [build-stage 2/13] RUN apk add --no-cache curl git xz grep ghc-dev gmp-dev zlib-static zl 25.8s
=> [build-stage 3/13] RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERAC 122.7s
=> [build-stage 4/13] RUN ghcup set ghc "9.6.3" && ghcup set cabal "3.10.1.0" 0.5s
=> [build-stage 5/13] RUN cabal install --install-method=copy --installdir=/usr/local/bin hpack-0.36.0 340.0s
=> [build-stage 6/13] COPY . /project 2.2s
=> [build-stage 7/13] WORKDIR /project 0.0s
=> [build-stage 8/13] RUN cp ./scripts/cabal.project.local.linux ./cabal.project.local 0.2s
=> [build-stage 9/13] RUN sed -i '/- -Wunused-type-patterns/a\ - -O2\n\ - -split-sections\n\ - -with-rtsopts=-N\n\ - -sta 0.3s
=> [build-stage 10/13] RUN hpack 0.4s
=> [build-stage 11/13] RUN cabal update 25.4s
=> ERROR [build-stage 12/13] RUN cabal build -j exe:simplex-chat 4.4s
------
> [build-stage 12/13] RUN cabal build -j exe:simplex-chat:
1.258 HEAD is now at aab7b5a support tagging objects with single field
2.256 HEAD is now at 9aa09f1 allow base versions < 4.19
4.033 Cleared directory 'sqlcipher'
4.040 Submodule 'sqlcipher' (https://github.com/sqlcipher/sqlcipher.git) unregistered for path 'sqlcipher'
4.231 HEAD is now at f814ee6 update .gitmodules
4.308 Submodule 'sqlcipher' (https://github.com/sqlcipher/sqlcipher.git) registered for path 'sqlcipher'
4.314 Cloning into '/project/dist-newstyle/src/direct-sq_-1924b92d6e0c4e68/sqlcipher'...
4.314 fatal: could not open '/project/dist-newstyle/src/direct-sq_-1924b92d6e0c4e68/sqlcipher/.git' for writing: File exists
4.315 fatal: clone of 'https://github.com/sqlcipher/sqlcipher.git' into submodule path '/project/dist-newstyle/src/direct-sq_-1924b92d6e0c4e68/sqlcipher' failed
4.315 Failed to clone 'sqlcipher'. Retry scheduled
4.315 BUG: submodule considered for cloning, doesn't need cloning any more?
4.316 fatal: could not get a repository handle for submodule 'sqlcipher'
------
Dockerfile:51
--------------------
49 | # Compile simplex-chat
50 | RUN cabal update
51 | >>> RUN cabal build -j exe:simplex-chat
52 |
53 | # Strip the binary from debug symbols to reduce size
--------------------
ERROR: failed to solve: process "/bin/sh -c cabal build -j exe:simplex-chat" did not complete successfully: exit code: 128
|
I can successfully build it. see this : https://github.com/leleliu008/test/actions/runs/10961122341/job/30437305432 but not a fully statically linked executable. It should create fully statically linked executables, but cabal has many bugs, I have not found a workaround. |
simplex-chat/simplex-chat#3942 this PR actually not produce a fully statically linked execvutable, it's actually dynamically linked. |
Hello there! Thanks for pinging me, I've actually forgot that I've created this PR :^)
To my surprise, it works to this day just fine: ❯ git clone https://github.com/simplex-chat/simplex-chat
Cloning into 'simplex-chat'...
remote: Enumerating objects: 95223, done.
remote: Counting objects: 100% (3075/3075), done.
remote: Compressing objects: 100% (1417/1417), done.
remote: Total 95223 (delta 1779), reused 2454 (delta 1282), pack-reused 92148 (from 1)
Receiving objects: 100% (95223/95223), 238.81 MiB | 26.18 MiB/s, done.
Resolving deltas: 100% (60007/60007), done.
❯ cd simplex-chat
apps docs images scripts tests cabal.project flake.lock fourmolu.yaml libsimplex.dll.def package.yaml README.md
blog fastlane packages src website Dockerfile flake.nix install.sh LICENSE PRIVACY.md simplex-chat.cabal
❯ git checkout master
branch 'master' set up to track 'origin/master'.
Switched to a new branch 'master'
❯ curl -LO 'https://raw.githubusercontent.com/simplex-chat/simplex-chat/2abee7edf8cd1c975c9336aa7885f6f818b88d7e/Dockerfile'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1720 100 1720 0 0 4249 0 --:--:-- --:--:-- --:--:-- 4246
❯ DOCKER_BUILDKIT=1 docker build --output . .
[+] Building 1212.2s (19/19) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.76kB 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [build-stage 1/13] FROM docker.io/library/alpine:latest 0.0s
=> [internal] load build context 0.8s
=> => transferring context: 400.25MB 0.8s
=> [build-stage 2/13] RUN apk add --no-cache curl git xz grep ghc-dev gmp-dev zlib-static zlib-dev o 20.1s
=> [build-stage 3/13] RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh 61.6s
=> [build-stage 4/13] RUN ghcup set ghc "9.6.3" && ghcup set cabal "3.10.1.0" 0.3s
=> [build-stage 5/13] RUN cabal install --install-method=copy --installdir=/usr/local/bin hpack-0.36.0 278.8s
=> [build-stage 6/13] COPY . /project 0.6s
=> [build-stage 7/13] WORKDIR /project 0.0s
=> [build-stage 8/13] RUN cp ./scripts/cabal.project.local.linux ./cabal.project.local 0.1s
=> [build-stage 9/13] RUN sed -i /- -Wunused-type-patterns/a\ - -O2\n\ - -split-sections\n\ - -with-rtsopts=-N\n\ - -static\n\cc-opt 0.1s
=> [build-stage 10/13] RUN hpack 0.2s
=> [build-stage 11/13] RUN cabal update 23.2s
=> [build-stage 12/13] RUN cabal build -j exe:simplex-chat 826.3s
=> [build-stage 13/13] RUN bin=$(find /project/dist-newstyle -name "simplex-chat" -type f -executable) && mv "$bin" ./ && strip ./ 0.5s
=> [export-stage 1/1] COPY --from=build-stage /project/simplex-chat / 0.1s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:72a0aa4d9ab5dd2d330d4fe9a84147af519a11749104dbab8fb0fd802c4b2344 0.0s
=> exporting to client directory 0.1s
=> => copying files 82.47MB 0.1s Not sure what's the issue you're getting
Nope, it does produce the static executable (at least on Running from ❯ ldd simplex-chat
/lib/ld-musl-x86_64.so.1: simplex-chat: Not a valid dynamic program
❯ ./simplex-chat -v
SimpleX Chat v6.1.0.3
To update run: curl -o- https://raw.githubusercontent.com/simplex-chat/simplex-chat/master/install.sh | bash Running from [sh ~]$ ldd ./simplex-chat
not a dynamic executable
[sh ~]$ ./simplex-chat -v
SimpleX Chat v6.1.0.3
To update run: curl -o- https://raw.githubusercontent.com/simplex-chat/simplex-chat/master/install.sh | bash |
many options specified via This works now: https://github.com/leleliu008/test/actions/runs/10963768364/job/30445930259 |
Thank you, @leleliu008, for figuring it out. Any ETA when the formula/simplex-chat.yml be updated with these changes so it builds? @AlbydST @shumvgolove
All of these are unresolved, so I had rather wait for the official maintainers themselves to say (preferably do) something about it. So for now, I think the best compromise is to just add the staticx version, which is pulled straight from official releases
If you would like to reproduce that, here's how: !#This is copy-pasted from a build-recipe, So please remove sections not relevant to your setup.
#Build (debian-glibc)
pushd "$($TMPDIRS)" >/dev/null 2>&1
docker stop "debian-builder-unstable" 2>/dev/null ; docker rm "debian-builder-unstable" 2>/dev/null
docker run --privileged --net="host" --name "debian-builder-unstable" "azathothas/debian-builder-unstable:latest" \
bash -l -c '
#Setup ENV
mkdir -p "/build-bins" && pushd "$(mktemp -d)" >/dev/null 2>&1
sudo apt-get update -y -qq
sudo apt-get install -y -qq libpcre3 libgmp3-dev xdg-utils zlib1g-dev
sudo apt-get update -y -qq
#Fetch
eget "https://github.com/simplex-chat/simplex-chat" --asset "chat" --asset "ubuntu-22_04" --asset "x86_64" --asset "^desktop" --asset "^deb" --to "./simplex-chat"
staticx --loglevel DEBUG "./simplex-chat" --strip "/build-bins/simplex-chat"
#strip & info
objcopy --remove-section=".comment" --remove-section=".note.*" "/build-bins/simplex-chat"
strip --strip-debug --strip-dwo --strip-unneeded -R ".comment" -R ".gnu.version" "/build-bins/simplex-chat"
file "/build-bins/simplex-chat" && du -sh "/build-bins/simplex-chat"
popd >/dev/null 2>&1
'
#Copy & Meta
docker cp "debian-builder-unstable:/build-bins/." "$(pwd)/"
find "." -maxdepth 1 -type f -exec file -i "{}" \; | grep "application/.*executable" | cut -d":" -f1 | xargs realpath
#Meta
find "." -maxdepth 1 -type f -exec sh -c 'file "{}"; du -sh "{}"' \;
sudo rsync -av --copy-links --exclude="*/" "./." "$BINDIR"
#Delete Containers
docker stop "debian-builder-unstable" 2>/dev/null ; docker rm "debian-builder-unstable"
popd >/dev/null 2>&1
The tldr is, I would need a script that can build simplex-chat cli reliably, without too many patches and that's guaranteed not to break with updates. |
this line is the most important patch, it modify the |
Wow @leleliu008, you always deliver :) |
Repository
https://github.com/simplex-chat/simplex-chat
Description
The first messaging network operating without user identifiers of any kind (See also the CLI version).
Binary Releases?
Yes, available here.
Needs to be compiled?
Yes, releases are dynamic.
Compilation Instructions:
Can be compiled statically as seen here.
Analysis of official binary:
(Tested with versions v6.0.4 and v6.1.0-beta.0)
The text was updated successfully, but these errors were encountered: