-
-
Notifications
You must be signed in to change notification settings - Fork 996
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
[FEATURE REQUEST] Build libtorrent using Bazel #2602
Comments
well, I can tell you that even |
My impression of bazel is that its main selling point is building software in large organizations, perhaps with a single (logical) source code repository for all dependencies. I must admit I don't know that much about bazel otherwise, but it seems pretty heavy weight for any casual building. What are the main selling points of using bazel, over boost-build say? I understand it may be a bit quicker with large build trees by caching files that have changed with an inotify service, is that right? |
Thanks a lot for the replies. Context-wise, I have been using Bazel at my previous company (founded and headed by ex-Googlers) for a year and a half. Afterwards, I have been using Bazel for all my personal projects. I also Bazelised (or improved the existing Bazel files) the build of many open source C/C++/assembly projects such as openssl, boost, icu4c, benchmark, benchmark, libtorrent (yep, I have done it), c-ares, cctz, jemalloc, libunwind, glog, abseil-cpp. For a few of them, I have already created PRs or issued tickets on their official github repos. Prior to Bazel, I used a lot of Makefiles, cmake, maven, gradle, xcodebuild, etc.. At one point I even wrote my own build system and designed a context free grammar to write build systems. All in all, in this prolonged effort of seeking the perfect build system, Bazel really amazed me. The Bazel official website explains why Bazel is so great. Just list a few here:
@arvidn you are definitely right that Bazel does perfect incremental builds (with caches). But Bazel not only benefits large, monolithic repos such as the ones inside Google and Facebook. Bazel makes the building and maintenance of small projects super simple too. It is hard to tell the true power using some text interface like this. But I would very much like to provide more evidences if you are interested in any particular aspects. I have not answered your questions directly. But hopefully what I wrote serves as an answer, of sort :D Best, Zhongming |
As an example, here is a PR that adds a Bazel BUILD file that has been recently merged to mainline glog: |
looking at your build file, the first thing that comes to mind is that it doesn't look like bazel provide abstractions for platforms and compilers. There are a lot of GCC specific command line switches in there. So much that I must assume this doesn't work for msvc (or any other compiler that isn't GCC compatible). Apart from that, how does bazel know which of those compiler switches must be propagated down to dependencies when they are built, or up to dependents when they are built? For example, if you build libtorrent with One reason why this build file is simple, is because it doesn't support most of the build configurations of libtorrent, which may not be very important (to you at least). That said, I must admit that, for being python, the syntax is unusually compact. Compared to other build systems using general purpose languages. However, it's still a lot noisier than boost-build. |
Hi @arvidn , Just want to reiterate, in case I did not make this crystal clear to begin with: I do not intend to use Bazel to replace boost_build or any existing build system that libtorrent has been using. That would be folly. All I want is to add some extra support for building with Bazel to libtorrent. Honestly, it is such a great library. I want to use it. But I also want to use it with Bazel for the benefits I described in the previous comment. Hopefully this helps set up a less closed mental state for this discussion. OK, now let's begin the discussion. You raised two very fair points:
Indeed, these questions have already been very well answered by Bazel. My BUILD file used many shortcuts and hard coding because, well, I am just boostrapping this effort. If you would like to more seriously consider the idea of adding Bazel support for libtorrent, the BUILD file must be augmented. OK, actually answering your questions: A2: Per the official doc about cc_library and cc_binary, if you pass macros in the You kind of touched upon the point of supporting multiple build configurations for libtorrent. Without much knowledge, I, doing a poor man's guess, believe that is more or less a solvable problem with my existing understanding of libtorrent and Bazel. It might not be 100% solvable. But at least I believe that a system that supports, say, 80% use cases still has valuable - feel free to scold me here for being nitpicking :D How do you think? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please provide the following information
libtorrent version (or branch):
master, or pretty much any release
platform/architecture:
Ubuntu 16.04, x86_64
compiler and compiler version:
GCC 5.4.0
clang 5.0.0
Feature request:
As mentioned in the title of this ticket, this is a feature request. Well, not really requesting yet, but just very broadly raising the question: Is there willingness to build libtorrent using Google's Bazel?
There are two main dependencies of libtorrent: boost and openssl.
I have Bazelised the build of boost and openssl under Ubuntu 16.04 with no or minimal change to the official repositories of boost (source files unchanged), openssl (renamed a directory), and libtorrent (source files unchanged), in my own repository https://github.com/qzmfranklin/torrent (
master
branch always builds correctly). In my example repo, you can build the libtorrent's client usingThe built binary works. I can use it to download torrents and use the nice terminal-based UI.
Or you can run all the tests with
Currently 22 tests fails and tests under
similations
are not converted yet.These are just some preliminary work towards building libtorrent in Bazel. Would like to know how people think here.
Thanks a lot!
The text was updated successfully, but these errors were encountered: