building from source with libc++

db iamsudo at gmail.com
Thu Apr 20 14:47:26 UTC 2017


On 20 Apr 2017, at 00:13, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:
> I think the Lion and Mountain Lion LibCxxOnOlderSystems instructions could probably suggest/recommend installing and setting the default compiler to something newer, but I defer to the gurus here.

After skimming the instructions for 10.6, those for 10.8 don't seem consistent.

> clang (macports-installed versions) looks at the build line it’s asked to compile.

> However, if clang doesn’t see -stdlib specified on the build line, as shipped it will automatically add -stdlib=libstdc++ on < 10.9, and -stdlib=libc++ on 10.9+.

Then macports-installed versions could perfectly add -stdlib=libc++ if the system has libc++ installed, as in 10.8 the case is.

> The few times I tried sending -stdlib=libc++ to the system installed clang version when building with xcode on 10.6, it just generated an error saying I had used the wrong stdlib …. so I don’t think you can override that behaviour. I haven’t explored that much.

I occasionally use Xcode directly — what is its default behaviour regarding the default compiler, is something I'd like to know. I see the suffix -3.* overall and no links, so I guess it shouldn't conflict with it.

>> Both 3.8 and 3.9 are at rev 3 but I'd rather assume I could patch llvm portfile manually and use your patch file 999.
> The patch should work just the same unless that one file has been significantly changed (doubt it). If so, the patch phase of the port build will error out.

I checked out bb3b700f76 from macports-ports and then modified the portfile and used your diff, as the current portfile for 3.9 is llvm-3.9 @3.9.1_3, and it's changed.

Both highlight and nmap installed right away.

Only nuisances I found until now are a warning doubly output on each install command

$ sudo port install highlight
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
--->  Computing dependencies for highlight
...

and the following line is added to each port, even those that don't need it

Build Dependencies:   clang-3.9


More information about the macports-users mailing list