Skip to content

Try to support illumos #709

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

Merged
merged 3 commits into from
Mar 27, 2025
Merged

Try to support illumos #709

merged 3 commits into from
Mar 27, 2025

Conversation

LecrisUT
Copy link
Contributor

I don't have the expertise to actually chase this down, but wanted to point out the current issue with trying to build for illumos. This issue is a blocker for upgrading rustls package in atuin and to move away from ring.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@LecrisUT LecrisUT requested a review from a team as a code owner February 26, 2025 17:07
@LecrisUT
Copy link
Contributor Author

In short the issue is:

   --- stderr
  Evaluating: AWS_LC_SYS_EXTERNAL_BINDGEN='0'
  Parsed: AWS_LC_SYS_EXTERNAL_BINDGEN=false
  Failure invoking external bindgen! 
  bindgen-PARAMS: --prefix-link-name aws_lc_0_26_0_ --allowlist-file .*(/|\\)openssl((/|\\)[^/\\]+)+\.h --allowlist-file .*(/|\\)rust_wrapper\.h --rustified-enum point_conversion_form_t --default-macro-constant-type signed --with-derive-default --with-derive-partialeq --with-derive-eq --raw-line 
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  // SPDX-License-Identifier: Apache-2.0 OR ISC
   --generate functions,types,vars,methods,constructors,destructors /home/runner/work/aws-lc-rs/aws-lc-rs/aws-lc-sys/include/rust_wrapper.h --rust-target 1.59 --output /target/x86_64-unknown-illumos/release/build/aws-lc-sys-d08023f950b0ca18/out/bindings.rs --formatter rustfmt -- -I /home/runner/work/aws-lc-rs/aws-lc-rs/aws-lc-sys/include -I /home/runner/work/aws-lc-rs/aws-lc-rs/aws-lc-sys/aws-lc/include
  bindgen-STDOUT: 
  bindgen-STDERR: /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
  Unable to generate bindings: clang diagnosed error: /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
  thread 'main' panicked at aws-lc-sys/builder/main.rs:643:5:
  aws-lc-sys build failed. Please enable the 'bindgen' feature on aws-lc-rs or aws-lc-sys.For more information, see the aws-lc-rs User Guide: https://aws.github.io/aws-lc-rs/index.html
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifically

/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found

@justsmth
Copy link
Contributor

Thanks for the PR! We'll look into any failure that occurs.

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.85%. Comparing base (c358484) to head (bd06a47).
Report is 192 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #709      +/-   ##
==========================================
- Coverage   95.80%   92.85%   -2.95%     
==========================================
  Files          61       70       +9     
  Lines        8143     9572    +1429     
  Branches        0     9572    +9572     
==========================================
+ Hits         7801     8888    +1087     
- Misses        342      413      +71     
- Partials        0      271     +271     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth
Copy link
Contributor

I'm able to get the build to succeed by specifying BINDGEN_EXTRA_CLANG_ARGS="-I/usr/include/x86_64-linux-gnu" in the environment:

❯ BINDGEN_EXTRA_CLANG_ARGS="-I/usr/include/x86_64-linux-gnu" cross build -p aws-lc-sys --target x86_64-unknown-illumos
[+] Building 7.0s (8/8) FINISHED                                                                                                                                                                                                   docker-container:container
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                     ...
container0/9b5foql97aeiae9zmtsx264dv
   Compiling libc v0.2.170
   Compiling jobserver v0.1.32
   Compiling cc v1.2.16
   Compiling cmake v0.1.54
   Compiling aws-lc-sys v0.27.1 (/Users/justsmth/repos/aws-lc-rs/aws-lc-sys)
warning: [email protected]: Building with: CMake
warning: [email protected]: Symbol Prefix: Some("aws_lc_0_27_1")
warning: [email protected]: CMAKE environment variable set: cmake
warning: [email protected]: Generating bindings - external bindgen. Platform: x86_64-unknown-illumos
warning: [email protected]: CMAKE_TOOLCHAIN_FILE environment variable set: /opt/toolchain.cmake
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 33.31s

I'll update this PR.

@LecrisUT
Copy link
Contributor Author

Lovely, happy that there is some traction there. You could consider adding them directly in the CMakeLists.txt file with

target_include_directories(rust_wrapper PRIVATE $<$<PLATFORM_ID:SunOS>:/usr/include/x86_64-linux-gnu>)

But this reads rather weird because you are using CMAKE_TOOLCHAIN_FILE, yet you are including the path of the system's libraries. Hopefully I am having some misconception of how BINDGEN_EXTRA_CLANG_ARGS works.

@justsmth justsmth force-pushed the patch-1 branch 2 times, most recently from 9e530e2 to 7ec617c Compare March 18, 2025 18:53
justsmth
justsmth previously approved these changes Mar 18, 2025
@justsmth
Copy link
Contributor

justsmth commented Mar 21, 2025

I think this is a bug in the cross-rs image for illumos: https://github.com/cross-rs/cross/blob/main/docker/Dockerfile.x86_64-unknown-illumos#L28

    BINDGEN_EXTRA_CLANG_ARGS_sparcv9_sun_solaris="--sysroot=$CROSS_SYSROOT" \

Why does that say "sparcv9_sun_solaris"?


Update -- I posted a PR upstream: cross-rs/cross#1651

github-merge-queue bot pushed a commit to cross-rs/cross that referenced this pull request Mar 26, 2025
Hello! The Docker image for `x86_64-unknown-illumos` specifies a
`BINDGEN_EXTRA_CLANG_ARGS` variable for `sparcv9_sun_solaris`. I noticed
while working on this PR: aws/aws-lc-rs#709

This commit updates the name of the variable to match the intended
target.
@justsmth justsmth requested a review from skmcgrail March 26, 2025 17:04
@justsmth justsmth merged commit d998c01 into aws:main Mar 27, 2025
270 of 273 checks passed
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.

4 participants