[LLVMdev] cmake/ninja build failing

Seth Cantrell seth.cantrell at gmail.com
Tue Feb 11 23:04:07 PST 2014


A couple of llvm sub-projects have been failing to build for me for a while (compiler-rt asan and util/unittests, at least). It turns out to be due to the fact that some paths on my system include spaces and other special characters, but the the build.ninja file was not generated with correctly quoted strings. Specifically I'm on OS X and the command is setting -isysroot to a location inside the Xcode.app, but Xcode is installed at a path which includes spaces and parentheses.

I see the problem in the build.ninja commands, where FLAGS includes the problematic setting of isysroot. The cause seems to come down to the line in the compiler-rt CMakeLists.txt:

>   set(DARWIN_iossim_CFLAGS 
>    -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})

where IOSSIM_SDK_DIR is the path including spaces and parens.

I'm not sure why these flags are finding their way into my build since I'm not doing anything with iOS or the iOS simulator, but DARWIN_iossim_CFLAGS is getting set based on "if(APPLE)", and for some reason the iOS CFLAGS are making their way into the build.ninja file. Simply deleting the cmake commands setting these iOS related variables fixes my build errors but since I don't know why these variables are used on OS X in the first place I can't say if removing them this way is the correct solution, or if maybe the CMakeLists.txt files just needs to properly quote these strings.

Here's my shortened version of that whole `if(APPLE)` block:

> if(APPLE)
>  set(SANITIZER_COMMON_SUPPORTED_DARWIN_OS osx)
> 
>  if(COMPILER_RT_USES_LIBCXX)
>    set(SANITIZER_MIN_OSX_VERSION 10.7)
>  else()
>    set(SANITIZER_MIN_OSX_VERSION 10.6)
>  endif()
>  set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
>  set(DARWIN_osx_LINKFLAGS)
> endif()


So, can anyone who's familiar with CMakeLists.txt comment on the correct way to fix CMakeLists.txt and/or the generated build.ninja?

Thanks,
Seth



More information about the llvm-dev mailing list