Skip to content

buck2 fails to build on m3 mac #587

Open
@1024bees

Description

@1024bees

hey folks,

when trying to build from source

git clone [email protected]:facebook/buck2.git                                                                                                                                                    
cargo build

and with rust toolchain cargo 1.76.0-nightly (978722961 2023-12-06)

i see the following

error: failed to run custom build command for `buck2_data v0.1.0 (/Users/james/buck2/app/buck2_data)`

Caused by:
  process didn't exit successfully: `/Users/james/buck2/target/release/build/buck2_data-59ab57d73e33d3fd/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-changed=data.proto
  cargo:rerun-if-changed=error.proto
  cargo:rerun-if-changed=data.proto
  cargo:rerun-if-changed=error.proto
  cargo:rerun-if-changed=.

  --- stderr
  INFO: Variable $PROTOC set to "/Users/james/.cargo/registry/src/index.crates.io-6f17d22bba15001f/protoc-bin-vendored-macos-x86_64-3.0.0/bin/protoc"
  INFO: Variable $PROTOC_INCLUDE set to "/Users/james/.cargo/registry/src/index.crates.io-6f17d22bba15001f/protoc-bin-vendored-macos-x86_64-3.0.0/include"
  Error: Custom { kind: Uncategorized, error: "failed to invoke protoc (hint: https://docs.rs/prost-build/#sourcing-protoc): (path: \"/Users/james/.cargo/registry/src/index.crates.io-6f17d22bba15001f/protoc-bin-v
endored-macos-x86_64-3.0.0/bin/protoc\"): Bad CPU type in executable (os error 86)" }
warning: build failed, waiting for other jobs to finish...
error: failed to compile `buck2 v0.1.0 (/Users/james/buck2/app/buck2)`, intermediate artifacts can be found at `/Users/james/buck2/target`.

this error is caused by the bundled protoc being compiled for x86 -- i'll find a work around and include a fix (installing protoc locally, pointing to it) -- longer term to make this just work, probably need to address stepancheg/rust-protoc-bin-vendored#1

Metadata

Metadata

Assignees

No one assigned

    Labels

    buck2 developmentRelated to the development of buck2 itselfdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions