facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
https://buck.build
Apache License 2.0
8.56k stars 1.16k forks source link

Can not build Apple bundle on OSX #1840

Open shybovycha opened 6 years ago

shybovycha commented 6 years ago

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",
)
shybovycha commented 6 years ago

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?

LegNeato commented 6 years ago

Nope: https://github.com/facebook/buck/issues/1526

shybovycha commented 6 years ago

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

ttsugriy commented 6 years ago

@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.

LegNeato commented 6 years ago

@carljparker any update on flavor docs?

shybovycha commented 4 years ago

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....