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

if-watch does not compile on aarch64 #3

Closed
rklaehn opened this issue Dec 3, 2020 · 1 comment
Closed

if-watch does not compile on aarch64 #3

rklaehn opened this issue Dec 3, 2020 · 1 comment

Comments

@rklaehn
Copy link

rklaehn commented Dec 3, 2020

When compiling if-watch on aarch64, you get the following error:

rklaehn@linux-box:~/actyx/Cosmos$ docker run -it -u 1000 -w /src/rt-master -e CARGO_BUILD_TARGET=aarch64-unknown-linux-musl -e CARGO_BUILD_JOBS=8 -e HOME=/home/builder -v `pwd`:/src -v /home/rklaehn/.cargo/git:/home/builder/.cargo/git -v /home/rklaehn/.cargo/registry:/home/builder/.cargo/registry --rm actyx/cosmos:musl-aarch64-unknown-linux-musl-latest /bin/bash
builder@454bbd5fca3e:/src/rt-master$ cargo --locked build --release  --bin actyxos-linux
   Compiling if-watch v0.1.6
   Compiling rand v0.7.3
   Compiling prost v0.6.1
   Compiling blake3 v0.3.7
   Compiling ring v0.16.19
   Compiling tracing v0.1.22
   Compiling thiserror v1.0.22
   Compiling asn1_der v0.6.3
   Compiling data-encoding-macro v0.1.10
error[E0412]: cannot find type `nlmsghdr` in crate `libc`
   --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/if-watch-0.1.6/src/unix/linux/netlink.rs:6:34
    |
6   |   unsafe impl FromBuffer for libc::nlmsghdr {
    |                                    ^^^^^^^^ help: a struct with a similar name exists: `cmsghdr`
    | 
   ::: /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
    |
5   | / s! {
6   | |     pub struct statfs64 {
7   | |         pub f_type: ::c_ulong,
8   | |         pub f_bsize: ::c_ulong,
...   |
130 | |     }
131 | | }
    | |_- similarly named struct `cmsghdr` defined here

error[E0412]: cannot find type `nlmsghdr` in crate `libc`
   --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/if-watch-0.1.6/src/unix/linux/netlink.rs:28:24
    |
28  |       type Item = (libc::nlmsghdr, U32AlignedBuffer<'a>);
    |                          ^^^^^^^^ help: a struct with a similar name exists: `cmsghdr`
    | 
   ::: /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
    |
5   | / s! {
6   | |     pub struct statfs64 {
7   | |         pub f_type: ::c_ulong,
8   | |         pub f_bsize: ::c_ulong,
...   |
130 | |     }
131 | | }
    | |_- similarly named struct `cmsghdr` defined here

error[E0412]: cannot find type `nlmsghdr` in crate `libc`
   --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/if-watch-0.1.6/src/unix/linux.rs:71:24
    |
71  |               hdr: libc::nlmsghdr,
    |                          ^^^^^^^^ help: a struct with a similar name exists: `cmsghdr`
    | 
   ::: /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
    |
5   | / s! {
6   | |     pub struct statfs64 {
7   | |         pub f_type: ::c_ulong,
8   | |         pub f_bsize: ::c_ulong,
...   |
130 | |     }
131 | | }
    | |_- similarly named struct `cmsghdr` defined here

error[E0422]: cannot find struct, variant or union type `nlmsghdr` in crate `libc`
   --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/if-watch-0.1.6/src/unix/linux.rs:80:24
    |
80  |               hdr: libc::nlmsghdr {
    |                          ^^^^^^^^ help: a struct with a similar name exists: `cmsghdr`
    | 
   ::: /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
    |
5   | / s! {
6   | |     pub struct statfs64 {
7   | |         pub f_type: ::c_ulong,
8   | |         pub f_bsize: ::c_ulong,
...   |
130 | |     }
131 | | }
    | |_- similarly named struct `cmsghdr` defined here

   Compiling libsqlite3-sys v0.17.0 (https://github.com/Actyx/rusqlite?rev=a0253432fd554bdf054c2fb820cbdedf3d396157#a0253432)
   Compiling zstd-sys v1.4.17+zstd.1.4.5
error[E0063]: missing fields `__pad1`, `__pad2` in initializer of `libc::msghdr`
   --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/if-watch-0.1.6/src/unix/linux.rs:124:38
    |
124 |                     let mut msghdr = libc::msghdr {
    |                                      ^^^^^^^^^^^^ missing `__pad1`, `__pad2`

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0063, E0412, E0422.
For more information about an error, try `rustc --explain E0063`.
error: could not compile `if-watch`.

The immediate cause is the following: while the required structs have been added to some architectures, they have not yet been added to others.

builder@35b9072431c3:/src/rt-master$ cat /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/mips64.rs | grep nlmsghdr
    pub struct nlmsghdr {
        pub msg: nlmsghdr,
builder@35b9072431c3:/src/rt-master$ cat /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/mod.rs | grep nlmsghdr
builder@35b9072431c3:/src/rt-master$ cat /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs | grep nlmsghdr

So this would e.g. compile just fine for mips64, if anybody would still care about that arch...

Now, what I don't know is whether there is some fundamental reason why this mechanism is not available for aarch64, or if it is just that somebody has forgotten to update the platform specific headers.

What would need to be done would be to make a PR against https://github.com/rust-lang/libc, similar to rust-lang/libc#1649 , and then somehow try out that the mechanism actually works on aarch64.

Then we would have to wait for this to be merged, published, and included in musl, which we use in our build.

bors referenced this issue in rust-lang/libc Dec 3, 2020
Followup to #1649.

When adding `nlmsghdr` for `musl` targets the `aarch64` arch was singled out, not getting the definition. This remedies the problem so that `if-watch` compiles on `aarch64-unknown-linux-musl`.

- [0] https://github.com/dvc94ch/if-watch/issues/3
bors referenced this issue in rust-lang/libc Dec 3, 2020
Followup to #1649.

When adding `nlmsghdr` for `musl` targets the `aarch64` arch was singled out, not getting the definition. This remedies the problem so that `if-watch` compiles on `aarch64-unknown-linux-musl`.

- [0] https://github.com/dvc94ch/if-watch/issues/3
@dvc94ch
Copy link
Collaborator

dvc94ch commented Dec 6, 2020

Released in 0.1.7

@dvc94ch dvc94ch closed this as completed Dec 6, 2020
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