From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12121 Path: news.gmane.org!.POSTED!not-for-mail From: Assaf Gordon Newsgroups: gmane.linux.lib.musl.general Subject: Linux headers for musl (was: Compiling libpcap from source using musl and clang) Date: Thu, 23 Nov 2017 01:03:21 -0700 Message-ID: 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=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1511424222 13953 195.159.176.226 (23 Nov 2017 08:03:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Nov 2017 08:03:42 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 To: musl@lists.openwall.com, Rich Felker Original-X-From: musl-return-12137-gllmg-musl=m.gmane.org@lists.openwall.com Thu Nov 23 09:03:36 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 1eHmTs-00032L-Vj for gllmg-musl@m.gmane.org; Thu, 23 Nov 2017 09:03:33 +0100 Original-Received: (qmail 1509 invoked by uid 550); 23 Nov 2017 08:03:37 -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 1472 invoked from network); 23 Nov 2017 08:03:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=o9j9O4R4vY8L0/XVp+6cwsjNTO7AUXZX1XYpY255E08=; b=glp79nKoyf/qg1Mfup48jkVtGOqS3saKkayyhD1tWHL9lGZ9xgrb0mQhDH9hOg66nk WJMo5DZiazq41ilBDTa5M94SaT1lLnq+3eKtw1cRH4SUT951r1S1lNeJTFEd+oJC9spD Z/bz4bgEP+qmpi90hq5KMCLpQxkfSaRB8glKJgdPpI+/ZOtQExycOr8gODr5AgibwjOp t+vpSURe9Hmd7kvRUR6rIpPiaZQlCAv+SH/1YFkJ/icOfJIURSeUu34aMg9+JimWh3bq PJZgpmLnSr16+q7YzwMqnTJFat1gkjwR44VZkAteJ0m1UbqNWt2TduFFOhGrprNj88Lv YsLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=o9j9O4R4vY8L0/XVp+6cwsjNTO7AUXZX1XYpY255E08=; b=CQcumAJkh1G06jy64DqT5y8UmZm+6n5I5FYX9w9ih3eBTVcbYHO7DY1mFasfJ7ejEB PgZKBxynviYELNcnR4xogadFk7YIM2IPm6pTJwwQ5gI+s1xIqgw9fGO3vr76rH9TTvg/ A2Fb++Ekn2LHyxIFN7P1WwUCT825ozvxgzTvOiIgK8qatH2SAB7j7BqJEE0RrvuTUxuW n3yzKw/TYAMdxhedhsaayc3I3cSfsLX7Z+OKqplz2c3o8H4bJcHfqpgEn25SjeYbDk6t SjS6nuQbsaxen/o8KALUHJCD/M1/cYSM9eRIqc1Rc5cLvwviJhEbDD0FMMvQdIVyxzgJ 4MBw== X-Gm-Message-State: AJaThX6wgbupEzlGgWi00WOksagyL1RsLGstpBw3TNDLmz2qTtbDS57g XC1iSmLBEEtvCCP+XWQrT6s= X-Google-Smtp-Source: AGs4zMbbMGavjudhGZms7SevBx5RRVHSFofLoxy11R+3kH/YcywA97bfOocb1ufJzuTYbJa6shx8lw== X-Received: by 10.107.112.14 with SMTP id l14mr23179774ioc.185.1511424204433; Thu, 23 Nov 2017 00:03:24 -0800 (PST) In-Reply-To: <20171120193126.GK1627@brightrain.aerifal.cx> Content-Language: en-US Xref: news.gmane.org gmane.linux.lib.musl.general:12121 Archived-At: Hello Rich and all, Regarding this: 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 And then there was one more strange issue: Somewhere during compilation of libressl-portable the file is included. With gcc+glibc, this automatically resolves to "/usr/include/x86_64-linux-gnu/asm/types.h". With musl-gcc, it didn't "just work", and adding "-I$MUSLROOT/include/x86_64-linux-gnu" seemed to have made things worse (headers from failed to compile). This issue can be reproduced with: echo "#include " > 1.c Then gcc/clang "just work": $ gcc -E 1.c | head # 1 "1.c" # 1 "" # 1 "" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "" 2 # 1 "1.c" # 1 "/usr/include/x86_64-linux-gnu/asm/types.h" 1 3 4 $ clang -E 1.c | head # 1 "1.c" # 1 "" 1 # 1 "" 3 # 317 "" 3 # 1 "" 1 # 1 "" 2 # 1 "1.c" 2 # 1 "/usr/include/x86_64-linux-gnu/asm/types.h" 1 3 4 While musl does not: $ musl-gcc -E 1.c | head 1.c:1:23: fatal error: asm/types.h: No such file or directory compilation terminated. # 1 "1.c" # 1 "" # 1 "" # 1 "1.c" My ugly work-around was: cd $muslroot/include ln -s x86_64-linux-gnu/asm asm Is this the recommended way? It seemed symlink'ing /usr/include/linux alone was not sufficient. Comments very welcomed, - assaf