Naive Mavericks Trunk Build Errors

Hi there.

Building LLVM/Clang trunk on a default Mavericks install – i.e. one with all SDKs packaged within Xcode and no /usr/include – naively seems busted.

After getting the code and configuring for libc++…

$ ../llvm/configure --enable-libcpp --enable-keep-symbols

…the make runs fine until it hits compiler-rt, where the puking on missing <sys> headers begins…

COMPILE: clang_darwin/asan_osx_dynamic/i386: LLVM_PROJECT/llvm/projects/compiler-rt/lib/asan/asan_allocator2.cc
LLVM_PROJECT/build/Debug+Asserts/bin/clang -fno-exceptions -fPIC -funwind-tables -ILLVM_PROJECT/llvm/projects/compiler-rt/lib -ILLVM_PROJECT/llvm/projects/compiler-rt/include -arch i386 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.6 -fno-builtin -gline-tables-only -DMAC_INTERPOSE_FUNCTIONS=1 -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 -c -o LLVM_PROJECT/build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/i386/SubDir.lib__asan/asan_allocator2.o LLVM_PROJECT/llvm/projects/compiler-rt/lib/asan/asan_allocator2.cc
In file included from LLVM_PROJECT/llvm/projects/compiler-rt/lib/asan/asan_allocator2.cc:17:
In file included from LLVM_PROJECT/llvm/projects/compiler-rt/lib/asan/asan_allocator.h:19:
In file included from LLVM_PROJECT/llvm/projects/compiler-rt/lib/asan/asan_interceptors.h:18:
LLVM_PROJECT/llvm/projects/compiler-rt/lib/interception/interception.h:90:10: fatal error:
'sys/cdefs.h' file not found
#include <sys/cdefs.h> // For __DARWIN_ALIAS_C().
1 error generated.
make[5]: *** [LLVM_PROJECT/build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/i386/SubDir.lib__asan/asan_allocator2.o] Error 1
make[4]: *** [BuildRuntimeLibraries] Error 2
make[3]: *** [compiler-rt/.makeall] Error 2
make[2]: *** [all] Error 1
make[1]: *** [clang/.makeall] Error 2
make: *** [all] Error 1

…which, again naively, seems a pretty mess.

Adding “/usr/include” – /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include – unsurprisingly leads to a whole other rabbit hole of conflicts and compile errors, presumably because that’s kinda what we’re trying not to do.

Has anybody actually tried this recently? If so, what’s the n00b in the above breaking the build?

Thanks!

Was it an install or an upgrade? I had this when I had the command line tools package installed, then upgraded, and did an incremental build. Granted, cmake wasn't used, but something more horrible/fragile. Lesson learned: always reinstall the command line tools after an update.

-- Erik

Yeah, I’ve seen this as well now, cc’ing a couple of apple people so they know it happened. You say reinstalling command line support will work?

-eric

Hey guys.

We sure appreciate the responses and diagnosis.

To summarize for future victims…

Some combination of upgrades to OS and Xcode en route to Mavericks GM may leave one sans essentials like /usr/include, which’ll unsurprisingly cause a variety of open source projects, not just LLVM/Clang, to fail with missing headers.

One might even mistakenly take this absence for a “feature” of life literally under the new Xcode.app, but no...

As suggested, the fix is to [download and re]install the command_line_tools_os_x_mavericks_for_xcode__late_october_2013 ADC package.

Thanks!

The command line tools can also be installed from within Xcode, under the Downloads pane in Preferences.

Originally I was going to suggest using the SKDROOT environment variable, but it's possible the lack of a physical /usr/include might still get you in trouble. Downloading the Command Line Tools is the way to get a setup closest to another Unix system.

Sorry for the inconvenience here.
Jordan

The command line tools can also be installed from within Xcode, under the Downloads pane in Preferences.

I think it is no longer possible to do it from Xcode when using Xcode 5 and Maverick. This is due to the new way command line tools works in Maverick.
The base system contains stubs for standard cli and they are mapped to the Xcode buitin tools or to a stand-alone set of command line tools in /Library.
If neither are installed, the system presents a dialog asking if you want to install the command line tools, to download Xcode.

You can open this dialog and so request installation of the command line tools (even if Xcode is already installed) using:

xcode-select --install

Originally I was going to suggest using the SKDROOT environment variable, but it's possible the lack of a physical /usr/include might still get you in trouble. Downloading the Command Line Tools is the way to get a setup closest to another Unix system.

Sorry for the inconvenience here.
Jordan

Hey guys.

We sure appreciate the responses and diagnosis.

To summarize for future victims…

Some combination of upgrades to OS and Xcode en route to Mavericks GM may leave one sans essentials like /usr/include, which’ll unsurprisingly cause a variety of open source projects, not just LLVM/Clang, to fail with missing headers.

One might even mistakenly take this absence for a “feature” of life literally under the new Xcode.app, but no...

As suggested, the fix is to [download and re]install the command_line_tools_os_x_mavericks_for_xcode__late_october_2013 ADC package.

Thanks!
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- Jean-Daniel