-
Notifications
You must be signed in to change notification settings - Fork 21
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: nix-shell environment for building spdk on arm #72
Conversation
c14220c
to
610f878
Compare
Changing compiler doesn't sound like something to do lightly, even though it may compile. |
Yeah, I totally understand how that is not ideal. I've been banging at it for a little bit hoping I've been missing something obvious. |
Btw I've added |
This is great, Edit: just noticed that failed run wasn't on this branch, my bad. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I had a better look at this and looks like up to release/2.7 the existing SPDK build was actually using gcc to build and not clang.
I'm not exactly sure why both gcc and some clang packages are included in the build, but it seems the order on which they appear changes the CC
environment variable, and looks like after the recent refactoring on the develop
branch, CC
ends up pointing to clang
and not gcc
.
This is the PR that initially introduced llvm packages: openebs/mayastor#671. Funny enough that it was also to bring aarch64 support :)
So, I think using gcc
is a good idea anyway since that's how it used to be, and was probably an unfortunate mistake that ended up changing that during the latest refactoring.
Also, please try to build mayastor io-engine with your spdk-rs code to ensure that is also working with this.
Thanks you!
Thank you for doing the historical deep-dive to figure out the root of things. ^ This callout made me chuckle, so thanks for that.
Great!
Yes of course, I'll do that asap. I noticed you guys were talking about merging the repos here #64, the CI for SPDK-rs also being tested downstream alone may be a convincing enough argument for the shift. |
I tried building through the release script + just raw cargo build. The error[E0308]: mismatched types
--> io-engine/src/bdev/ftl.rs:213:25
|
213 | ftl_conf.name = ftl_dev_name.as_ptr() as *mut i8;
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
| |
| expected due to the type of this binding
|
= note: expected raw pointer `*mut u8`
found raw pointer `*mut i8`
error[E0308]: mismatched types
--> io-engine/src/bdev/ftl.rs:214:30
|
214 | ftl_conf.base_bdev = base_dev_name.as_ptr() as *mut i8;
| ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
| |
| expected due to the type of this binding
|
= note: expected raw pointer `*mut u8`
found raw pointer `*mut i8`
error[E0308]: mismatched types
--> io-engine/src/bdev/ftl.rs:215:31
|
215 | ftl_conf.cache_bdev = cache_dev_name.as_ptr() as *mut i8;
| ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
| |
| expected due to the type of this binding
|
= note: expected raw pointer `*mut u8`
found raw pointer `*mut i8` although the The docs for CStr do say:
This may be able to be fixed by casting to |
Yes this should work with std::os::raw::c_char. |
Have a full mayastor release build on arm with this |
Awesome, great work @maxwnewcomer !!! |
Agree, as @maxwnewcomer already addressed this with openebs/mayastor#1796. Thanks! :) |
spdk-rs used to not build on arm solely due to the nix environment setup. There were issues with compiler flags (-msse4 is x86 only) and some base environment configuration. By fixing the environment we were able to get a successful build of spdk-rs. On top of these fixes we are able to test them in the github action runner which runs nix-shell. This in turn compiles spdk from source (openebs/spdk). Signed-off-by: Max Newcomer <[email protected]>
13fab5e
to
57c4a43
Compare
@maxwnewcomer after the mayastor fix is this good to merge now? |
Yes this should be good now. @tiagolobocastro. Might be good to do a mayastor CI run after this gets merged. |
Thanks @maxwnewcomer ! |
Appreciate the direction! Thanks. Working on an "implementable" oep pr btw. |
1797: chore: update spdk-rs for arm support r=tiagolobocastro a=maxwnewcomer Updates `spdk-rs` to an "arm-buildable" `spdk-rs` version. Update incorporates commits solely from openebs/spdk-rs#72 Co-authored-by: Max Newcomer <[email protected]>
This PR documents the changes needed to get the ARM64 build working and running the example hello-world application. Here are some of the issues encountered along the way.
Debugging the ARM Nix env
arm64
machine on Hetzner and debugged the install process step by step.nix-shell
without SPDK and hit issues withpyelf
. Replacingpython3.withPackages
withpkgs.python3Packages.pyelftools
fixed that.Compiler Issues
-msse4
flag, which is forx86
extended instruction sets and doesn’t work on ARM.nix-shell
compiler flags into configurable strings so we can set optimization flags per architecture.nix-shell
spdk
configure and build, Clang was the default compiler, this led to SVE compilation issues. In the "no-spdk-installed" nix environment, I noticed I was getting success w/ GCC, so migrated the nix script to remove Clang and use GCC by default. I don't want to get presumptuous that this is the best solution, very open to feedback on this.Context
arm64
Deployments openebs#3817), the goal here is just to make ARM builds possible—not optimized.amd64
system and everything went as expected. Not super familiar with what test suite I should be running.Addresses
Please let me know if you'd rather me focus on getting the OEP to implementable rather than starting to implement fixes!