From 2a4d8ec417ffbe79a03cf05c967e826ca50b16aa Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Fri, 27 Dec 2024 18:54:52 +0100 Subject: [PATCH] Stop building RDMA in "in place" mode (#41) When using `IN_PLACE=1`, the build assumes that the build directory will _also_ be the run directory[1], which doesn't hold for our case. Furthermore, it's actively problematic as it means we'll end up fairly long paths, which can cause sadness (#21, [2]). Specifically, rdma-core has an assert[3] that triggers if the path to one of the build dependencies is longer than what's allowed for UNIX sockets[4]. The assert uses `IBACM_SERVER_PATH`, which is set[5] to `@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.sock`. That is in turn set[6] to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_RUNDIR} (when `CMAKE_INSTALL_RUNDIR` isn't set to an absolute path, which is the case for the default of "var/run"). `CMAKE_INSTALL_PREFIX` is set to the project directory of rdma-core when `IN_PLACE=1`, which may be quite deep, and thus the whole thing is likely to exceed the 108 bytes allowed for `sun_path`. It's worth noting that since we only build in order to get the various header files so we can then generate bindings from them, the setting of the various `CMAKE_INSTALL_*` options that `IN_PLACE=1` set _shouldn't_ have anything to say for us. Fixes #21 and (hopefully) docs.rs builds. [1]: https://github.com/linux-rdma/rdma-core/blob/fb965e2d0f670d1e3474f9333b332f6b4954201c/CMakeLists.txt#L92-L100 [2]: https://docs.rs/crate/ibverbs-sys/0.2.1+52.0/builds/1297723 [3]: https://github.com/linux-rdma/rdma-core/blob/fb965e2d0f670d1e3474f9333b332f6b4954201c/librdmacm/acm.c#L105-L106 [4]: https://man7.org/linux/man-pages/man7/unix.7.html [5]: https://github.com/linux-rdma/rdma-core/blob/fb965e2d0f670d1e3474f9333b332f6b4954201c/buildlib/config.h.in#L35 [6]: https://github.com/linux-rdma/rdma-core/blob/fb965e2d0f670d1e3474f9333b332f6b4954201c/CMakeLists.txt#L138 --- ibverbs-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibverbs-sys/build.rs b/ibverbs-sys/build.rs index cfd50f5..274f2e7 100644 --- a/ibverbs-sys/build.rs +++ b/ibverbs-sys/build.rs @@ -24,9 +24,9 @@ fn main() { } // build vendor/rdma-core + // note that we only build it to generate the bindings! eprintln!("run cmake"); let built_in = cmake::Config::new("vendor/rdma-core") - .define("IN_PLACE", "1") .define("NO_MAN_PAGES", "1") .no_build_target(true) .build();