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

Fix typo: plced -> placed #1834

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Fix typo: plced -> placed #1834

merged 1 commit into from
Feb 13, 2023

Conversation

kiron1
Copy link
Contributor

@kiron1 kiron1 commented Feb 13, 2023

No description provided.

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@illicitonion illicitonion merged commit 4f40140 into bazelbuild:main Feb 13, 2023
@kiron1 kiron1 deleted the fix-typo branch February 14, 2023 13:30
thb-sb added a commit to thb-sb/rules_rust that referenced this pull request Apr 18, 2024
…ariables on darwin.

This PR attempts to fix an issue with bindgen when used on darwin with clang
compiled from source (i.e. from `@llvm-project`).

When using clang compiled from source on darwin, libclang (used through `clang-sys`) failed
to find system header files (such as `stdarg.h` or `stdbool.h`) because these
files are actually living under the SDK path (under `<SDK_PATH>/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/` and `<SDK_PATH>/usr/include`).

Similar to what Bazel did in their [`xcrunwrapper.sh`](https://github.com/bazelbuild/bazel/blob/d8c27bfcd37a74dfbf1bdb9a1e3df13af8360a01/tools/objc/xcrunwrapper.sh#L17), we must have a way to tell bindgen's libclang
where to find these system headers.

In this commit, I add the following two substitutes variables:
  - `${SDKROOT}`: replaced by `std::env::var("SDKROOT")` if found.
  - `${DEVELOPER_DIR}`: replaced by `std::env::var("DEVELOPER")` if found.

This is similar to what it is currently done for `${pwd}`.

The following rule should now work on darwin:

```c
// mylib.h
#include <stdarg.h>
```

```starlark
# BUILD
cc_library(
    name = "mylib",
    srcs = ["mylib.c"],
    hdrs = ["mylib.h"],
)

rust_bindgen_library(
    name = "mylib_bindgen",
    cc_lib = ":mylib",
    clang_flags = select({
        "@platforms//os:macos": [
            "--sysroot=${SDKROOT}",
            "-isystem${SDKROOT}/usr/include",
            "-isystem${SDKROOT}/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/",
        ],
        "//conditions:default": [],
    }),
    crate_name = "mylib",
    header = "mylib.h",
)
```

It may also fix bazelbuild#1834.
thb-sb added a commit to thb-sb/rules_rust that referenced this pull request Apr 18, 2024
…ariables on darwin.

This PR attempts to fix an issue with bindgen when used on darwin with clang
compiled from source (i.e. from `@llvm-project`).

When using clang compiled from source on darwin, libclang (used through `clang-sys`) failed
to find system header files (such as `stdarg.h` or `stdbool.h`) because these
files are actually living under the SDK path (under `<SDK_PATH>/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/` and `<SDK_PATH>/usr/include`).

Similar to what Bazel did in their [`xcrunwrapper.sh`](https://github.com/bazelbuild/bazel/blob/d8c27bfcd37a74dfbf1bdb9a1e3df13af8360a01/tools/objc/xcrunwrapper.sh#L17), we must have a way to tell bindgen's libclang
where to find these system headers.

In this commit, I add the following two substitutes variables:
  - `${SDKROOT}`: replaced by `std::env::var("SDKROOT")` if found.
  - `${DEVELOPER_DIR}`: replaced by `std::env::var("DEVELOPER")` if found.

This is similar to what it is currently done for `${pwd}`.

The following rule should now work on darwin:

```c
// mylib.h
#include <stdarg.h>
```

```starlark
# BUILD
cc_library(
    name = "mylib",
    srcs = ["mylib.c"],
    hdrs = ["mylib.h"],
)

rust_bindgen_library(
    name = "mylib_bindgen",
    cc_lib = ":mylib",
    clang_flags = select({
        "@platforms//os:macos": [
            "--sysroot=${SDKROOT}",
            "-isystem${SDKROOT}/usr/include",
            "-isystem${SDKROOT}/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/",
        ],
        "//conditions:default": [],
    }),
    crate_name = "mylib",
    header = "mylib.h",
)
```

It may also fix bazelbuild#1834.
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 this pull request may close these issues.

None yet

2 participants