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

Bazel doesn't work in MacOS #486

Open
xieyuschen opened this issue Oct 22, 2024 · 0 comments · May be fixed by #487
Open

Bazel doesn't work in MacOS #486

xieyuschen opened this issue Oct 22, 2024 · 0 comments · May be fixed by #487

Comments

@xieyuschen
Copy link
Contributor

xieyuschen commented Oct 22, 2024

I could run bazel test //... in main latest commit in my ubuntu22.04, but I encountered several problems in macOS when i tried my new feature in macos #478 (comment)

I have listed some problems I encountered.

1(fixed): bindgen issue

The issue is propably caused by incorrect release downloading.

/bin/bash: external/bindgen/bindgen: cannot execute binary file
My Solution(Click me to unfold)
-    sha256 = "b7e2321ee8c617f14ccc5b9f39b3a804db173ee217e924ad93ed16af6bc62b1d",
-    strip_prefix = "bindgen-cli-x86_64-unknown-linux-gnu",
-    urls = ["https://github.com/rust-lang/rust-bindgen/releases/download/v0.69.5/bindgen-cli-x86_64-unknown-linux-gnu.tar.xz"],
+   strip_prefix = "bindgen-cli-aarch64-apple-darwin",
+   urls = ["https://github.com/rust-lang/rust-bindgen/releases/download/v0.69.5/bindgen-cli-aarch64-apple-darwin.tar.xz"],

2(fixed) cbindgen issue

It's similar, the downloading binary is still for linux only. Download its source code and build it during the project works.

My Solution(Click me to unfold)
--- a/WORKSPACE.bazel
+++ b/WORKSPACE.bazel
@@ -50,9 +53,8 @@ rust_register_toolchains(
 maybe(
     name = "bindgen",
     repo_rule = http_archive,
-    sha256 = "b7e2321ee8c617f14ccc5b9f39b3a804db173ee217e924ad93ed16af6bc62b1d",
-    strip_prefix = "bindgen-cli-x86_64-unknown-linux-gnu",
-    urls = ["https://github.com/rust-lang/rust-bindgen/releases/download/v0.69.5/bindgen-cli-x86_64-unknown-linux-gnu.tar.xz"],
+    strip_prefix = "bindgen-cli-aarch64-apple-darwin",
+    urls = ["https://github.com/rust-lang/rust-bindgen/releases/download/v0.69.5/bindgen-cli-aarch64-apple-darwin.tar.xz"],

+rust_repositories()
+
+http_archive(
+    name = "cbindgen_source",
+    urls = ["https://github.com/mozilla/cbindgen/archive/refs/tags/0.26.0.tar.gz"],
 )
 
+load("@rules_rust//rust:defs.bzl", "rust_library")

--- a/iceoryx2-ffi/ffi/BUILD.bazel
+++ b/iceoryx2-ffi/ffi/BUILD.bazel
@@ -20,9 +20,19 @@ filegroup(
     srcs = glob(["**"]),
 )
 
-filegroup(
+
+load("@rules_rust//rust:defs.bzl", "rust_binary")
+
+rust_binary(
     name = "cbindgen-cli",
-    srcs = ["@cbindgen//file"],
+    srcs = [
+        "external/cbindgen_source/src/main.rs",
+        "external/cbindgen_source/build.rs",
+    ],
+    data = [
+        "external/cbindgen_source/Cargo.toml",
+        "external/cbindgen_source/Cargo.lock",
+    ],
 )

3: enable_if_pointer_t not in std

I have encountered the issue listed below. I briefly searched it and looks like it's a compiler version issue.

external/iceoryx/iceoryx_platform/generic/include/iceoryx_platform/atomic.hpp:283:5: error: no template named 'enable_if_pointer_t'
    enable_if_pointer_t<U> fetch_sub(std::ptrdiff_t value, std::memory_order order = std::memory_order_seq_cst) noexcept
@xieyuschen xieyuschen changed the title Bazel doesn't work in MacOS well Bazel doesn't work in MacOS Oct 22, 2024
xieyuschen added a commit to xieyuschen/iceoryx2 that referenced this issue Oct 23, 2024
* select different releases for different os

* build the cbindgen because its release doesn't support macos

* setup cxxopts for testing and macos
xieyuschen added a commit to xieyuschen/iceoryx2 that referenced this issue Oct 23, 2024
* select different releases for different os

* build the cbindgen because its release doesn't support macos

* setup cxxopts for testing and macos
xieyuschen added a commit to xieyuschen/iceoryx2 that referenced this issue Oct 23, 2024
* select different releases for different os

* build the cbindgen because its release doesn't support macos

* setup cxxopts for testing and macos
@xieyuschen xieyuschen linked a pull request Oct 23, 2024 that will close this issue
17 tasks
xieyuschen added a commit to xieyuschen/iceoryx2 that referenced this issue Oct 23, 2024
    * select different releases for different os

    * build the cbindgen because its release doesn't support macos

    * setup cxxopts for testing and macos
xieyuschen added a commit to xieyuschen/iceoryx2 that referenced this issue Oct 24, 2024
    * select different releases for different os

    * build the cbindgen because its release doesn't support macos

    * setup cxxopts for testing and macos
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

Successfully merging a pull request may close this issue.

1 participant