vsco / bazel-toolchains

A collection of Bazel C++ build infrastructure based on Chromium's LLVM toolchain.
Apache License 2.0
38 stars 8 forks source link

common bazel cxx toolchain for Linux and Mac #1

Closed sayrer closed 7 years ago

sayrer commented 7 years ago

https://travis-ci.com/vsco/bazel-toolchains/builds/50882186

Still some cleanup to do:

promiseofcake commented 7 years ago

In order to use this, in let's say cpp-base for simplicity, would we need to run the WORKSPACE generation, copy those values over to cpp-base's WORKSPACE file, refer to this repo as a repository and then build? Or do we copy in the tools as we were doing previously and refer to it that way (that would solve the BUILD paths issues I am seeing when referring to it as a local_repository).

sayrer commented 7 years ago

I was thinking it would be a remote repository, with the WORKSPACE copied.

Bazel is adding transitive WORKSPACE files soon. https://github.com/bazelbuild/bazel/issues/1943

sayrer commented 7 years ago

I didn't intend to require running the generator script. I wrote that so a cron job can tag each Chromium stable release.

sayrer commented 7 years ago

I got this to work in cpp-base's WORKSPACE this way (it built, but didn't link, smaller issue).

git_repository( name = 'co_vsco_bazel_toolchains', remote = 'https://github.com/vsco/bazel-toolchains', commit = '2e97881e72e911c74a722c700516aeaf74007c35', )

load("@co_vsco_bazel_toolchains//toolchains:repositories.bzl", "bazel_toolchains_repositories") bazel_toolchains_repositories()

and then running:

bazel test --crosstool_top=@co_vsco_bazel_toolchains//tools/cpp:default-toolchain //statsd/...

promiseofcake commented 7 years ago

Thanks for the updates, I was able to get parts of cpp building as well using the above, just running into the linker issues mentioned above. Are they specific to OSX linking only?

promiseofcake commented 7 years ago

After removing the health-check code from cpp and building via

bazel build --cxxopt="-std=c++11" -c opt --crosstool_top=@co_vsco_bazel_toolchains//tools/cpp:default-toolchain //prediction-api:vsco_prediction_server

Was able to successfully build prediction-api on OSX! :tada: :tada: :tada: :tada: