Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171123110252.GG15263@port70.net>
Date: Thu, 23 Nov 2017 12:02:53 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Linux headers for musl (was: Compiling libpcap from
 source using musl and clang)

* Assaf Gordon <assafgordon@...il.com> [2017-11-23 01:03:21 -0700]:
> On 2017-11-20 12:31 PM, Rich Felker wrote:
> > On Mon, Nov 20, 2017 at 02:02:43PM -0500, Hamed Ghavamnia wrote:
> > > [...]
> > > The problem I'm currently facing is that the source codes require header
> > > files such as linux/types.h, but there isn't any linux sub folder in the
> > > include folder of my compiled musl library.
> >
> > [...] Otherwise you can install them yourself from the
> > kernel sources or if you're using compiler wrappers on a glibc-based
> > system you can make symlinks to the copies of the Linux headers in the
> > glibc include dir (/usr/include/linux, etc.).
> 
> I encountered a similar issue when building libreSSL with musl
> (on standard ubuntu 16.04 x86_64 machine).
> 
> The solution I've found is:
> 
>      apt-get install -y linux-libc-dev
>      ln -s /usr/include/linux            $MUSLROOT/include
>      ln -s /usr/include/asm-generic      $MUSLROOT/include
>      ln -s /usr/include/x86_64-linux-gnu $MUSLROOT/include
> 
...
> My ugly work-around was:
> 
>    cd $muslroot/include
>    ln -s x86_64-linux-gnu/asm asm
> 
> 
> Is this the recommended way?

no, the recommended way is to use a cross toolchain that
is built for musl (and has the linux headers installed),
instead of using your platform toolchain with various hacks
(like the musl-gcc wrapper around gcc)

in case you prefer musl-gcc then you should install your
deps to $MUSLROOT instead of trying to use platform components,
this includes library and header deps as well, so get linux
sources and install the headers yourself

make ARCH=x86 INSTALL_HDR_PATH=staging O=builddir headers_install
cp -a -n staging/include $MUSLROOT
(not tested)

(note that the ubuntu toolchain uses 'multi-arch' layout for
the include and library paths, but musl-gcc drops all platform
specific include paths and uses its own (standard) layout,
so symlinking stuff from ubuntu include path like
'x86_64-linux-gnu' wont work)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.