-
Notifications
You must be signed in to change notification settings - Fork 539
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
Replace autotools with CMake + fbcode_builder #449
base: main
Are you sure you want to change the base?
Conversation
Please let me know if you find this approach feasible—I'm not a CMake expert.
|
cpp_include "mcrouter/lib/carbon/example/gen/HelloGoodbyeMessages.h" | ||
|
||
namespace cpp2 hellogoodbye.thrift | ||
namespace py3 hellogoodbye.thrift | ||
|
||
service HelloGoodbye extends fb303.FacebookService { | ||
service HelloGoodbye { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugly, but installing fb303
via fbcode_builder
still doesn't help the Thrift compiler find fb303
IDLs. Since this is a test/example service, perhaps this is okay.
@@ -87,6 +87,8 @@ void TestServerOnRequest::onRequest( | |||
processReply(std::move(ctx), Reply(carbon::Result::NOTFOUND)); | |||
} else if (req.key_ref()->fullKey() == "shutdown") { | |||
shutdownLock_.post(); | |||
// TODO | |||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've observed a race condition in several tests in AsyncMcClientTestSync
, e.g. qosClass
, where the test would hang on shutdown without this, with the test thread waiting on the ->shutdown
call, the server thread waiting on ->join
and event loop threads still selecting, so I added this as a workaround since I wasn't able to find the exact cause of the race.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things I've tried to attempt to resolve this:
- reordering the
shutdownLock_
post, - introducing another synchronization barrier between the call to
shutdown
andjoin
on the mock server main thread, - changing the worker loop to use
loopOnce
overloop
and checkisShutdown
on each loop iteration, like some of the other mock servers do.
@@ -256,7 +255,7 @@ def ensure_connected(self): | |||
while True: | |||
try: | |||
res = self.thrift_client.mcVersion() | |||
if res == Result.OK: | |||
if res == carbon.carbon_result.thrift_types.Result.OK: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this could be generated from the Carbon IDLs, createThriftTestClient
isn't implemented in the OSS version of mcrouter_config.py
, so it seems better to "hide" the Meta-specific bits instead.
90964da
to
92cb3bd
Compare
https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports with build issues. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without the PR having to do it.
92cb3bd
to
4d2a569
Compare
include_directories(.) | ||
include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super sure about this, but this seems like the best way to support the current #include
style.
1eab3f0
to
04963d0
Compare
aa59940
to
74f2de6
Compare
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. Pull Request resolved: #2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
Summary: X-link: facebookincubator/zstrong#944 https://github.com/facebook/mcrouter currently uses a legacy autotools-based build system, which forces third parties to rely on a collection of scripts hosted in the repository to build it with all required dependencies. This is brittle and has lead to many issue reports about build problems. In facebook/mcrouter#449, I've prepared a working CMake-based build system for mcrouter that could replace the legacy autotools setup. This patch adds the necessary manifests for mcrouter and its ragel dependency so that fbcode_builder itself will be setup for the repo without having to do it in the PR. X-link: facebook/folly#2268 Reviewed By: yfeldblum Differential Revision: D60537337 Pulled By: Orvid fbshipit-source-id: ed73693d4af93acc3b8e996a7c61d0090075949f
816fd71
to
1dbcd9b
Compare
b08d8b1
to
9b13245
Compare
9b13245
to
45822bd
Compare
f24267f
to
ada66fd
Compare
ab01788
to
5fbd42c
Compare
Note: this is blocked on fbcode_builder actually being wired up with the mcrouter repo. facebook/folly#2282 aims to do that but it's itself stalled. |
5fbd42c
to
5cc7c78
Compare
Part of the difficulty in building mcrouter as a third party stems from the fact that it uses an autotools-based build system. While other Meta OSS projects have adopted
fbcode_builder
to make it easier to build a project with all required dependencies, this tool was primarily written with CMake in mind and unfortunately wouldn't work with mcrouter's build system without making mcrouter-specific accommodations (e.g. explicitly passing in the Thrift compiler path and so on).So, introduce a CMake-based build system for mcrouter and wire it up with
fbcode_builder
. This also allows for the tests (which had been nonfunctional in the autotools build for years) to be run in OSS CI via CMake/CTest, after some fixes for the GH Actions environment and disabling Meta-specific functionality in an OSS context. There are no changes to non-test/build files apart from the elimination of the generatedconfig.h
.Use globbing extensively for generating source file lists in CMake files. While this may be a controversial approach, I think in this specific case the benefits outweigh the drawbacks, since this project doesn't use CMake internally so globbing can reduce the amount of times the OSS build needs to be fixed after the fact because a new source file wasn't added to it.
To assist reviewing, I've attempted to break this change into reasonable commits. The very first commit simply adds a vendored copy of
fbcode_builder
from a recent Folly checkout, hence the large diff size. I've not yet removed autotools paraphernalia to reduce the amount of changes in this PR—that can be done as a followup.