Closed cocoon closed 2 weeks ago
Hi @cocoon , Thank you for your interest in my work,
Would be great if you could add: armhf
Do you mean Docker images, binaries or both ?
Just the binaries.
Yes I am interested, and nice to see it directly implemented in Rust 👍 Even better to have both, standalone and integrated, nice work!
I am still playing around, maybe the API Key could be changed like this easily ...
@cocoon a first test https://github.com/sctg-development/sctgdesk-server/actions/runs/11340240075/job/31536320437 is in progress
Great thanks, that was quick. Seems to need some more love to build successfully.
Hi,
I'm currently working on resolving the issue, but there are a few challenges:
rustdesk-server
which does not use tls, this dependency is now resolved.-m64
argument to gcc
. I'm still investigating this.You can follow the progress in the armhf
branch. If you appreciate my work, please consider giving it a star! 🤩
Thanks,
Ronan
I "love" these "hurdles" to get things (cross) compiled 🙄 Tried to get your branch compiled on windows and also failed to make it happy today ^^
Star is done 👍
Update: successfully compiled on windows for windows now
Experimented a bit and might have some progress, but stuck here now: https://github.com/cocoon/sctgdesk-server_armhf/actions/runs/11363684261/job/31608160667#step:9:805
I’ve made some progress. You can check the details here.
I believe I have a solution. It’s currently being tested locally. I managed to solve the issue with QEMU emulating 32-bit platforms on 64-bit hosts. The idea is to force Cargo to use the Git CLI and run from a tmpfs. This workaround is a bit tricky.
Here’s the Dockerfile:
# Set up cargo config to use git tool
# this workaround is needed because QEMU emulating 32 bits platfom on 64 bits host
# see https://github.com/rust-lang/cargo/issues/8719
RUN mv /root/.cargo /tmp && rm -rf /root/.cargo && mkdir -p /root/.cargo
RUN --mount=type=tmpfs,target=/root/.cargo mkdir -p /root/.cargo \
&& cp -av /tmp/.cargo/* /root/.cargo/ && ls -lR /root/.cargo \
&& if [ ! -f /root/.cargo/config.toml ]; then \
echo "" > /root/.cargo/config.toml; \
fi && \
awk 'BEGIN{net_section=0;git_fetch_found=0;printed=0}/^\[net\]/{net_section=1;print;next}/^\[/{if(net_section&&!git_fetch_found){print "git-fetch-with-cli = true";printed=1}net_section=0;print;next}net_section&&/^git-fetch-with-cli\s*=/{print "git-fetch-with-cli = true";git_fetch_found=1;next}{print}END{if(!printed&&!git_fetch_found){if(!net_section)print "\n[net]";print "git-fetch-with-cli = true"}}' /root/.cargo/config.toml > /root/.cargo/config.tmp && \
mv /root/.cargo/config.tmp /root/.cargo/config.toml \
&& . /root/.cargo/env && cd /build \
&& cargo update -p sctgdesk-api-server \
&& DATABASE_URL=sqlite://$(pwd)/db_v2.sqlite3 cargo build --release \
&& mkdir -p /build/ubuntu-jammy/bin \
&& cp /build/target/release/hbbr /build/ubuntu-jammy/bin/ \
&& cp /build/target/release/hbbs /build/ubuntu-jammy/bin/ \
&& cp /build/target/release/rustdesk-utils /build/ubuntu-jammy/bin/
using QEMU sounds clever! Interesting. Just had the same problem that it tried to use "-m64".
My actual process is defined in /.github/workflows/multiarch-docker-hub.yml
.
Building the Multiarch Docker Image:
docker buildx
for platforms linux/arm64
and linux/amd64
, (buildx use QEMU) I create a multiarch Docker image based on Ubuntu 22.04 / Debian Bookworm.sctg/sctgdesk-server-integration
.Extracting Binaries and Debian Packages:
sctg/sctgdesk-server-integration
image and extract the binaries and Debian packages.Currently, the test build for armhf
is in progress locally.
Cross-compiling
The issue you hit is due to rs-cc who invent a -m64 parameter that's why in the armhf branch I tested with llvm.
It works but sqlx is not a pure rust package it relies on libsqlite3 and its C headers. That why my builds fail. It needs to find the crosscompiled libsqlite3
Windows and MacOS The are natively created with a Windows and a macOS runner
@cocoon Good news the integration image was built locally successfully docker.io/sctg/sctgdesk-server-integration:armhf@sha256:794e843bd87922d3d7a3aeea9749f8b01409e17ae2f516e33ad959593c07764b.
Cross fingers https://github.com/sctg-development/sctgdesk-server/actions/runs/11366891675/job/31618301236
@cocoon ,
Good news! The docker buildx method succeeded.
The Docker images are now available for the following platforms: linux/amd64
, linux/arm
, and linux/armhf
. The multi-architecture image is tagged as latest
or 1.1.99-46-armhf
. You can pull it using:
docker pull sctg/sctgdesk-server:1.1.99-46-armhf
The ARM 32-bit binaries have been successfully extracted and are available in the GitHub pre-release named 1.1.99-46-armhf
.
Although this method is slow on GitHub workers (taking around 5h15), I have decided to stop researching cross-compilation for now. If you manage to improve this process, please feel free to submit a PR.
Best,
Ronan
Yay, congratulations, it at least succeded! 🚀 (5h 15m 13s 😆)
But, it doesn't want to run on my device.
Tried these: https://github.com/sctg-development/sctgdesk-server/releases/download/1.1.99-46-armhf/linux-ubuntu-22.04_1.1.99-46-armhf_armhf.zip https://github.com/sctg-development/sctgdesk-server/releases/download/1.1.99-46-armhf/rustdesk-server-hbbr_1.1.99-46-armhf_armhf.deb https://github.com/sctg-development/sctgdesk-server/releases/download/1.1.99-46-armhf/rustdesk-server-hbbs_1.1.99-46-armhf_armhf.deb
In my case I am running it on an OpenWRT ASUS Router AX88U. The official ones are working. So I thought it might not a big problem.
This is what I can see: hbbs = your build _hbbs = official 1.1.2
./hbbs
-sh: ./hbbs: not found
strace ./hbbs
execve("./hbbs", ["./hbbs"], 0x7ffcc71740 /* 19 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
strace ./hbbr
execve("./hbbr", ["./hbbr"], 0x7fe4532410 /* 19 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
strace for offical one:
strace ./_hbbs
execve("./_hbbs", ["./_hbbs"], 0x7ff14d3140 /* 19 vars */ <unfinished ...>
[ Process PID=963 runs in 32 bit mode. ]
strace: WARNING: Proper structure decoding for this personality is not supported, please consider building strace with mpers support enabled.
<... execve resumed>) = 0
mmap2(NULL, 472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf71b1000
set_tls(0xf71b1078) = 0
set_tid_address(0x4e22a8) = 963
...
file hbbr
file: Compiled magic version [544] does not match with shared library magic version [540]
file: could not find any valid magic files! (No such file or directory)
file hbbs
file: Compiled magic version [544] does not match with shared library magic version [540]
file: could not find any valid magic files! (No such file or directory)
But it is the same for the working offical one:
file _hbbs
file: Compiled magic version [544] does not match with shared library magic version [540]
file: could not find any valid magic files! (No such file or directory)
https://github.com/RMerl/asuswrt-merlin.ng/wiki/Compile-Firmware-from-source
Thank you very much for trying, I will see if I can get it running somehow.
Wow, running hbbs+hhbr on a router is quite a challenge!
I’m not very familiar with OpenWrt, but I tested it on a Raspberry Pi with an ARMv7 processor and (I believe) a Debian distribution, and it worked.
file hbbs
file: Compiled magic version does not match with shared library magic version
file: could not find any valid magic files! (No such file or directory)
This indicates that the binary format is correct (so it’s the right 32-bit processor), but it’s not linked with the same shared library. Debian Bookworm and Ubuntu Jammy use GLIBC 2.35.
I have some OpenWrt APs and I checked that OpenWrt 23 is linked to musl version 1.2.4. You might need to modify the Docker buildx process to link against musl.
Alternatively, you could try linking against static musl by adding the musl-dev
apt package and using the armv7-unknown-linux-musleabihf
cargo target.
I have some OpenWrt APs and I checked that OpenWrt 23 is linked to musl version 1.2.4. You might need to modify the Docker buildx process to link against musl.
Alternatively, you could try linking against static musl by adding the musl-dev apt package and using the armv7-unknown-linux-musleabihf cargo target.
Yes something like that, thanks for the hints!
Wow, running hbbs+hhbr on a router is quite a challenge!
Yes, I already max it out with many different stuff, I experimented what I can get running on it without problems.
I have my custom rust processes running on it for some home automation with custom alexa skill, including adb calls to different devices like TVs etc, nanomqtt, working rock solid. First I had been using python, but that was too heavy, that is where I started to port it to rust as a poc and it was just working too great, especially as the build target for these things just worked from Windows (was using Linaro gcc sometimes).
I even had mysql dbs running on it with heavy tuning of the config, but had to manually enable swapping for it onto usb device. I removed that for now. It was working but ...
Does Docker run on OpenWRT? Apart from storage, it has a low CPU overhead. With Docker Compose, it’s very easy to run my server, and it will work since the architecture is compatible.
Does Docker run on OpenWRT?
To be honest, I never thought about it and so have not tried, but I would guess no ... I will check ...
I'm trying a static build with musl:
https://github.com/sctg-development/sctgdesk-server/blob/armhf/Dockerfile-integration
So docker seems to be a no. no entware packages and just others asking for it with no repsonse.
I'm trying a static build with musl
Wonderful, thanks! Will test!
@cocoon
Please try https://github.com/sctg-development/sctgdesk-server/releases/tag/1.1.99-46-musl
It was compiled using musl and it shoud be static.
On my Raspberry pi armh it is reported as not a dynamic executable
so I'm confident…
Ronan
1000% thanks, the new musl builds work like a charm. You were much quicker, I started to install a new fresh Ubuntu VM with docker. Will be nice to have if I need to compile something special like this again 👍
Would be great if you could add: armhf as target to the build artifacts like in the official ones, as I cannot run arm64.
Additionally I found out, that if I use a renamed .exe for the rustdesk-program (official v1.3.1), like:
rustdesk-host=192.168.1.101,key=abcdeFghijK..=.exe
orrustdesk-host=192.168.1.101
The addressbook could not be accessed correctly.
and:
I tried to add api=xyz, but it does not add http:// automatically and these are illegal chars in a filename.
And the offical config string seems to be encrypted with a fixed key, so I see no option here currntly to set it in the filename?
used the current standalone nighlty build on windows:
windows_x86_64_nightly.exe --address 0.0.0.0