inserting -stdlib=libstdc++ into cxxflags
Sergio Had
vital.had at gmail.com
Tue Mar 12 19:44:17 UTC 2024
Which OS are we talking about?
Building against libstdc++ is broken for Intel and arm64, I believe, though it should be fixable. But the problem is not passing the flag, but broken Apple headers, it seems.
I managed to build some ports like CMake and a few others against libstdc++ on Sonoma arm64, but kinda gave up, since too much stuff is broken, and there is no immediate advantage in the switch.
I have this in macports.conf: `cxx_stdlib macports-libstdc++` (on Sonoma). However you may need to pass both cxxflags and ldflags manually.
On PowerPC it is the reverse: building against libstdc++ is the default and works fine, building against libc++ is very experimental and will likely need fixups. Also, it requires enabling stdlib_flag variant for gcc and making it use libcxx-powerpc port instead of clangs.
P. S. There is a bug in gcc13 which prevents it working correctly with libc++ headers (regardless of the arch, I think), should be fixed in upstream but perhaps not in Macports, but gcc12 should be fine.
> On Mar 13, 2024, at 3:32 AM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
>
> Hi,
>
> I've been tinkering a bit with a personal GCC12 build patched to use libc++ by default, and now find myself unable to build against libstdc++.
>
> `configure.cxxflags-append -stdlib=libstdc++` appears to be filtered out somewhere in the "base" bowels, and `configure.cxx_stdlib libstdc++` appears not to have any effect either. I'm not seeing any warnings in the logfile, which is surprising (and rather bad practise IMHO).
>
> What am I missing here, and what backdoor(s) could I use? I notice that CXXFLAGS (aka Env(CXXFLAGS)) isn't yet set in `pre-configure`; I haven't yet checked if "base" preserves its settings when initialising it (have been assuming it won't). With autoconf-based projects one can set `configure.cxx ${configure.cxx} -stdlib=libstdc++` but that doesn't fly for cmake-based projects...
>
> Thanks,
> R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20240313/a902c8fd/attachment-0001.htm>
More information about the macports-dev
mailing list