Opened 3 years ago

Last modified 16 months ago

#56042 new enhancement

Bundle libc++ with MacPorts on 10.6

Reported by: ryandesign (Ryan Schmidt) Owned by:
Priority: Normal Milestone: MacPorts 2.7.0
Component: base Version:
Keywords: snowleopard Cc: mojca (Mojca Miklavec)
Port:

Description

We want to switch the default cxx_stdlib for 10.6-10.8 from libstdc++ to libc++. 10.7 and later ship with libc++, but 10.6 doesn't. Bootstrapping this system to libc++ is complicated by this fact. We might be able to solve a lot of those bootstrapping problems by having MacPorts base install libc++ as well on 10.6 only.

Change History (7)

comment:1 Changed 3 years ago by kencu (Ken)

It might be useful if MacPorts could be instructed to automatically install one or more specified ports when first run after being installed.

On 10.6.8, for example, an automatic binary install of libcxx and the updated default toolchain would go a long way to getting the system in a workable state quickly.

comment:2 Changed 3 years ago by ryandesign (Ryan Schmidt)

Ken, I want to keep this ticket focused on the narrow task of bundling libc++ with MacPorts on 10.6, and not expand it to your proposal of automatically installing ports. Your proposal would only help those MacPorts users who receive binaries. I want to help all users, even those who don't receive binaries (because they use a nonstandard MacPorts prefix, or for whatever other reason.)

libc++ is special in that the libcxx port already installs it directly to /usr and doesn't uninstall it when the port is deactivated. So the user experience would not differ much if we bundled it.

Building libc++ requires clang 3.4, which is a large port with a not insignificant number of dependencies. You'll note from the wiki page that the user must install this port before having changed cxx_stdlib to libc++. (Changing cxx_stdlib first would make the dependencies fail to build since libc++ doesn't exist yet.) Bundling libc++ saves the user from having to install clang 3.4 and all of those dependencies from source. (We wouldn't have binaries available, since our binaries would in future be built for libc++.) In addition, the user must uninstall clang 3.4 and the other dependencies of libcxx after changing cxx_stdlib to libc++. (Granted, the new and improved rev-upgrade in MacPorts 2.5 should handle that.) Bundling libc++ saves us from having to modify the portfiles of clang 3.4 and all of its dependencies so that they use libstdc++ if libc++ is not yet installed. (I suppose we could put that logic into MacPorts base instead: if /usr/lib/libc++.dylib exists, cxx_stdlib defaults to libc++, otherwise it defaults to libstdc++. But bundling it saves us from having to do that.)

Given libc++'s extensive dependencies, we should probably bundle the /opt/local/var/system_roots/libcxx-5.0.1-1.tgz file inside the libcxx-5.0.1_1+universal.darwin_10.i386-x86_64.tbz2 binary built by the buildbot, instead of trying to make libc++ build from source at MacPorts base installation time. The .tgz file doesn't contain any references to the MacPorts prefix so it's not a problem it the user uses a nonstandard prefix.

The installation of libc++ should be done by the Makefile, so that both selfupdate and the macOS Installer package will benefit from it.

comment:3 Changed 3 years ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:4 Changed 3 years ago by mojca (Mojca Miklavec)

Milestone: MacPorts 2.6.0

comment:5 Changed 3 years ago by mojca (Mojca Miklavec)

I don't know if this is actually feasible, but I boldly set the same milestone as for other legacy mac support issues (we can always push it "back to the more distant future").

This seems pretty important to me, even more for 10.5 in fact (I don't know why your ticket only mentions 10.6 unless the idea is to only use gcc there, also for i386), but I don't know what the best way to implement it would be. I asked the exact same question a few years back and remember the answer being "this bootstrapping problem with be solved automatically once we start providing binaries".

Ryan, do you have any suggestions about the best way to do this?

(What I did for my own "bootstrapping-like purposes" was to simply manually fetch libcxx binaries from our packages and manually extracted the contents to /usr/lib.)

comment:6 Changed 3 years ago by ryandesign (Ryan Schmidt)

This ticket is only about bundling libc++ with MacPorts on 10.6. Our current goal is to switch 10.6-10.8 to libc++. This is easy on 10.7-10.8 because they include libc++, and hard on 10.6 because it does not. Bundling libc++ with MacPorts on 10.6 makes it easier.

I have not given specific thought to how it would be accomplished, other than what I've already said above. We could either do it in the Makefile as I suggested above, or we could have separate implementations for the installer pkg and for installing from source.

As far as I remember, libc++ doesn't work as well, or at all without some patching that Ken mentioned somewhere previously, on 10.5. clang doesn't work on 10.5 on PowerPC. I don't know/remember if libc++ can be used with gcc. Since we are not currently planning on switching 10.5 to libc++, we don't need to consider how to do this now.

comment:7 Changed 16 months ago by jmroot (Joshua Root)

Milestone: MacPorts 2.6.0MacPorts 2.7.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.