From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12122 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Linux headers for musl (was: Compiling libpcap from source using musl and clang) Date: Thu, 23 Nov 2017 12:02:53 +0100 Message-ID: <20171123110252.GG15263@port70.net> References: <20171120193126.GK1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1511435020 22255 195.159.176.226 (23 Nov 2017 11:03:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Nov 2017 11:03:40 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) To: musl@lists.openwall.com Original-X-From: musl-return-12138-gllmg-musl=m.gmane.org@lists.openwall.com Thu Nov 23 12:03:29 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eHpI0-000587-J3 for gllmg-musl@m.gmane.org; Thu, 23 Nov 2017 12:03:28 +0100 Original-Received: (qmail 3425 invoked by uid 550); 23 Nov 2017 11:03:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3365 invoked from network); 23 Nov 2017 11:03:20 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:12122 Archived-At: * Assaf Gordon [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)