Created
August 22, 2025 18:17
-
-
Save Wowfunhappy/bd30a96f267d5458bb4b26d2ac342513 to your computer and use it in GitHub Desktop.
macports-libcxx + llvm 18 (on Mavericks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Updates macports-libcxx to to support C++20. | |
| diff --git a/lang/macports-libcxx/Portfile b/lang/macports-libcxx/Portfile | |
| index 2648853..f152a2a 100644 | |
| --- a/lang/macports-libcxx/Portfile | |
| +++ b/lang/macports-libcxx/Portfile | |
| @@ -16,10 +16,10 @@ long_description This port installs a recent libc++ from llvm \ | |
| # for now, we will leverage the already-built libc++ in the appropriate clang port | |
| # later, we can build this independently if we choose to do so, much like libtapi | |
| -# the clang-11 version in use when this port is updated will be used | |
| -version 11.1.0 | |
| -set clangversion 11 | |
| -revision 0 | |
| +# the clang-18 version in use when this port is updated will be used | |
| +version 18.1.8 | |
| +set clangversion 18 | |
| +revision 1 | |
| depends_build port:clang-${clangversion} | |
| @@ -48,28 +48,30 @@ variant universal {} | |
| destroot { | |
| xinstall -d ${destroot}${prefix}/include/libcxx | |
| - copy ${prefix}/libexec/llvm-${clangversion}/lib/c++/v1 ${destroot}${prefix}/include/libcxx/ | |
| + copy ${prefix}/libexec/llvm-${clangversion}/include/c++/v1 ${destroot}${prefix}/include/libcxx/ | |
| # disable Apple libc++ availability tests, as we're using a new libc++ with these headers | |
| system -W ${destroot}${prefix}/include/libcxx/v1 "patch -p0 < ${filespath}/patch-disable-availabilty.diff" | |
| xinstall -d ${destroot}${prefix}/lib/libcxx | |
| - copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++.1.0.dylib ${destroot}${prefix}/lib/libcxx/libc++.1.0.dylib | |
| + copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++/libc++.1.0.dylib ${destroot}${prefix}/lib/libcxx/libc++.1.0.dylib | |
| system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -id ${prefix}/lib/libcxx/libc++.1.0.dylib libc++.1.0.dylib" | |
| - system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -delete_rpath @loader_path/../lib libc++.1.0.dylib" | |
| + # LLVM 18's libc++ may not have rpaths to delete | |
| + catch {system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -delete_rpath @loader_path/../lib libc++.1.0.dylib"} | |
| system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -change @rpath/libc++abi.1.dylib ${prefix}/lib/libcxx/libc++abi.1.dylib libc++.1.0.dylib" | |
| system -W ${destroot}${prefix}/lib/libcxx/ "ln -s libc++.1.0.dylib libc++.1.dylib" | |
| system -W ${destroot}${prefix}/lib/libcxx/ "ln -s libc++.1.dylib libc++.dylib" | |
| - copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++abi.1.0.dylib ${destroot}${prefix}/lib/libcxx/libc++abi.1.0.dylib | |
| + copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++/libc++abi.1.0.dylib ${destroot}${prefix}/lib/libcxx/libc++abi.1.0.dylib | |
| system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -id ${prefix}/lib/libcxx/libc++abi.1.0.dylib libc++abi.1.0.dylib" | |
| - system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -delete_rpath @loader_path/../lib libc++abi.1.0.dylib" | |
| + # LLVM 18's libc++abi may not have rpaths to delete | |
| + catch {system -W ${destroot}${prefix}/lib/libcxx/ "install_name_tool -delete_rpath @loader_path/../lib libc++abi.1.0.dylib"} | |
| system -W ${destroot}${prefix}/lib/libcxx/ "ln -s libc++abi.1.0.dylib libc++abi.1.dylib" | |
| system -W ${destroot}${prefix}/lib/libcxx/ "ln -s libc++abi.1.dylib libc++abi.dylib" | |
| - copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++.a ${destroot}${prefix}/lib/libcxx/libc++.a | |
| - copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++abi.a ${destroot}${prefix}/lib/libcxx/libc++abi.a | |
| - copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++experimental.a ${destroot}${prefix}/lib/libcxx/libc++experimental.a | |
| + copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++/libc++.a ${destroot}${prefix}/lib/libcxx/libc++.a | |
| + copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++/libc++abi.a ${destroot}${prefix}/lib/libcxx/libc++abi.a | |
| + copy ${prefix}/libexec/llvm-${clangversion}/lib/libc++/libc++experimental.a ${destroot}${prefix}/lib/libcxx/libc++experimental.a | |
| } | |
Author
@Wowfunhappy in that Node.js build script, I see a reference to libc++ located in /opt/local/libexec/*, so everything ran without errors.
There's I see that files are being copied to /opt/local/lib/*, and because of the dependency on libunwind.1.dylib, the libc++ library cannot be used in a location other than the default one (I tried removing it, but that didn't help).
I'm asking because this issue has left me stuck using LLVM 16 in macports-libcxx, but I can't build Ladybug without libc++ from LLVM 18.
Author
@aeiouaeiouaeiouaeiouaeiouaeiou Sorry, I don't know!
Author
@aeiouaeiouaeiouaeiouaeiouaeiou Also, it looks like you're on 10.8? I'm on 10.9.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@aeiouaeiouaeiouaeiouaeiouaeiou No, I think I must have never run into that? But I only used this to build https://github.com/Wowfunhappy/Node-24-Mavericks, in a virtual machine that I did not use for anything else, so not very much of the MacPorts ecosystem was exercised.