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

Examples don't build #96

Open
benlaurie opened this issue May 24, 2024 · 10 comments
Open

Examples don't build #96

benlaurie opened this issue May 24, 2024 · 10 comments

Comments

@benlaurie
Copy link
Contributor

$ xmake config --board=sonata
checking for platform ... cheriot
checking for architecture ... cheriot
generating /Users/benl/git-work/sonata-software/cheriot-rtos/sdk/firmware.ldscript.in ... ok
(.venv) benl-macbookpro6:sonata-software benl$ xmake build
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/crt/cz.c
[ 41%]: cache compiling.release cheriot-rtos/sdk/core/allocator/main.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/core/loader/boot.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/core/software_revoker/revoker.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/compartment_helpers/check_pointer.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/compartment_helpers/claim_fast.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/locks/semaphore.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/atomic/atomic1.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/crt/arith64.c
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/atomic/atomic4.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/lib/locks/locks.cc
[ 41%]: compiling.release cheriot-rtos/sdk/core/loader/boot.S
error: clang: error: unknown argument: '-mxcheri-rvc'
clang: error: unsupported argument 'cheriot' to option '-mcpu='
  > in cheriot-rtos/sdk/lib/crt/cz.c

I presume this is because it is not using the CHERIoT LLVM, but I don't see anything in the setup that would have made it available...

@marnovandermaas
Copy link
Contributor

Thanks for testing this Ben! Are you running this xmake command from within the Nix development environment? https://github.com/lowRISC/sonata-software?tab=readme-ov-file#enter-the-cheriot-development-environment

@benlaurie
Copy link
Contributor Author

LOL! No: you only added that to the software setup 2 hours ago!

@benlaurie
Copy link
Contributor Author

But it should work in the "manual" setup, right?

@marnovandermaas
Copy link
Contributor

The manual setup should work if you want to build the baremetal examples located in the sw repository in this repo. xmake is only needed in the separate sonata-software repository. Maybe this needs to be clarified in the documentation.

@benlaurie
Copy link
Contributor Author

So, I did the Nix thing, and I get the same error:

(nix:sonata-sw-env) benl-macbookpro6:sonata-software benl$ xmake build
[ 25%]: cache compiling.release compartments/echo.cc
[ 26%]: compiling.release cheriot-rtos/sdk/core/token_library/token_unseal.S
[ 28%]: compiling.release cheriot-rtos/sdk/core/switcher/entry.S
[ 29%]: cache compiling.release cheriot-rtos/sdk/core/software_revoker/revoker.cc
[ 31%]: cache compiling.release cheriot-rtos/sdk/lib/crt/cz.c
[ 32%]: cache compiling.release cheriot-rtos/sdk/lib/crt/arith64.c
[ 34%]: cache compiling.release cheriot-rtos/sdk/lib/atomic/atomic1.cc
[ 35%]: cache compiling.release cheriot-rtos/sdk/core/scheduler/main.cc
[ 37%]: cache compiling.release cheriot-rtos/sdk/lib/atomic/atomic4.cc
[ 38%]: cache compiling.release cheriot-rtos/sdk/lib/locks/locks.cc
[ 40%]: cache compiling.release cheriot-rtos/sdk/lib/locks/semaphore.cc
[ 41%]: cache compiling.release cheriot-rtos/sdk/core/allocator/main.cc
error: clang: error: unknown argument: '-mxcheri-rvc'
clang: error: unsupported argument 'cheriot' to option '-mcpu='
clang: error: unsupported argument 'cheriot' to option '-mcpu='
  > in cheriot-rtos/sdk/core/token_library/token_unseal.S

@marnovandermaas
Copy link
Contributor

I'm assuming you are running this in the software repository. This looks like something went wrong in setting up the Nix environment.

$ clang --version
clang version 13.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /nix/store/m45jn5dx5x063nr76zs8gkg1yrcqrzhc-llvm-cheriot-13.0.0/bin

The other thing I can suggest is making sure that you are not defining CHERIOT_RTOS_SDK or CHERIOT_LLVM_BIN inside your Nix environment, see #101.

@benlaurie
Copy link
Contributor Author

What do you mean by "in the software repository"?

@benlaurie
Copy link
Contributor Author

Also:

$ clang --version
clang version 13.0.0
Target: aarch64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /nix/store/r60i4zgahhw37q9ljsprkz6b25fhp4ld-llvm-cheriot-13.0.0/bin

@benlaurie
Copy link
Contributor Author

BTW, I also had to $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 and $ nix develop github:lowRISC/sonata-software --impure or it wouldn't build because it said tbox was not avaikale: error: Package ‘tbox-1.7.5’ in /nix/store/b2hxgkvh0jrkxfv312xcrmrr3qyz50c1-source/pkgs/development/libraries/tbox/default.nix:30 is not available on the requested hostPlatform

@marnovandermaas
Copy link
Contributor

Thanks for reporting those Nix issues. We should now have this fixed.

Since you're using xmake, I assume you are using the instructions this repository: https://github.com/lowRISC/sonata-software/blob/main/README.md

We have recently updated those, so can you try running them again?

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

No branches or pull requests

2 participants