[ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

This is the best place for community developers to publish their genius work. Your Apps enrich the QNAP Turbo NAS.
Post Reply
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

[ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by QNAP_Stephane »

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

Download :

: https://www.myqnap.org/product/musl-framework/

install on your NAS the MUSL Cross toolchain built with crosstool-ng
it 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
on x86_64 NAS, it modify .profile of your /root (admin session in SSH) and export necessary FLAG to compile

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
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: 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
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-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
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
Last edited by QNAP_Stephane on Thu Dec 08, 2022 1:09 am, edited 2 times in total.
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [ MUSL ToolChain/Framework ] [ 9.3 formely 1.2.1 ] Add MUSL Cross tools & Framework

Post by OneCD »

Hi Stephane, can you please confirm the internal package name for this one? Is it 'MUSL_CROSS' ?

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

Re: [ MUSL ToolChain/Framework ] [ 9.3 formely 1.2.1 ] Add MUSL Cross tools & Framework

Post by QNAP_Stephane »

OneCD wrote: Fri Jun 04, 2021 3:11 am Hi Stephane, can you please confirm the internal package name for this one? Is it 'MUSL_CROSS' ?
Hello , yes exactly
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [ MUSL ToolChain/Framework ] [ 9.3 formely 1.2.1 ] Add MUSL Cross tools & Framework

Post by OneCD »

Cheers mate. :)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by QNAP_Stephane »

updated to 11.1

Code: Select all

GCC 11.1
MUSL Core to 1.2.2
fixed for ARMv7 (wrong symlinking)
updated to latest libs, headers and companion tool
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
andgiamp
New here
Posts: 2
Joined: Wed Mar 10, 2021 5:27 am

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by andgiamp »

Just a question, is it possible to install this framework on my TS-230 with AMD64 processor?
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by QNAP_Stephane »

yes you can... but only aarch64 binaries could be launched
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
andgiamp
New here
Posts: 2
Joined: Wed Mar 10, 2021 5:27 am

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by andgiamp »

Thx a lot for the reply.

is there somewhere a step by step guide to install the binaries?

Thx a lot
jallen1227
First post
Posts: 1
Joined: Fri Apr 29, 2016 6:53 am

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by jallen1227 »

Hi Stephanie, thanks.
Good at following instructions typically but bit challenged here on the description.

Based upon your message above from Sun Apr 04, 2021 3:02 am, sounds like no additional work is necessary from the user with you describing everything you completed as part of the MUSL coding and changes made during the install process.

Just wanting to confirm as I am trying to get MPD working on my QNAP.

Thanks,
Jeff
lollodragon
New here
Posts: 4
Joined: Sat Mar 30, 2013 9:31 pm

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by lollodragon »

QNAP_Stephane wrote: Sun Apr 04, 2021 6:02 pm source : https://wiki.musl-libc.org

Download :

https://www.qnapclub.eu/fr/qpkg/1098

I'm sorry but the download page doesn't work. Can somebody check the url? Than you!!!
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

Re: [ MUSL ToolChain/Framework ] [ 11.1 formely 1.2.2 ] Add MUSL Cross tools & Framework

Post by QNAP_Stephane »

---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
Post Reply

Return to “Community Apps”