
source : https://wiki.musl-libc.org
Download :

MUSL Framework - MyQNAP
MUSL ToolChain/Framework Get rid of the glibc and use Alpine Linux Framework, execute any binary or cross compilation based on Alpine Linux. Add MUSL Cross tools & Framework to have a compatible MUSL ELF on your NAS install on your NAS the MUSL Cross toolchain built with crosstool-ng it allow to...

install on your NAS the MUSL Cross toolchain built with crosstool-ng
it allow to compile directly on your NAS with GCC 11.1 (only on a NAS x86_64 Intel/amd).. other compilaton tools are also embedded (make, autoconf, bison, libtool...)
because musl run under another ELF this package needs to be installed on NAS to execute the cross compiled application
on x86_64 NAS, it modify .profile of your /root (admin session in SSH) and export necessary FLAG to compile
Code:
HOST=x86_64-QNAP_-linux-musl
export HOST
TOOLCHAIN_PATH=/root/x-tools/x86_64-QNAP_-linux-musl
export TOOLCHAIN_PATH
PATH=$PATH:$HOME/bin:${TOOLCHAIN_PATH}/bin:${TOOLCHAIN_PATH}/x86_64-QNAP_-linux-musl/bin
export PATH
call $HOST in your autoconf source will call all necessary toolcahin artefacts
exemple for openssl $PREFIX location should be exported first (location where source will compiled)
Code:
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" \
CFLAGS="-O2 -I${PREFIX}/include" \
CXXFLAGS="-O2 -I${PREFIX}/include" \
LDFLAGS="-L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib -Wl,-rpath,/root/x-tools/x86_64-QNAP_-linux-musl/lib -Wl,-rpath,/root/x-tools/x86_64-QNAP_-linux-musl/x86_64-QNAP_-linux-musl/lib64 -Wl,--dynamic-linker=/root/x-tools/x86_64-QNAP_-linux-musl/x86_64-QNAP_-linux-musl/sysroot/lib/ld-musl-x86_64.so.1" \
CPPLFAGS="-O2 -I${PREFIX}/include" \
FFLAGS="-O2 -I${PREFIX}/include" \
./Configure "-L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib -Wl,-rpath,/root/x-tools/x86_64-QNAP_-linux-musl/lib -Wl,-rpath,/root/x-tools/x86_64-QNAP_-linux-musl/x86_64-QNAP_-linux-musl/lib64 -Wl,--dynamic-linker=/root/x-tools/x86_64-QNAP_-linux-musl/x86_64-QNAP_-linux-musl/sysroot/lib/ld-musl-x86_64.so.1" "-I${PREFIX}/include" --prefix=${PREFIX} --openssldir=/etc/ssl --cross-compile-prefix=${HOST}- enable-tls1_3 shared no-zlib linux-x86_64
make -j$(nproc) && make install
here i added a dynamic linker to be sure source will go pick the right ld location...
NOTE
not sure Compiled on NAS directly is right solution, (should miss many thing) but you can download my MUSL ToolChains on an Ubuntu and extract it in side /root
personnlay i am using an ubuntu LXC x86_64 to do it
https://mega.nz/file/hgBjFAhZ#zU3zg-dRk1UesRwzQw2PlpWZh9djZcVrSWz2_e-F9m4
next create in root a .bash_profile with inside
Code:
HOST=x86_64-QNAP_-linux-musl
export HOST
TOOLCHAIN_PATH=/root/x-tools/x86_64-QNAP_-linux-musl
export TOOLCHAIN_PATH
PATH=$PATH:$HOME/bin:${TOOLCHAIN_PATH}/bin:${TOOLCHAIN_PATH}/x86_64-QNAP_-linux-musl/bin
export PATH
and restart your SSH to make change apply to the current session
other toolchain for aarch64 , arm, x86 (32bit intel) are also available you just need modify path to be able to cross compile for this architecture
to run a cross compiled application, MUSL must be installed on host NAS to be able to execute the right ELF