Azathothas / Toolpacks

Official (pkgforge-edge) Repo 📦📀 & The Largest Collection of Pre-Compiled (+ UPXed) Linux Static Binaries (incl. Build Scripts) & Package Manager (rust) :: https://github.com/pkgforge/soar
https://bin.pkgforge.dev/
MIT License
151 stars 16 forks source link

Add lklfuse #25

Closed xplshn closed 2 months ago

xplshn commented 4 months ago

Hi, could you please add LKFUSE, its a rootless solution to mounting filesystems using FUSE, this repo here generates a single static binary of the tool: https://github.com/ading2210/lklfuse-static

Thanks!

Azathothas commented 4 months ago

Did you build it successfully using the instructions from the repo? It failed in mine (I tried both the alpne chroot and docker),

It errors with:

  LINK    /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/tests/net-test
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/cptofs-in.o: in function `main':
/tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/cptofs.c:621:(.text.startup+0x6b): undefined reference to `argp_parse'
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/cptofs.c:623:(.text.startup+0x2cb): undefined reference to `argp_parse'
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/fs2tar-in.o: in function `parse_opt':
/tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/fs2tar.c:72:(.text+0x65): undefined reference to `argp_usage'
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/fs2tar-in.o: in function `main':
/tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/fs2tar.c:348:(.text.startup+0x31): undefined reference to `argp_parse'
collect2: error: ld returned 1 exit status
make: *** [Makefile:100: /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/cptofs] Error 1
make: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make: *** [Makefile:100: /tmp/tmp.pBccvIG5yP/lklfuse-static/linux/tools/lkl/fs2tar] Error 1

provide a reproducible & working build script and I will add it

xplshn commented 4 months ago

Sorry, seems like an issue with the upstream tool, not with the CHROOT/compile script. It refuses to compile manually, and both CLANG and GCC yield syntax errors.

xplshn commented 4 months ago

Seems like it needs:

  1. gawk
  2. bc
  3. glibc, it refuses to compile under musl without using the sed command in the build_lkl.sh

It probably builds just fine under debian...

The steps are, clone the Linux kernel monorepo with --depth 1, head over to ./linux/tools/lkl then run:

make all
mv *.a ./libs
gcc -static -O3 -s -flto lklfuse.c -D_FILE_OFFSET_BITS=64 -Llib -Iinclude -llkl -lfuse -o lklfuse
Azathothas commented 4 months ago

I tried that too yesterday, it was unable to find some static libs it tried to link with (didn't have that issue on alpine since it had all the dependencies)

Test and build it yourself, if it works, attach a working binary. I will then try reproducing it on debian again

Azathothas commented 4 months ago

I have been able to build this successfully on alpine after some more testing. I will close this once the automated build and tests pass

xplshn commented 4 months ago

I tried that too yesterday, it was unable to find some static libs it tried to link with (didn't have that issue on alpine since it had all the dependencies)

Test and build it yourself, if it works, attach a working binary. I will then try reproducing it on debian again

The issue may have been that I never installed the GNU coreutils, I know that the kernel build scripts uses a lot of GNU things

Azathothas commented 4 months ago

The author refused to add arm64 builds or even do weekly releases: https://github.com/ading2210/shimboot-binaries/issues/1 Regardless, only x86_64 binary is pulled straight from his repo, but I will remove this dependency once I have some time and compile it myself. Keeping this issue open to remind myself.

Azathothas commented 2 months ago

https://github.com/leleliu008/ppkg-formula-repository-official-core/blob/master/formula/linux/lklfuse.yml exists but:

ppkg install "lklfuse" --profile="release" -j "$(($(nproc)+1))" --static

#
  AR      kernel/trace/built-in.a
  AR      kernel/built-in.a
gmake[2]: *** [/root/.ppkg/run/330/linux-glibc-x86_64/lklfuse/src/Makefile:1917: .] Error 2
gmake[1]: *** [Makefile:234: __sub-make] Error 2
gmake[1]: Leaving directory '/root/.ppkg/run/330/linux-glibc-x86_64/lklfuse/src'
gmake: *** [Makefile:84: /root/.ppkg/run/330/linux-glibc-x86_64/lklfuse/src/tools/lkl/lib/lkl.o] Error 2
gmake: Leaving directory '/root/.ppkg/run/330/linux-glibc-x86_64/lklfuse/src/tools/lkl'
💔  package installation failure: linux-glibc-x86_64/lklfuse, if you want to figure out what had happeded, please change to the working directory: /root/.ppkg/run/330/linux-glibc-x86_64/lklfuse

Perhaps this needs the patch from https://github.com/ading2210/lklfuse-static/blob/master/build_lkl.sh @leleliu008 ?

cd linux/tools/lkl

if [ ! "$(cat include/lkl.h | grep "sys/types.h" )" ]; then
  sed -i '1s/^/#include <sys\/types.h>\n/' include/lkl.h
fi

#disable problematic files - these refuse to compile in alpine 
sed -i '/progs-y += tests\/test-dlmopen/d' Targets
sed -i '/hijack/d' Targets
leleliu008 commented 2 months ago

It seems that there is a problem if you pass --static option when building the liblkl.so, I will dig into it and tell you here if it could be built successfully.

leleliu008 commented 2 months ago

fixed. https://github.com/fpliu1214/ppkg-package-manually-build/actions/runs/10729684839

Azathothas commented 2 months ago

Thanks, I will test and add ppkg build script tmr.

Azathothas commented 2 months ago

It seems like it was a problem with my docker builder. It builds successfully when I switched to alpine:latest https://github.com/Azathothas/Toolpacks/commit/cbd2beecb02c772674e0d7161f1e97b182d0610f

Thank you again!

xplshn commented 2 months ago

Thanks Ajam & leleliu008 for working on this