Where does bazel look for OSX SDKs?

944 views
Skip to first unread message

Chet Gnegy

unread,
Jul 7, 2017, 10:49:11 AM7/7/17
to bazel-discuss
I have an objc_library rule that tells me that it can't find this header:
#include <IOKit/IOKitLib.h>

I already have "IOKit" in my sdk_frameworks. If I take a peek in /System/Library/Frameworks/IOKit.framework, I find that there is no directory Headers which would contain this file. Perhaps no surprise if that's where bazel is looking.

If I look a little harder, I find more results for the SDK.
$ find /Applications/Xcode.app/ -name IOKit.framework

/Applications/Xcode.app//Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/System/Library/Frameworks/IOKit.framework

I would think that this is the one I want, since I'm developing for MacOSX.
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/IOKit.framework

Can I tell bazel to use that SDK? Should I have to? How can I figure out where Bazel is looking for these things? I'm not sure how to debug these sorts of bazel issues.

Thanks,
Chet

Chet Gnegy

unread,
Jul 7, 2017, 10:53:39 PM7/7/17
to bazel-discuss
Here's the simplest broken example:

objc_library(
    name = "test",
    srcs = ["test.cpp"],
    copts = [
        "-ObjC++",
        "-std=c++11",
    ],
    sdk_frameworks = ["IOKit"],
)

// test.cpp
#import <IOKit/IOKitLib.h>

Surely I'm just doing something stupid?

Chet Gnegy

unread,
Jul 9, 2017, 12:28:36 AM7/9/17
to bazel-discuss
After a series of unfortunate events, I've reinstalled my OS and I seem to be past this error. 

(I'm getting new ones now, so I guess that's nice.)

Chet Gnegy

unread,
Jul 9, 2017, 12:37:53 AM7/9/17
to bazel-discuss
Nevermind. Still having the issue. In other news, Bazel is giving be a different set of errors during consecutive build attempts without code modification.

Chet Gnegy

