libc++ & compiling C++ sources on 10.6 for non-macports users

Mojca Miklavec mojca at macports.org
Fri Apr 4 23:32:08 UTC 2025


On Sat, 5 Apr 2025 at 00:55, Sergey Fedorov wrote:
>
> If you do not have to build texlive often and have some space on a drive, won’t it be easier to just use a native C++ runtime, libstdc++, for 10.6?

The dependencies require C++17 by now, so gcc 4.2 is not really an option.

It depends what you mean "if you don't build it often". I have an
ancient mac mini set up to work as a CI. So any time someone commits
to the repository, a rebuild is started. That's roughly 500 builds per
year, taking one hour each (M1 needs 14 minutes).

But I don't really care about 10.6 that much. I'm ok if the binaries
only work on 10.7+.

> Of course, that means that you will need two set-ups, for 10.6 builds and 10.7+.

Users would only get one set of binaries anyway, only the mirrors
would have to host 4 sets instead of 3.

> On the other hand, you may try using a set-up which I used on powerpc to build against libc++. Since it works on 10.6 ppc, there are no reasons for it not to work on 10.7+ on Intel. However, that gonna require a custom set-up, obviously.

I don't know what setup you have, but libc++ and powerpc sounds like a
nightmare to set up. (I don't know what is required. When the
requirements switched to C++11 many years ago, I decided to simply
drop support for PPC and i386 as that required too much effort to keep
it working.)


So basically I'm still really asking if anyone happens to know why I'm
now getting "/usr/lib/libc++.1.dylib: can't map", or some idea if
something trivial could be changed.

Meanwhile I figured out that this might work, though I'm not sure what
I'm doing and whether it really generates what I need. And I still
need to test it on a full build:

/opt/local/bin/clang++-mp-17 \
    /opt/local/libexec/llvm-17/lib/libc++/libc++.a \
    /opt/local/libexec/llvm-17/lib/libc++/libc++abi.a \
    -nostdlib++ hello.cpp -o ./hello

Mojca


More information about the macports-dev mailing list