Buck: Can not build Apple bundle on OSX

Created on 10 Apr 2018  路  6Comments  路  Source: facebook/buck

When building an apple bundle, I get an error:

BUILD FAILED: //irrlicht-newton-game:bundle-osx#dwarf-and-dsym,no-include-frameworks: Apple bundle requires an Apple platform, found 'default'

A common cause of this error is that the required SDK is missing.
Please check whether it's installed and retry.

My system is OS X 10.13.4 (upgraded literally yesterday).

The BUCK definitions are:

apple_binary(
    name = "binary-osx",
    srcs = [ "main.cpp" ],
    deps = [
      // ...
    ],
    compiler_flags = [
        "-std=c++11",
    ],
    link_style = "static",
    frameworks = [
        "$SDKROOT/System/Library/Frameworks/IOKit.framework",
        "$SDKROOT/System/Library/Frameworks/OpenGL.framework",
        "$SDKROOT/System/Library/Frameworks/Cocoa.framework",
        "$SDKROOT/System/Library/Frameworks/CoreVideo.framework",
    ],
)

apple_bundle(
    name = "bundle-osx",
    binary = ":binary-osx",
    extension = "app",
    info_plist = "Info.plist",
    product_name = "irrlicht-newton-game",
)
P3

Most helpful comment

@carljparker any update on flavor docs?

All 6 comments

Okay, figured out how to "fix" this with my custom Buck patch ( #1570 ) - one needs to specify the "flavor" (which is not quite documented, AFAIK):

buck build //target:bundle-osx#macosx10.13-x86_64
# or
buck build //target:bundle-osx#macosx10.13-i386
# or
buck build //target:bundle-osx#macosx-x86_64
# or
buck build //target:bundle-osx#macosx-i386

or any other from the list, provided by Buck' output when the patch is applied.

The question is still present, however: what are the flavors and why I can't build the target without it? Is there any documentation on them?

So almost in a year of time, no docs are still there? That's sad =(

@shybovycha, apologies for this suboptimal experience. Each available Xcode platform is translated internally into a flavor that must be specified when building a binary, since otherwise Buck has no way of knowing which platform your binary should be built for. A default platform can also be specified using a configuration section. Something like:

[cxx]
  default_platform = macosx-x86_64

should work for your use-case. @carljparker is working on properly documenting flavors and their usage.

@carljparker any update on flavor docs?

Just randomly stumbled upon an answer somewhere on StackOverflow:

using

[cxx]
  should_remap_host_platform = true

in .buckconfig translates the default platform name into actual name. So, for instance, for OSX you will get something like macos....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikhedonia picture nikhedonia  路  4Comments

leodeleon22 picture leodeleon22  路  14Comments

brettwooldridge picture brettwooldridge  路  7Comments

kageiit picture kageiit  路  9Comments

njlr picture njlr  路  4Comments