[LLVMdev] CMake, compiler-rt, and MacOS

Erik Verbruggen erik.verbruggen at me.com
Thu Feb 7 13:08:10 PST 2013


On Feb 5, 2013, at 15:14, Alexey Samsonov <samsonov at google.com> wrote:

> 
> On Tue, Feb 5, 2013 at 12:38 PM, Kostya Serebryany <kcc at google.com> wrote:
> +samsonov, glider
> 
> 
> On Tue, Feb 5, 2013 at 12:16 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Mon, Feb 4, 2013 at 6:21 AM, Erik Verbruggen <erik.verbruggen at me.com> wrote:
> Hi Chandler,
> 
> If I remember correctly, you are the de-facto maintainer for the CMake-built-mainainer, so..:
> 
> Sure, but I'm often busy. You're better off using the development mailing list for questions such as this, and I've moved the conversation there.
>  
> I have a problem compiling compiler-rt on MacOS with libc++. For this to work, the flag -mmacosx-version-min=10.7 is required, so I use:
> CMAKE_CXX_FLAGS:STRING=-mmacosx-version-min=10.7 -stdlib=libc++
> 
> However, around line 140, the CMakeLists.txt of compiler-rt contains:
> if(APPLE)
>   list(APPEND SANITIZER_COMMON_CFLAGS -mmacosx-version-min=10.5)
> endif()
> 
> Now, when building with clang, the minimal minimal version is used, so 10.5, which results in a compiler error complaining that the minimal version should be 10.7.
> 
> My question: could you please add some CMake logic to the compiler-rt CMakeLists.txt to check if there is already a macosx-version-min flag set, or to not include the flag if -stdlib=libc++ is set?
> 
> Hi Erik,
> IIRC, using -stdlib=libc++ on Mac should also require presence of flag -mmacosx-version-min? If that's the case, then probably we can put the logic
> of determining the set of flags required for libc++ into CMake build rules and use CMake variable like COMPILER_RT_USES_LIBCXX. Does the attached
> patch solve a problem for you? If you're building LLVM/Clang tree, however, we may want to hoist this to smth. like LLVM_USES_LIBCXX.

Yes, that works, when I (manually) set the COMPILER_RT_USES_LIBCXX flag. I was wondering if that flag could actually be set when detecting the -stdlib=libc++ flag...

-- Erik.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130207/394d2fb6/attachment.html>


More information about the llvm-dev mailing list