libc++ & compiling C++ sources on 10.6 for non-macports users
Mojca Miklavec
mojca at macports.org
Fri Apr 4 21:51:20 UTC 2025
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