MacPorts and clang

Ryan Schmidt ryandesign at
Thu Mar 3 08:22:55 PST 2011

On Mar 3, 2011, at 10:19, Jack Howarth wrote:

> On Thu, Mar 03, 2011 at 09:48:40AM -0600, Ryan Schmidt wrote:
>> On Mar 3, 2011, at 09:40, Jack Howarth wrote:
>>> Are there any plans to attempt to move MacPorts towards
>>> building with clang once Xcode 4 is released? Considering that
>>> we have so many packages supporting gcc4x variants to build with
>>> FSF gcc, it seems strange not to do the same for clang.
>>>            Jack
>>> ps I assume that Xcode 4 won't be held up until Lion is released so
>>> these clang variants could be first done on Snow Leopard. It is unclear
>>> from
>>> if the clang c++ support in Xcode 4.0 will use the existing libstdc++
>>> or the new libc++ instead. It would be nice if it were the latter.
>> Ports build with the standard Xcode gcc compilers unless there is a good reason not to. The reason why many ports have variants to use MacPorts gcc compilers is not because they particularly want to use the MacPorts gcc C or C++ compilers, but because they want to use a Fortran compiler, which Xcode doesn't provide.
>   That wasn't my experience. When I contributed the pymol packaging, some of the other MacPorts
> developers insisted on gcc4x variants despite the fact that pymol doesn't contain any fortran code.
> A clang variant still might be a nice idea to provide a test bed for finding out which packages have
> build issues and for filing reports or sending patches upstream. It is unclear from the published
> information on Lion what Apple's intentions are for clang/libc++ but I am hoping they might be 
> aggressive and, while building Lion with gcc-4.2, configure the standard system compilers to clang.
> I believe we saw this done earlier in Mac OS X development (perhaps the gcc-3.3 to gcc-4.0
> transition) where the Xcode defaulted to a newer gcc than was actually used to build the matching
> OS release.

The other reason some ports have gcc variants is because there is a desire to compile all related programs and libraries using the same compiler, to avoid hard-to-diagnose problems. So if a port uses a gcc variant in order to use a fortran compiler, it's possible everything depending on that port for its libraries will also need to use the same gcc compiler, regardless whether it itself uses fortran.

More information about the macports-dev mailing list