knock
knock copied to clipboard
Multi system
Multi-System support (linux & mac for now).
I needed to change out the get_mac_address
in gourou/src/device.cpp
. With a little bit more time one could make it platform-independent and open a PR on gourou
(it should work cross-platform but I didn't guard the includes yet).
I couldn't test it on non-aarch64
linux yet. I tested it with arm64-darwin
, x86_64-darwin
& aarch64-linux
.
pkgsStatic
doesn't work on darwin
as expected and still builds the dependencies dynamically.
This means that we'd need to bundle everything together to provide a downloadable release. Some of them should be on the system by default, but at least on my system it doesn't find libs like libunistring
when I remove it from nix-store.
The libraries in question are:
➤ otool -L result/bin/knock
result/bin/knock:
/nix/store/<...>/lib/libnghttp2.14.dylib (compatibility version 36.0.0, current version 36.2.0)
/nix/store/<...>/lib/libidn2.0.dylib (compatibility version 4.0.0, current version 4.7.0)
/nix/store/<...>/lib/libunistring.2.dylib (compatibility version 5.0.0, current version 5.0.0)
/nix/store/<...>/lib/libssh2.1.dylib (compatibility version 2.0.0, current version 2.1.0)
/nix/store/<...>/lib/libzstd.1.5.2.dylib (compatibility version 1.0.0, current version 1.5.2)
/nix/store/<...>/lib/libz.dylib (compatibility version 1.0.0, current version 1.2.12)
/nix/store/<...>/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/nix/store/<...>/lib/libcurl.4.dylib (compatibility version 13.0.0, current version 13.0.0)
/nix/store/<...>/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/nix/store/<...>/lib/libc++.1.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
(Also this was my first ever touchpoint with anything nix
and I may have fallen down a rabbit-hole here, so thanks for that I guess 😃)
Awesome, sounds great. I've been a bit busy past couple days, I'll look through this tomorrow. Thanks a ton
Out of curiosity what did you test
aarch64-linux
on?
I tested it on my arm64 mac via https://multipass.run
Regarding dynamically linking non-system libs, I'll read around and see if they publish a set of guaranteed system libs, then maybe we can static link everything else? Other option is
nix bundle
, but back when I distributedx86_64-linux
like that it resulted in a variety of issues, so probably not a good option. Otherwise if.dylib
s are looked for in.
by default we could ship a folder full of the.dylib
s and the executable. Regardless I won't let this block this PR.
yeah, I thought about copying the .dylib
s to the output, but we'd have to relink them (or compile with the .dylib
s already in place).
I'll also try to statically link the other non-system libs.
#59 and #48 could maybe be solved by either adding the systems to the systems
list in line 27 or just use allSystems
to begin with. I just can't test it here atm.
Hi, the build fails after applying this patch (nix build
):
error: getting status of '/nix/store/c9sydphv4djcbj9phbizpdrakmdh9sv5-source/patches': No such file or directory
… while evaluating the attribute 'patches' of the derivation 'gourou-x86_64-unknown-linux-musl'
at /nix/store/8mik2m5inkjin29v5gv5zc2jji4lab3l-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating the attribute 'buildPhase' of the derivation 'knock-x86_64-unknown-linux-musl'
at /nix/store/8mik2m5inkjin29v5gv5zc2jji4lab3l-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
Do I need to manually apply the patch inside patches/
?
Hi, the build fails after applying this patch (
nix build
):error: getting status of '/nix/store/c9sydphv4djcbj9phbizpdrakmdh9sv5-source/patches': No such file or directory [...]
Do I need to manually apply the patch inside
patches/
?
did you checkout the branch or just download the sources? Seems like nix
doesn't copy the patch which it won't when it's not tracked by git
.
Oh that's weird. Yes, doing a commit now compiles perfectly! Thank you.
I included static libraries for the darwin build.
The only thing that's left is libcxx
. I didn't have the time to try to resolve that, yet.
➤ otool -L result/bin/knock
result/bin/knock:
/nix/store/1mxqsldzckyjw8a43fbcrkmjd0isc206-libcxx-11.1.0/lib/libc++.1.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)```
@Fabbi awesome news! I was looking into auriamg/macdylibbundler last night and it was having issues (and it would of course be annoying to distribute a folder instead of file), so this is magnificent. I'll wait to merge until libcxx
is good.
@Fabbi in the meantime do you mind making a cut with the aarch64
support that I can merge so we can get RPi's supported in the meantime? I could do it myself but I want to make sure the credit is clear.
That's cool with me. I sadly don't have a lot of time lately so it will be a while till I can finish this
Oh I didn't see this PR, you already generate a patch, feel free to critique mine https://indefero.soutade.fr/p/libgourou/review/7/