Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boost_build with local boost submodule #510

Closed
traceon opened this issue Feb 16, 2021 · 14 comments
Closed

boost_build with local boost submodule #510

traceon opened this issue Feb 16, 2021 · 14 comments

Comments

@traceon
Copy link

traceon commented Feb 16, 2021

(Bazel beginner here) Is it possible to use boost_build with a local boost source tree snapshot/git submodule instead of downloading it, i.e, when I have it under third_party/boost?

@UebelAndre
Copy link
Collaborator

Yeah, I don't see why not. Can you a bit more about what you're looking to do with build_boost? Maybe an example build file?

@traceon
Copy link
Author

traceon commented Feb 16, 2021

Don't really have any example, just want to be able to build my boost sources snapshot, and be able to link in [some] boost libs, built this way, into my other targets. Was hoping to get a minimal example here, actually.

@UebelAndre
Copy link
Collaborator

We're definitely looking into ways to have better examples. Does #474 help you out at all?

@jsharpe
Copy link
Member

jsharpe commented Feb 16, 2021

I would recommend looking towards https://github.com/nelhage/rules_boost first as this will build the libraries in isolation. You can override the included version of boost sources by defining a local_repository from your snapshot before calling the boost_deps macro.

@traceon
Copy link
Author

traceon commented Feb 16, 2021

@jsharpe thanks, I'll definitely give it a try! The work done there deserves respect. However, it seems to me that this approach will require constant maintenance with each boost upgrade, at least theoretically.

@UebelAndre the existing example works just fine, but downloads the archive with sources by default. What I haven't figured out is how to use a folder instead.

@UebelAndre
Copy link
Collaborator

You should hop in the Bazel Slack Channel to get quicker feedback and more helpful eyes.

In general though. You can setup a .bazelignore file in your top level workspace and use local_repository to create the repository you care about. Similar to what's happening in this repo with the examples. .bazelignore and top level WORKSPACE file

@traceon
Copy link
Author

traceon commented Feb 17, 2021

You should hop in the Bazel Slack Channel to get quicker feedback and more helpful eyes.

Got this:

Don’t have an @google.com email address?
Contact the workspace administrator at Bazel for an invitation.

Who should I contact, do you know?

@UebelAndre
Copy link
Collaborator

UebelAndre commented Feb 17, 2021

Hmm, I thought it was public
👋 Let’s move this to Slack! We’ve got 2588 folks from the team there already. You can sign up here: link

@traceon
Copy link
Author

traceon commented Feb 17, 2021

In general though. You can setup a .bazelignore file in your top level workspace and use local_repository to create the repository you care about. Similar to what's happening in this repo with the examples. .bazelignore and top level WORKSPACE file

With WORKSPACE:

...
local_repository(
    name = "boost",
    path = "third_party/boost",
)
...

...and third_party/BUILD.bazel:

...
load("@rules_foreign_cc//tools/build_defs:boost_build.bzl", "boost_build")
boost_build(
    name = "boost",
    lib_source = "@boost//:all"
)
...

If I put third_party in .bazelignore, and run bazel build //third_party:boost, I get:

ERROR: Skipping '//third_party:boost': no such package 'third_party': Package is considered deleted due to --deleted_packages

...and if I put third_party/boost in .bazelignore, and run bazel build //third_party:boost, I get:

ERROR: /path/third_party/BUILD.bazel:5:12: //third_party:boost depends on @boost//:all in repository @boost which failed to fetch. no such package '@boost//': No WORKSPACE file found in /private/var/tmp/_bazel_path/da18835db896305bb46480859a6b605c/external/boost

@UebelAndre
Copy link
Collaborator

You would build @boost//... or something. But try the slack link

@traceon
Copy link
Author

traceon commented Feb 17, 2021

Joined the slack, asked in #cc. Thanks!

@UebelAndre
Copy link
Collaborator

Gonna close this for now then. Happy slacking 😄

@traceon
Copy link
Author

traceon commented Feb 17, 2021

@jsharpe nelhage/rules_boost#9 has the same issue, however, there, it is kind of justified, since the source structure is hardcoded in the scripts.

@sunstarchan
Copy link

You would build @boost//... or something. But try the slack link

Hmm, I thought it was public
👋 Let’s move this to Slack! We’ve got 2588 folks from the team there already. You can sign up here: link

Could you invite me to the Bazel Slack channel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants