mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Reinoud Koornstra <reinoudkoornstra@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: where to find musl-gcc wrapper script
Date: Tue, 18 Jun 2019 13:49:26 -0400	[thread overview]
Message-ID: <20190618174926.GN1506@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAAA5faGt+hSQpMQ2NZ7qTWb5_HrX2U7rTysm=DvrombQ95RsFQ@mail.gmail.com>

On Mon, Jun 17, 2019 at 08:28:12PM -0700, Reinoud Koornstra wrote:
> On Mon, Jun 17, 2019, 7:47 PM Rich Felker <dalias@libc.org> wrote:
> 
> > On Mon, Jun 17, 2019 at 07:30:00PM -0700, Reinoud Koornstra wrote:
> > > Ok the wrapper is included in the musl library itself in the obj
> > directory.
> >
> > Yes, or installed in $prefix/bin if you install. If you don't install
> > it won't be able to find its spec file.
> >
> > > c++ isn't supported yet?
> >
> > Right. Nobody I'm aware of understands the details of this, but
> > apparently either GCC's actual C++ headers or its "precompiled header"
> > versions of them pull in a bunch of stuff from glibc, and then it
> > breaks when you try to reuse them with musl. It's probably not that
> > hard to figure out the root cause and maybe even make it work, but
> > nobody has done it and interest is low because it's still a big hack
> > compared to just building a proper cross toolchain.
> >
> > > Currently I configure with CC=musl-gcc
> > > CFLAGS="-I/home/me/MUSL/include" LDFLAGS="-L/home/me/lib" ./configure
> > > the final g++ comand also add -lrt, need more changes for this to work?
> >
> > If you do that you're compiling against musl's headers but then
> > linking against glibc, which is going to make a huge broken mess.
> 
> Yes, I noticed, so how can I force it to link against musl as well?

You can't, because things already went wrong as soon as you compiled
against glibc's C++ headers using the glibc-based host g++.

> > If you need C++, you really should just build a cross toolchain with
> > musl-cross-make. It's as simple as clining the mcm repo and running
> > "make TARGET=x86_64-linux-musl OUTPUT=/some/dir install" -- it will
> > download, check hashes on, and patch all the components you need and
> > give you a clean self-contained cross toolchain in the OUTPUT dir.
> >
> 
> Also done that, in that case should I just use the compiled gcc as cc?

You can pass the resulting x86_64-linux-musl-gcc and
x86_64-linux-musl-g++ as CC and CXX, but for software using the
standard tuple prefix conventions, you'd tell it you're cross
compiling for x86_64-linux-musl (e.g. by passing
--host=x86_64-linux-musl to configure) and it would automatically pick
them up as long as they're in your PATH (which you probably need to
add them to, e.g. PATH=$PATH:/path/to/mcm/output/bin). This is better
if the software has reason to need to know it's being cross compiled,
or if it uses other utilities like ar, ranlib, direct use of ld, etc.
in the build process, since it will pick up the right ones from the
cross toolchain.

Rich


  reply	other threads:[~2019-06-18 17:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 22:49 Reinoud Koornstra
2019-06-17 23:30 ` Rich Felker
2019-06-18  0:54   ` Reinoud Koornstra
2019-06-18  2:30     ` Reinoud Koornstra
2019-06-18  2:47       ` Rich Felker
2019-06-18  3:28         ` Reinoud Koornstra
2019-06-18 17:49           ` Rich Felker [this message]
2019-06-18 18:27             ` Reinoud Koornstra
2019-06-18 18:43               ` Rich Felker
2019-06-18 21:19                 ` Reinoud Koornstra
2019-06-18 21:37                   ` Rich Felker
2019-06-18 21:49                     ` Reinoud Koornstra
2019-06-18 21:58                       ` Rich Felker
2019-06-18 22:54                         ` Reinoud Koornstra

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=20190618174926.GN1506@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=reinoudkoornstra@gmail.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).