unread,
Jul 9, 2017, 10:54:32 PM7/9/17
to bazel-discuss
The --verbose_failures flag is helpful for answering the question "Where does bazel look for my SDKs?". Not clear how to fix it yet when it's wrong.

  (exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=9.2 \
    DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
    SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk \
    XCODE_VERSION_OVERRIDE=7.2.0 \
...

Damien Martin-Guillerez

unread,
Jul 10, 2017, 4:04:21 AM7/10/17
to Chet Gnegy, bazel-discuss, cpar...@google.com, cpe...@google.com
Hi Chet,

I don't know about that but probably +Christopher Parsons or +Cal Peyser should be able to help.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/c14a5f3f-9604-4f97-a9c9-30867ba64ea5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cal Peyser

unread,
Jul 10, 2017, 9:26:48 AM7/10/17
to Damien Martin-Guillerez, Chet Gnegy, bazel-discuss, cpar...@google.com
You can see where the compiler is looking for imports by passing "-v" as an --objccopt: 

cpeyser-macbookpro:objc cpeyser$ bazel build test_m --verbose_failures --objccopt=-v
INFO: Found 1 target...
ERROR: /Users/cpeyser/Desktop/objc/BUILD:11:1: null failed: xcrunwrapper failed: error executing command 
  (exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=10.3 \
    DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
    SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk \
    XCODE_VERSION_OVERRIDE=8.3.0 \
  bazel-out/host/bin/external/bazel_tools/tools/objc/xcrunwrapper clang -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wduplicate-method-match -Wempty-body -Wenum-conversion -Wint-conversion -Wunreachable-code -Wmismatched-return-types -Wundeclared-selector -Wuninitialized -Wunused-function -Wunused-variable -fexceptions -fasm-blocks '-fobjc-abi-version=2' -fobjc-legacy-dispatch -DOS_IOS '-mios-simulator-version-min=7.0' -arch x86_64 -isysroot __BAZEL_XCODE_SDKROOT__ -F __BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F __BAZEL_XCODE_DEVELOPER_DIR__/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -O0 '-DDEBUG=1' -iquote . -iquote bazel-out/darwin_x86_64-fastbuild/genfiles -fobjc-arc -v -ObjC++ '-std=c++11' -c test.m -o bazel-out/darwin_x86_64-fastbuild/bin/_objs/test_m/test.o -MD -MF bazel-out/darwin_x86_64-fastbuild/bin/_objs/test_m/test.d)

Use --sandbox_debug to see verbose messages from the sandbox.
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-ios7.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.m -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 278.4 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /private/var/tmp/_bazel_cpeyser/6743a7f02115e6fa0b7e3ea4c67fe995/bazel-sandbox/6816399471572041978/execroot/objc/bazel-out/darwin_x86_64-fastbuild/bin/_objs/test_m/test.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0 -dependency-file bazel-out/darwin_x86_64-fastbuild/bin/_objs/test_m/test.d -MT bazel-out/darwin_x86_64-fastbuild/bin/_objs/test_m/test.o -sys-header-deps -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -iquote . -iquote bazel-out/darwin_x86_64-fastbuild/genfiles -D OS_IOS -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/System/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -D DEBUG=1 -stdlib=libc++ -O0 -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wduplicate-method-match -Wempty-body -Wenum-conversion -Wint-conversion -Wunreachable-code -Wmismatched-return-types -Wundeclared-selector -Wuninitialized -Wunused-function -Wunused-variable -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /private/var/tmp/_bazel_cpeyser/6743a7f02115e6fa0b7e3ea4c67fe995/bazel-sandbox/6816399471572041978/execroot/objc -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=ios-7.0.0 -fencode-extended-block-signature -fobjc-arc -fobjc-arc-cxxlib=libc++ -fobjc-arc-exceptions -fobjc-exceptions -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fasm-blocks -o bazel-out/darwin_x86_64-fastbuild/bin/_objs/test_m/test.o -x objective-c++ test.m
clang -cc1 version 8.1.0 (clang-802.0.38) default target x86_64-apple-darwin16.6.0
ignoring nonexistent directory "bazel-out/darwin_x86_64-fastbuild/genfiles"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/Library/Frameworks"
ignoring duplicate directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/System/Library/Frameworks"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
 .
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks (framework directory)
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/System/Library/Frameworks (framework directory)
End of search list.
test.m:1:9: fatal error: 'IOKit/IOKitLib.h' file not found
#import <IOKit/IOKitLib.h>
        ^
1 error generated.
Use --strategy=ObjcCompile=standalone to disable sandboxing for the failing actions.
Target //:test_m failed to build
INFO: Elapsed time: 0.292s, Critical Path: 0.19s

It looks like the "SDKs" directory (aka "the sdk root") is being passed correctly as an -isysroot, but specifically for the 10.3 sdk.  The sdk root gets set in Bazel using xcrun:

cpeyser-macbookpro:objc cpeyser$ xcrun --show-sdk-path --sdk iphonesimulator
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk



To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

cpar...@google.com

unread,
Jul 10, 2017, 10:28:56 AM7/10/17
to bazel-discuss
I've alluded to this a little in our separate discussion, but for transparency I'll post it inline on this thread:

The issue you are finding here is most likely because IOKIt is a MacOS-only SDK, and you're building this library for iPhoneSimulator.
(I think the former is the case, anyway. It looks like there is indeed an IOKit.framework directory under iPhoneSimulator9.3.sdk, but it doesn't include headers -- I'm not sure what the point of that is)

Correctly building the library for MacOS is key here and should fix your issues. You can either do that by depending on this library via an apple_binary with platform_type="macos", or you can tailor command line flags to this end. I believe "--apple_platform_type=macos --cpu=darwin_x86_64" should do the trick

Chet Gnegy

unread,
Jul 10, 2017, 11:15:07 AM7/10/17
to cpar...@google.com, bazel-discuss
That seems to get me past my issue and into build problems that don't look to be related to SDK frameworks. Thank you so much!

I'm currently using these flags (bazel 0.5.2). 
--apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all

For your reference, without the last two flags, I get an AssertionError with a stack trace starting in LegacyCompilationSupport. This might not surprise you, but I can open an issue if it does. My guess is that a few versions from now the necessary flags will change, though.

Please add --apple_platform_type, --apple_crosstool_transition, and --experimental_objc_crosstool to https://docs.bazel.build/versions/master/command-line-reference.html when you get a moment. I know that a lot of this apple support is relatively new, but it might save one else looking through hundreds of various flags like I did.

In case anyone is trying to follow my breadcrumbs, my simplest failing example can now find IOKit with these headers, the copts I provided are unnecessary, and test.cpp probably should be called test.mm (though it's not clear that bazel cares about the extension).

--
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/HhAjKblwHwk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/43d77de2-80ac-4c4f-8690-cc2513511471%40googlegroups.com.

Chet Gnegy

unread,
Jul 10, 2017, 11:01:02 PM7/10/17
to Christopher Parsons, bazel-discuss
As long as I've got your attention, is there a trick to suppressing objective c warnings? I've tried putting -Wundeclared-selector and -Wdeprecated-declarations in the copt, in the cxxopt, in the objccopt, and in the build target, but I still get all kinds of warnings about undeclared selectors and deprecated declarations. This is in third party code where actually resolving the issues isn't the solution I'm interested in pursuing. 

Here's the command I'm using and a small excert from the verbose compilation log. I bolded the warnings of interest below. They're being used, they just don't seem to work.

blaze build --apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all ThirdParty/Juce:Juce --objccopt="-Wundeclared-selector -Wdeprecated-declarations -v"

 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name juce_gui_basics.mm -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -gdwarf-2 -dwarf-column-info -coverage-file /private/var/tmp/_bazel_chetgnegy/9aea250917cb6c5cf95c462312a0e8c3/bazel-sandbox/4944080756099614783/execroot/__main__/bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2 -dependency-file bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.d -MT bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -sys-header-deps -iquote . -iquote bazel-out/darwin_x86_64-dbg/genfiles -iquote external/bazel_tools -iquote bazel-out/darwin_x86_64-dbg/genfiles/external/bazel_tools -isystem ThirdParty/Juce/JUCE/modules -isystem bazel-out/darwin_x86_64-dbg/genfiles/ThirdParty/Juce/JUCE/modules -isystem external/bazel_tools/tools/cpp/gcc3 -isystem ThirdParty/vst3_sdk -isystem bazel-out/darwin_x86_64-dbg/genfiles/ThirdParty/vst3_sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -D _FORTIFY_SOURCE=1 -D JUCE_MAC=1 -D MAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -D DEBUG=1 -D JUCE_DEBUG=1 -D JUCE_USE_XRANDR=0 -D JUCE_APP_VERSION=1.0.0 -D JUCE_APP_VERSION_HEX=0x10000 -D JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -D JUCE_MODULE_AVAILABLE_juce_audio_basics=1 -D JUCE_MODULE_AVAILABLE_juce_audio_devices=1 -D JUCE_MODULE_AVAILABLE_juce_audio_formats=1 -D JUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1 -D JUCE_MODULE_AVAILABLE_juce_audio_processors=1 -D JUCE_MODULE_AVAILABLE_juce_audio_utils=1 -D JUCE_MODULE_AVAILABLE_juce_core=1 -D JUCE_MODULE_AVAILABLE_juce_cryptography=1 -D JUCE_MODULE_AVAILABLE_juce_data_structures=1 -D JUCE_MODULE_AVAILABLE_juce_events=1 -D JUCE_MODULE_AVAILABLE_juce_graphics=1 -D JUCE_MODULE_AVAILABLE_juce_gui_basics=1 -D JUCE_MODULE_AVAILABLE_juce_gui_extra=1 -D JUCE_MODULE_AVAILABLE_juce_opengl=1 -D JUCE_MODULE_AVAILABLE_juce_video=1 -D OS_MACOSX -D DEBUG=1 -D _GLIBCXX_DEBUG -D _GLIBCXX_DEBUG_PEDANTIC -D _GLIBCPP_CONCEPT_CHECKS -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Developer/Library/Frameworks -stdlib=libc++ -O0 -Wall -Wthread-safety -Wself-assign -Wno-sign-compare -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wduplicate-method-match -Wempty-body -Wenum-conversion -Wint-conversion -Wunreachable-code -Wmismatched-return-types -Wundeclared-selector -Wuninitialized -Wunused-function -Wunused-variable -Wundeclared-selector -Wdeprecated-declarations -std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir /private/var/tmp/_bazel_chetgnegy/9aea250917cb6c5cf95c462312a0e8c3/bazel-sandbox/4944080756099614783/execroot/__main__ -ferror-limit 19 -fmessage-length 0 -stack-protector 3 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fobjc-exceptions -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -x objective-c++ ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.mm

On Mon, Jul 10, 2017 at 8:15 AM, Chet Gnegy <chet...@gmail.com> wrote:
That seems to get me past my issue and into build problems that don't look to be related to SDK frameworks. Thank you so much!

I'm currently using these flags (bazel 0.5.2). 
--apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all

For your reference, without the last two flags, I get an AssertionError with a stack trace starting in LegacyCompilationSupport. This might not surprise you, but I can open an issue if it does. My guess is that a few versions from now the necessary flags will change, though.

Please add --apple_platform_type, --apple_crosstool_transition, and --experimental_objc_crosstool to https://docs.bazel.build/versions/master/command-line-reference.html when you get a moment. I know that a lot of this apple support is relatively new, but it might save one else looking through hundreds of various flags like I did.

In case anyone is trying to follow my breadcrumbs, my simplest failing example can now find IOKit with these headers, the copts I provided are unnecessary, and test.cpp probably should be called test.mm (though it's not clear that bazel cares about the extension).

Austin Schuh

unread,
Jul 11, 2017, 12:19:09 AM7/11/17
to Chet Gnegy, Christopher Parsons, bazel-discuss
Try -Wno-undeclared-selector, and -Wno-deprecated-declarations.

On Mon, Jul 10, 2017 at 8:06 PM Chet Gnegy <chet...@gmail.com> wrote:
As long as I've got your attention, is there a trick to suppressing objective c warnings? I've tried putting -Wundeclared-selector and -Wdeprecated-declarations in the copt, in the cxxopt, in the objccopt, and in the build target, but I still get all kinds of warnings about undeclared selectors and deprecated declarations. This is in third party code where actually resolving the issues isn't the solution I'm interested in pursuing. 

Here's the command I'm using and a small excert from the verbose compilation log. I bolded the warnings of interest below. They're being used, they just don't seem to work.

blaze build --apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all ThirdParty/Juce:Juce --objccopt="-Wundeclared-selector -Wdeprecated-declarations -v"

 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name juce_gui_basics.mm -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -gdwarf-2 -dwarf-column-info -coverage-file /private/var/tmp/_bazel_chetgnegy/9aea250917cb6c5cf95c462312a0e8c3/bazel-sandbox/4944080756099614783/execroot/__main__/bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2 -dependency-file bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.d -MT bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -sys-header-deps -iquote . -iquote bazel-out/darwin_x86_64-dbg/genfiles -iquote external/bazel_tools -iquote bazel-out/darwin_x86_64-dbg/genfiles/external/bazel_tools -isystem ThirdParty/Juce/JUCE/modules -isystem bazel-out/darwin_x86_64-dbg/genfiles/ThirdParty/Juce/JUCE/modules -isystem external/bazel_tools/tools/cpp/gcc3 -isystem ThirdParty/vst3_sdk -isystem bazel-out/darwin_x86_64-dbg/genfiles/ThirdParty/vst3_sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -D _FORTIFY_SOURCE=1 -D JUCE_MAC=1 -D MAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -D DEBUG=1 -D JUCE_DEBUG=1 -D JUCE_USE_XRANDR=0 -D JUCE_APP_VERSION=1.0.0 -D JUCE_APP_VERSION_HEX=0x10000 -D JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -D JUCE_MODULE_AVAILABLE_juce_audio_basics=1 -D JUCE_MODULE_AVAILABLE_juce_audio_devices=1 -D JUCE_MODULE_AVAILABLE_juce_audio_formats=1 -D JUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1 -D JUCE_MODULE_AVAILABLE_juce_audio_processors=1 -D JUCE_MODULE_AVAILABLE_juce_audio_utils=1 -D JUCE_MODULE_AVAILABLE_juce_core=1 -D JUCE_MODULE_AVAILABLE_juce_cryptography=1 -D JUCE_MODULE_AVAILABLE_juce_data_structures=1 -D JUCE_MODULE_AVAILABLE_juce_events=1 -D JUCE_MODULE_AVAILABLE_juce_graphics=1 -D JUCE_MODULE_AVAILABLE_juce_gui_basics=1 -D JUCE_MODULE_AVAILABLE_juce_gui_extra=1 -D JUCE_MODULE_AVAILABLE_juce_opengl=1 -D JUCE_MODULE_AVAILABLE_juce_video=1 -D OS_MACOSX -D DEBUG=1 -D _GLIBCXX_DEBUG -D _GLIBCXX_DEBUG_PEDANTIC -D _GLIBCPP_CONCEPT_CHECKS -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Developer/Library/Frameworks -stdlib=libc++ -O0 -Wall -Wthread-safety -Wself-assign -Wno-sign-compare -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wduplicate-method-match -Wempty-body -Wenum-conversion -Wint-conversion -Wunreachable-code -Wmismatched-return-types -Wundeclared-selector -Wuninitialized -Wunused-function -Wunused-variable -Wundeclared-selector -Wdeprecated-declarations -std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir /private/var/tmp/_bazel_chetgnegy/9aea250917cb6c5cf95c462312a0e8c3/bazel-sandbox/4944080756099614783/execroot/__main__ -ferror-limit 19 -fmessage-length 0 -stack-protector 3 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fobjc-exceptions -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -x objective-c++ ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.mm
On Mon, Jul 10, 2017 at 8:15 AM, Chet Gnegy <chet...@gmail.com> wrote:
That seems to get me past my issue and into build problems that don't look to be related to SDK frameworks. Thank you so much!

I'm currently using these flags (bazel 0.5.2). 
--apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all

For your reference, without the last two flags, I get an AssertionError with a stack trace starting in LegacyCompilationSupport. This might not surprise you, but I can open an issue if it does. My guess is that a few versions from now the necessary flags will change, though.

Please add --apple_platform_type, --apple_crosstool_transition, and --experimental_objc_crosstool to https://docs.bazel.build/versions/master/command-line-reference.html when you get a moment. I know that a lot of this apple support is relatively new, but it might save one else looking through hundreds of various flags like I did.

In case anyone is trying to follow my breadcrumbs, my simplest failing example can now find IOKit with these headers, the copts I provided are unnecessary, and test.cpp probably should be called test.mm (though it's not clear that bazel cares about the extension).
To unsubscribe from this group and all its topics, send an email to bazel-discus...@googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CACZLR%2BHYuS1KuspJ9qvkUJkGYmObRRrWqhR%2BaTvdEgNC-GxVkA%40mail.gmail.com.

Chet Gnegy

unread,
Jul 11, 2017, 12:25:57 AM7/11/17
to Austin Schuh, Christopher Parsons, bazel-discuss
Ugh. Yes, I see what I was doing wrong now. Thank you.

On Mon, Jul 10, 2017 at 9:18 PM, Austin Schuh <austin...@gmail.com> wrote:
Try -Wno-undeclared-selector, and -Wno-deprecated-declarations.

On Mon, Jul 10, 2017 at 8:06 PM Chet Gnegy <chet...@gmail.com> wrote:
As long as I've got your attention, is there a trick to suppressing objective c warnings? I've tried putting -Wundeclared-selector and -Wdeprecated-declarations in the copt, in the cxxopt, in the objccopt, and in the build target, but I still get all kinds of warnings about undeclared selectors and deprecated declarations. This is in third party code where actually resolving the issues isn't the solution I'm interested in pursuing. 

Here's the command I'm using and a small excert from the verbose compilation log. I bolded the warnings of interest below. They're being used, they just don't seem to work.

blaze build --apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all ThirdParty/Juce:Juce --objccopt="-Wundeclared-selector -Wdeprecated-declarations -v"

 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name juce_gui_basics.mm -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -gdwarf-2 -dwarf-column-info -coverage-file /private/var/tmp/_bazel_chetgnegy/9aea250917cb6c5cf95c462312a0e8c3/bazel-sandbox/4944080756099614783/execroot/__main__/bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2 -dependency-file bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.d -MT bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -sys-header-deps -iquote . -iquote bazel-out/darwin_x86_64-dbg/genfiles -iquote external/bazel_tools -iquote bazel-out/darwin_x86_64-dbg/genfiles/external/bazel_tools -isystem ThirdParty/Juce/JUCE/modules -isystem bazel-out/darwin_x86_64-dbg/genfiles/ThirdParty/Juce/JUCE/modules -isystem external/bazel_tools/tools/cpp/gcc3 -isystem ThirdParty/vst3_sdk -isystem bazel-out/darwin_x86_64-dbg/genfiles/ThirdParty/vst3_sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -D _FORTIFY_SOURCE=1 -D JUCE_MAC=1 -D MAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -D DEBUG=1 -D JUCE_DEBUG=1 -D JUCE_USE_XRANDR=0 -D JUCE_APP_VERSION=1.0.0 -D JUCE_APP_VERSION_HEX=0x10000 -D JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -D JUCE_MODULE_AVAILABLE_juce_audio_basics=1 -D JUCE_MODULE_AVAILABLE_juce_audio_devices=1 -D JUCE_MODULE_AVAILABLE_juce_audio_formats=1 -D JUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1 -D JUCE_MODULE_AVAILABLE_juce_audio_processors=1 -D JUCE_MODULE_AVAILABLE_juce_audio_utils=1 -D JUCE_MODULE_AVAILABLE_juce_core=1 -D JUCE_MODULE_AVAILABLE_juce_cryptography=1 -D JUCE_MODULE_AVAILABLE_juce_data_structures=1 -D JUCE_MODULE_AVAILABLE_juce_events=1 -D JUCE_MODULE_AVAILABLE_juce_graphics=1 -D JUCE_MODULE_AVAILABLE_juce_gui_basics=1 -D JUCE_MODULE_AVAILABLE_juce_gui_extra=1 -D JUCE_MODULE_AVAILABLE_juce_opengl=1 -D JUCE_MODULE_AVAILABLE_juce_video=1 -D OS_MACOSX -D DEBUG=1 -D _GLIBCXX_DEBUG -D _GLIBCXX_DEBUG_PEDANTIC -D _GLIBCPP_CONCEPT_CHECKS -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Developer/Library/Frameworks -stdlib=libc++ -O0 -Wall -Wthread-safety -Wself-assign -Wno-sign-compare -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wduplicate-method-match -Wempty-body -Wenum-conversion -Wint-conversion -Wunreachable-code -Wmismatched-return-types -Wundeclared-selector -Wuninitialized -Wunused-function -Wunused-variable -Wundeclared-selector -Wdeprecated-declarations -std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir /private/var/tmp/_bazel_chetgnegy/9aea250917cb6c5cf95c462312a0e8c3/bazel-sandbox/4944080756099614783/execroot/__main__ -ferror-limit 19 -fmessage-length 0 -stack-protector 3 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fobjc-exceptions -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o bazel-out/darwin_x86_64-dbg/bin/ThirdParty/Juce/_objs/Juce/ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.o -x objective-c++ ThirdParty/Juce/JUCE/modules/juce_gui_basics/juce_gui_basics.mm
On Mon, Jul 10, 2017 at 8:15 AM, Chet Gnegy <chet...@gmail.com> wrote:
That seems to get me past my issue and into build problems that don't look to be related to SDK frameworks. Thank you so much!

I'm currently using these flags (bazel 0.5.2). 
--apple_platform_type=macos --cpu=darwin_x86_64 --apple_crosstool_transition --experimental_objc_crosstool=all

For your reference, without the last two flags, I get an AssertionError with a stack trace starting in LegacyCompilationSupport. This might not surprise you, but I can open an issue if it does. My guess is that a few versions from now the necessary flags will change, though.

Please add --apple_platform_type, --apple_crosstool_transition, and --experimental_objc_crosstool to https://docs.bazel.build/versions/master/command-line-reference.html when you get a moment. I know that a lot of this apple support is relatively new, but it might save one else looking through hundreds of various flags like I did.

In case anyone is trying to follow my breadcrumbs, my simplest failing example can now find IOKit with these headers, the copts I provided are unnecessary, and test.cpp probably should be called test.mm (though it's not clear that bazel cares about the extension).
To unsubscribe from this group and all its topics, send an email to bazel-discuss+unsubscribe@googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages