From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10200 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Issues when building libcxx libcxxabi with MUSL Date: Wed, 22 Jun 2016 15:34:05 -0400 Message-ID: <20160622193404.GT10893@brightrain.aerifal.cx> References: <87e30e04-a81d-4302-5dd7-0846aa0f711b@codeaurora.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1466624076 20994 80.91.229.3 (22 Jun 2016 19:34:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jun 2016 19:34:36 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10213-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jun 22 21:34:21 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bFnul-0004MD-HW for gllmg-musl@m.gmane.org; Wed, 22 Jun 2016 21:34:19 +0200 Original-Received: (qmail 26123 invoked by uid 550); 22 Jun 2016 19:34:17 -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 26099 invoked from network); 22 Jun 2016 19:34:17 -0000 Content-Disposition: inline In-Reply-To: <87e30e04-a81d-4302-5dd7-0846aa0f711b@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10200 Archived-At: On Wed, Jun 22, 2016 at 12:24:17PM -0700, Zhao, Weiming wrote: > Hi, > > I tried to build libcxx/libcxxabi using MUSL. Compiler is clang. > > The build issues I got: > > 1) In libcxx, it complains that some pthread structure is not > completely initialized. > > 2) Some types like max_align_t are already defined in clang's include. > > 3) libcxx can't find it's own math.h > > A patch is attached. Please review if the changes are correct. These are all problems in libcxx, not musl, but since other people are (I think) using it successfully they probably already have patches which are just not upstream. Let's see if someone who has it working can tell you how they did it. > diff --git a/include/math.h b/include/math.h > index 6ac91da..7c7e4aa 100644 > --- a/include/math.h > +++ b/include/math.h > @@ -427,4 +427,8 @@ long double pow10l(long double); > } > #endif > > +#ifdef __cplusplus > +#include_next > +#endif > + This is compiler-specific and certainly does not belong there. > #endif > diff --git a/include/pthread.h b/include/pthread.h > index af70b73..2995846 100644 > --- a/include/pthread.h > +++ b/include/pthread.h > @@ -55,7 +55,7 @@ extern "C" { > #define PTHREAD_PROCESS_SHARED 1 > > > -#define PTHREAD_MUTEX_INITIALIZER {{{0}}} > +#define PTHREAD_MUTEX_INITIALIZER {{{0, 0, 0, 0, 0, 0 }}} Presumably this is just a warning and not an error, and the compiler should be suppressing the warning in macro expansion from a system header. Anyway I'd probably rather change these to something like: #ifdef __cplusplus #define PTHREAD_MUTEX_INITIALIZER {} ... #else #define PTHREAD_MUTEX_INITIALIZER {0} ... #endif if we make any changes. > #define PTHREAD_RWLOCK_INITIALIZER {{{0}}} > #define PTHREAD_COND_INITIALIZER {{{0}}} > #define PTHREAD_ONCE_INIT 0 > diff --git a/tools/mkalltypes.sed b/tools/mkalltypes.sed > index fa15efc..f03f6a4 100644 > --- a/tools/mkalltypes.sed > +++ b/tools/mkalltypes.sed > @@ -1,6 +1,7 @@ > -/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\ > +/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2) \&\& !defined(__CLANG_\U\2\E_DEFINED)\ > typedef \1 \2;\ > #define __DEFINED_\2\ > +#define __CLANG_\U\2\E_DEFINED\ > #endif\ This is a hack to workaround a problem somewhere else. You should not be including any compiler-provided headers that define types covered by the libc headers. Rich