eclipse-iceoryx / eclipse-iceoryx/iceoryx2

Bazel doesn't work in MacOS

Open
#486 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.5k
Forks
185
Avg merge
2d 13h
Merged PRs (30d)
32

Description

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 https://github.com/eclipse-iceoryx/iceoryx2/pull/478#issuecomment-2428199107

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)

```diff
- 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)

```diff
--- 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 fetch_sub(std::ptrdiff_t value, std::memory_order order = std::memory_order_seq_cst) noexcept
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.