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

doas does not cross-compile #224490

Closed
dsalaza4 opened this issue Apr 3, 2023 · 4 comments
Closed

doas does not cross-compile #224490

dsalaza4 opened this issue Apr 3, 2023 · 4 comments
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on

Comments

@dsalaza4
Copy link
Contributor

dsalaza4 commented Apr 3, 2023

Describe the bug

doas command does not build on aarch64-multiplatform and aarch64-multiplatform-musl.

Steps To Reproduce

nix-shell -p pkgsCross.aarch64-multiplatform.doas
...
building
build flags: SHELL=/nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/bash
yacc  parse.y
/nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/bash: line 1: yacc: command not found
make: *** [<builtin>: parse.c] Error 127
error: builder for '/nix/store/qgi06mxsqjn08rnvklkh0q1ckwrpwzxf-doas-aarch64-unknown-linux-gnu-6.8.2.drv' failed with exit code 2;
       last 10 log lines:
       > Checking for login_cap_h ...              no.
       > Checking for __attribute__ ...             yes.
       > Checking for pam_appl_h ...               yes.
       > Using auth method                 pam.
       > Using persist method                      timestamp.
       > building
       > build flags: SHELL=/nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/bash
       > yacc  parse.y
       > /nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/bash: line 1: yacc: command not found
       > make: *** [<builtin>: parse.c] Error 127
       For full logs, run 'nix log /nix/store/qgi06mxsqjn08rnvklkh0q1ckwrpwzxf-doas-aarch64-unknown-linux-gnu-6.8.2.drv'.

Expected behavior

doas should compile properly for aarch64-multiplatform and aarch64-multiplatform-musl.

Notify maintainers

@cole-h @cstrahan

Metadata

nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.8, NixOS, 23.05 (Stoat), 23.05.20230328.49079a1`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.14.1`
 - channels(nixos): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@dsalaza4 dsalaza4 added the 0.kind: bug Something is broken label Apr 3, 2023
@alyssais alyssais added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Apr 4, 2023
@jpverde
Copy link

jpverde commented Apr 4, 2023

Executing nix-shell -p doas on a Macbook Pro M1 i get the same error

clang -I. -Ilibopenbsd -O2 -Wall -Wextra -D__darwin__    -c -o pam.o pam.c
clang -I. -Ilibopenbsd -O2 -Wall -Wextra -D__darwin__    -c -o timestamp.o timestamp.c
timestamp.c:65:10: fatal error: 'sys/vfs.h' file not found
#include <sys/vfs.h>
         ^~~~~~~~~~~
1 error generated.
make: *** [<builtin>: timestamp.o] Error 1
rm parse.c
error: builder for '/nix/store/66fvlrxqaazlazxybp2cp4g1v336gac5-doas-6.8.2.drv' failed with exit code 2;
       last 10 log lines:
       > clang -I. -Ilibopenbsd -O2 -Wall -Wextra -D__darwin__    -c -o libopenbsd/bsd-setres_id.o libopenbsd/bsd-setres_id.c
       > clang -I. -Ilibopenbsd -O2 -Wall -Wextra -D__darwin__    -c -o libopenbsd/closefrom.o libopenbsd/closefrom.c
       > clang -I. -Ilibopenbsd -O2 -Wall -Wextra -D__darwin__    -c -o pam.o pam.c
       > clang -I. -Ilibopenbsd -O2 -Wall -Wextra -D__darwin__    -c -o timestamp.o timestamp.c
       > timestamp.c:65:10: fatal error: 'sys/vfs.h' file not found
       > #include <sys/vfs.h>
       >          ^~~~~~~~~~~
       > 1 error generated.
       > make: *** [<builtin>: timestamp.o] Error 1
       > rm parse.c
       For full logs, run 'nix log /nix/store/66fvlrxqaazlazxybp2cp4g1v336gac5-doas-6.8.2.drv'.
       ```

@cole-h
Copy link
Member

cole-h commented Apr 4, 2023

doas cross compiles for me just fine:

$ nix-build -A pkgsCross.aarch64-multiplatform-musl.doas
/nix/store/lz44law50ipjjindnlasrm8b605fp8yn-doas-aarch64-unknown-linux-musl-6.8.2
$ nix-build -A pkgsCross.aarch64-multiplatform.doas
/nix/store/nizpkqa1xiijnj8fqdzv6wcz5n1j2cnf-doas-aarch64-unknown-linux-gnu-6.8.2
$ git rev-parse HEAD
74c56f2e51d08f0196ed48d32e01d5d408e64451

@dsalaza4 Can you confirm if cross-compilation is still broken for you on the latest master?


@jpverde I wouldn't expect nix-shell -p doas to work on a Macbook considering the package only supports Linux:

platforms = platforms.linux;

@dsalaza4
Copy link
Contributor Author

dsalaza4 commented Apr 4, 2023

@cole-h

It looks like I'm missing something here 🤔

Closing this issue!

@dsalaza4 dsalaza4 closed this as completed Apr 4, 2023
@cole-h
Copy link
Member

cole-h commented Apr 5, 2023

I'm also missing something, since even 53dad94 builds successfully for me 😅

$ nix-build -A pkgsCross.aarch64-multiplatform.doas
/nix/store/nizpkqa1xiijnj8fqdzv6wcz5n1j2cnf-doas-aarch64-unknown-linux-gnu-6.8.2
$ nix-build -A pkgsCross.aarch64-multiplatform-musl.doas
/nix/store/lz44law50ipjjindnlasrm8b605fp8yn-doas-aarch64-unknown-linux-musl-6.8.2
$ git rev-parse HEAD
53dad94e874c9586e71decf82d972dfb640ef044

Maybe you have some overlays somewhere messing with this?

Regardless, glad it's solved for you now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on
Projects
None yet
Development

No branches or pull requests

4 participants