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

Can't cross compile to armv7 from Fedora36 + podman #1010

Closed
4 of 11 tasks
tmayoff opened this issue Sep 6, 2022 · 6 comments
Closed
4 of 11 tasks

Can't cross compile to armv7 from Fedora36 + podman #1010

tmayoff opened this issue Sep 6, 2022 · 6 comments
Labels
bug selinux Issue with SELinux labels or SELinux iteself

Comments

@tmayoff
Copy link

tmayoff commented Sep 6, 2022

Checklist

Describe your issue

I'm trying to setup a cross compile setup for my to ease my development of a raspberry pi project.

But after the initial clone / setup all I get is this

Error: lsetxattr /nix/store/.links: operation not permitted

Looking around it seems to be a SELinux issue but I'm not sure how to go about fixing it

What target(s) are you cross-compiling for?

armv7-unknown-linux-gnueabihf

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.4 (47df5c7 2022-08-30)

Example

git clone --branch cross https://github.com/tmayoff/lgaircon.git

cross build --target armv7-unknown-linux-gnueabihf

Additional information / notes

No response

@Alexhuszagh Alexhuszagh added bug selinux Issue with SELinux labels or SELinux iteself labels Sep 6, 2022
@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Sep 6, 2022

Does it affect any other targets, just wondering? Also, I don't think it should be using /nix/store, as we don't create it if it isn't provided nor do we pass NIX_STORE as an environment variable if it isn't provided. /nix/store shouldn't be present on Fedora, so it's not clear immediately to me why this is happening. If the directory doesn't exist and NIX_STORE or NIX_STORE_DIR is provided, we should fail fast with a permissions error, so this wouldn't reproduce the above error.

lsetxattr definitely is an SELinux issue, however. Can you try aarch64-unknown-linux-gnu and aarch64-linux-android just to test? Can you also report if /nix/store exists, and if NIX_STORE or NIX_STORE_DIR is set? Also, can you report the value of getenforce (to see if SELinux is set to enforcing or permissive mode)?

Thanks.

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Sep 6, 2022

Pinging @otavio, do you know anything about this? I know /nix/store/.links is actually a valid part of the Nix store for NixOS, which seems odd given the Fedora host. Possibly related to #989.

@tmayoff
Copy link
Author

tmayoff commented Sep 6, 2022

Okay so it does happen with the other targets you suggested, /nix/store exists but the environment variables don't I do however remember doing something NIX related (I don't remember what). I remove /nix and solved this.

@tmayoff
Copy link
Author

tmayoff commented Sep 6, 2022

Small question is it possible to cross compile when relying on C libraries, like sqlite3 and lirc_client

I get these errors

= note: /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: cannot find -llirc_client
          /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: cannot find -lsqlite3
          collect2: error: ld returned 1 exit status

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Sep 6, 2022

Okay so it does happen with the other targets you suggested, /nix/store exists but the environment variables don't I do however remember doing something NIX related (I don't remember what). I remove /nix and solved this.

So then the issue is it's trying to mount a directory it doesn't have permissions to modify as the current users, which is odd.... We might need to change the SELinux labels.

As for the glibc errors, see the pinned issue #724. For the other ones with external dependencies, we've documented this on the wiki. Let me know if anything is unclear. It's absolutely possible to cross-compile with C dependencies, and we understand it's a bit trickier to setup, so we've tried to make the process as simple as possible.

@Alexhuszagh
Copy link
Contributor

Closed in favor of #1012, which details this issue more precisely and generally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug selinux Issue with SELinux labels or SELinux iteself
Projects
None yet
Development

No branches or pull requests

2 participants