Opened 11 years ago

Closed 10 years ago

#24112 closed enhancement (fixed)

Add clang, checker and lto to llvm

Reported by: macports@… Owned by: erickt@…
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: haspatch Cc: ryandesign (Ryan Schmidt), bgrupe27, raimue (Rainer Müller)
Port: llvm


The attached patches add a macports-clang option to portconfigure.tcl and introduce clang, checker, and lto as variants to llvm.

The lto variant is a workaround for missing link time optimization support in odcctools. This workaround enables -flto and -O4 in clang and in the llvm-gcc42 port on darwin9 and darwin10. See #19679 and #23580 for a discussion of this issue.

I'd continue to maintain this port.

Attachments (2)

portconfigure.tcl.diff (1.1 KB) - added by macports@… 11 years ago.
Portfile.diff (4.8 KB) - added by macports@… 11 years ago.

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by macports@…

Attachment: portconfigure.tcl.diff added

Changed 11 years ago by macports@…

Attachment: Portfile.diff added

comment:1 Changed 11 years ago by mf2k (Frank Schima)

Cc: erickt@… removed
Keywords: haspatch added; llvm lto clang checker removed
Owner: changed from macports-tickets@… to erickt@…

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

Cc: ryandesign@… added

I'm a little concerned about the lto variant you added, which installs a file outside the destroot, thus violating the mtree. If this is the best way to do it, then at least "destroot.violate_mtree yes" should be used in the variant.

Since this patch changes what files the port installs (since it adds clang and checker variants and makes them default variants), the port revision should be increased.

Doesn't your patch unfix #15726?

comment:3 Changed 11 years ago by macports@…

I have changed this port quite a bit since I first submitted these patches. The version/revision was upgraded to 2.7_0. The clang and checker variants were moved to a standalone clang port. The lto variant was deleted and instead compilers now have to depend on a new standalone port of ld64, which in turn depends on llvm, to get support for LTO. This seems to be the cleanest solution. See #23580 for more information. No files are installed outside of destroot using this approach.

The latest versions of these ports can be found at This is a subversion repo which can be added to sources.conf.

I didnt know about #15726. Interesting. I do see two .dir files in subdirectories of ${destroot}/lib/llvm/obj. But I dont see how this could be problematic. Of course I can restore the removal these files. Although I wonder if it would be better to just remove the obj directory entirely and instead rebuild llvm inside llvm-gcc42.

comment:4 Changed 11 years ago by macports@…

All ".dir" files get removed now. Additionally a fix for #24807 is included. And I decided to make llvm-mc accessible in ${prefix}/bin. My patchset has grown considerably, so I dont create diffs anymore. The latest version is available from

comment:5 Changed 11 years ago by macports@…

The repository at now includes fixes for #20889, #16367, #19262, #19679, #20890, #24046, #24112, #24807, #24978, #21059. Some notable enhancements are LTO, ld64, clang, clang++, clang-analyzer, llvm-mc, llvm-gfortran, a libgcc_s variant, and version 2.7 of all llvm components. Additionally the following reports dont seem to apply anymore: #15496, #19087, #20453, #21174, #23580. This should close all tickets related to llvm.

Here is a short guide how to use as an external repo (assuming you installed macports in /opt/local, which is the default):

comment:6 Changed 11 years ago by bgrupe27

Cc: bgrupe@… added

Cc Me!

comment:7 Changed 11 years ago by raimue (Rainer Müller)

Cc: raimue@… added

Cc Me!

comment:8 Changed 10 years ago by mfeiri

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.