mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Linux headers for musl (was: Compiling libpcap from source using musl and clang)
Date: Thu, 23 Nov 2017 12:02:53 +0100	[thread overview]
Message-ID: <20171123110252.GG15263@port70.net> (raw)
In-Reply-To: <c9827df9-7a96-1440-c2ae-35e1df69617f@gmail.com>

* Assaf Gordon <assafgordon@gmail.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)


      reply	other threads:[~2017-11-23 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 19:02 Compiling libpcap from source using musl and clang Hamed Ghavamnia
2017-11-20 19:31 ` Rich Felker
2017-11-23  8:03   ` Linux headers for musl (was: Compiling libpcap from source using musl and clang) Assaf Gordon
2017-11-23 11:02     ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171123110252.GG15263@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).