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

grey artkiver at gmail.com
Fri Apr 4 22:33:10 UTC 2025


I'm not too sure since you didn't specify how legacy for older OS X
systems you are intending?

Since MacPorts deprecated Tiger and we lost kencu earlier this year;
maybe this blog post from Dr. Brian Robert Callahan will be helpful?

https://briancallahan.net/blog/20250329.html

Admittedly, it looks as if he is making use of Tigerbrew
(https://github.com/mistydemeo/tigerbrew) and using GCC not LLVM/Clang
but it's relatively recent and about the best reference I can think of
off the top of my head as far as individuals toiling in similar
realms. I realize it's not really helpful with your specific questions
about static compilation.

Doubtlessly others might have better suggestions.


On Fri, Apr 4, 2025 at 9:51 PM Mojca Miklavec <mojca at macports.org> wrote:
>
> Hi,
>
> I've been using the latest clang++-mp-xx compiler (whatever the latest
> happened to be in a particular year) on 10.6 for ages, in order to
> compile TeX Live for non-macports users.
>
> If I remember correctly, I usually took libc++ from 10.7 SDK in order
> to ensure that the resulting binaries would work out of the box for
> any >= Lion user, and on 10.6 for anyone who happened to have libc++
> installed. Sometimes libc++ got overwritten by MacPorts without me
> noticing, and then some Lions users would complain, I would install an
> old version of libc++ again, and things started working for everyone
> again.
>
> This year I switched to clang 17 and a user of macOS 10.13 started
> complaining about
>
> dyld: Symbol not found: ___emutls_get_address
>   Referenced from: /LocalApps/texlive/bin/x86_64-darwinlegacy/luajithbtex
>   Expected in: /usr/lib/libc++.1.dylib
>
> https://tug.org/pipermail/tlbuild/2025q2/005706.html
>
> An older binary that was compiled last year with an older clang works
> for that user.
>
> I did try to copy Lion's libc++ to /usr/lib again, but this time the
> compilation no longer works:
>
> > /opt/local/bin/clang++-mp-17 a.cpp -o ./a
> dyld: Library not loaded: /usr/lib/libc++.1.dylib
>   Referenced from: /opt/local/libexec/llvm-17/bin/clang++
>   Reason: no suitable image found.  Did find:
>         /usr/lib/libc++.1.dylib: can't map
>         /usr/lib/libc++.1.dylib: can't map
>
> Most likely because libc++ was meant to be modernised in order to be
> able to support newer C++ standards.
>
> https://trac.macports.org/ticket/62426
>
> Ken was hinting that static compilation might be feasible, but I'm
> unable to figure out how exactly.
>
> Does anyone know if compiling on 10.6 for other legacy macOS versions
> is still feasible, and if so, what should I modify?
>
> Thank you very much,
>     Mojca


More information about the macports-dev mailing list