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 build using musl as a build target. #264

Closed
iddm opened this issue Sep 14, 2021 · 3 comments
Closed

Can't build using musl as a build target. #264

iddm opened this issue Sep 14, 2021 · 3 comments

Comments

@iddm
Copy link

iddm commented Sep 14, 2021

So I am using github actions to build my crate and when running this step:

      - name: Build static
        uses: stevenleadbeater/rust-musl-builder@master
        with:
            args: /bin/bash -c "cargo build --locked --release --target=x86_64-unknown-linux-musl -v"

It fails with:

Running `rustc --crate-name socket2 --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=aa246bf64056a547 -C extra-filename=-aa246bf64056a547 --out-dir /github/workspace/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -L dependency=/github/workspace/target/x86_64-unknown-linux-musl/release/deps -L dependency=/github/workspace/target/release/deps --extern libc=/github/workspace/target/x86_64-unknown-linux-musl/release/deps/liblibc-d416f6c85e8305e1.rmeta --cap-lints allow`
error: attributes are not yet allowed on `if` expressions
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.1/src/sys/unix.rs:878:5
    |
878 |     #[cfg(not(any(target_os = "haiku", target_os = "openbsd")))]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: `match` is not allowed in a `const fn`
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.1/src/lib.rs:156:9
    |
156 | /         match address {
157 | |             SocketAddr::V4(_) => Domain::IPV4,
158 | |             SocketAddr::V6(_) => Domain::IPV6,
159 | |         }
    | |_________^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146

error[E0599]: no associated item named `MAX` found for type `i32` in the current scope
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.1/src/sys/unix.rs:763:46
    |
763 |     msg.msg_iovlen = min(bufs.len(), IovLen::MAX as usize) as IovLen;
    |                                              ^^^ associated item not found in `i32`

error[E0599]: no associated item named `MAX` found for type `i32` in the current scope
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.1/src/sys/unix.rs:823:46
    |
823 |     msg.msg_iovlen = min(bufs.len(), IovLen::MAX as usize) as IovLen;
    |                                              ^^^ associated item not found in `i32`

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0599, E0658.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `socket2`.

What could be wrong and how to fix it?

@iddm iddm closed this as completed Sep 14, 2021
@iddm iddm reopened this Sep 14, 2021
@iddm iddm changed the title Can't build using Rust 1.53 and clippy Can't build using Rust 1.53 and musl Sep 14, 2021
@iddm iddm changed the title Can't build using Rust 1.53 and musl Can't build using musl as a build target. Sep 14, 2021
@Thomasdezeeuw
Copy link
Collaborator

If you read the error it says error[E0658]: 'match' is not allowed in a 'const fn'. This is likely because your compiler is to old, as per the readme the minimum Rustc version for socket2 is 1.46. Have you tried updating your Rust version?

@Thomasdezeeuw
Copy link
Collaborator

@vityafx any luck updating your Rustc toolchain?

@iddm
Copy link
Author

iddm commented Sep 15, 2021

I guess I can't directly do anything with it as I just rely on the toolchain provided by a third-party github action. Thanks for confirming it is a compiler issue though.

@iddm iddm closed this as completed Sep 15, 2021
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