Download :
: https://www.myqnap.org/product/musl-framework/
install on your NAS the MUSL Cross toolchain built with crosstool-ng
on x86_64 NAS, it modify .profile of your /root (admin session in SSH) and export necessary FLAG to compileit allow to compile directly on your NAS with GCC 9.3 (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
Code: Select all
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
exemple for openssl $PREFIX location should be exported first (location where source will compiled)
Code: Select all
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
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-dRk ... z2_e-F9m4
next create in root a .bash_profile with inside
Code: Select all
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
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