Bitvec compilation error when targetting x86_64-unknown-linux-musl

Not sure if this is the right place to ask about this, but I am at a loss for where to search.

I am trying to cross compile my Rust command line project to x86_64-unknown-linux-musl using Google Actions.

First, here is the projects:

https://github.com/mikechambers/dcli

I am compiling with the following command:

cargo build --manifest-path=src/Cargo.toml --release --target x86_64-unknown-linux-musl

but I keep getting this error during the compilation (one of the packages I use uses bitvec, I dont directly use it):

Compiling bitvec v0.19.4
error: unexpected `self` parameter in function
--> /github/home/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/slice/api.rs:2791:9
 |
2791 |     fn get(self, slice: Self::Immut) -> Option<Self::Immut> {
 |            ^^^^ not valid as function parameter
 |
 = note: `self` is only valid as the first parameter of an associated function

Two questions:

  1. Does anyone know of an up to date action for Github Actions for compiling to x86_64-unknown-linux-musl?
  2. Any suggestions on how to begin to approach tracking down the issue above? Doing a google search doesn't turn anything up at all.

I would really like to do a linux release for my project, but at this point I may just require linux users to compile on there own.

For reference, here is my Google Action:

name: Rust

on: [push]

jobs:

  build-linux-musl:
    runs-on: ubuntu-latest
    steps:
      - name: Step Settings
        id: settings
        run: |
            echo ::set-output name=SOURCE_TAG::${GITHUB_REF/refs\/tags\//}
            echo ::set-output name=TARGET_NAME::x86_64-unknown-linux-musl
      - uses: actions/checkout@master
      - name: Build and Test
        uses: stevenleadbeater/rust-musl-builder@master
        with:
          cmd: cargo build --manifest-path=src/Cargo.toml --release --target ${{ steps.settings.outputs.TARGET_NAME }}

fyi, just to follow up on this. I was able to get it to compile by updating rust on the instance.

Here is the updated action:

build-linux-musl:
runs-on: ubuntu-latest
steps:
- name: Step Settings
id: settings
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF/refs/tags//}
echo ::set-output name=TARGET_NAME::x86_64-unknown-linux-musl
- uses: actions/checkout@master
- name: Build and Test
uses: stevenleadbeater/rust-musl-builder@master
with:
args: /bin/bash -c "rustup update && cargo build --manifest-path=src/Cargo.toml --release --target=x86_64-unknown-linux-musl"

The error points to: https://docs.rs/bitvec/0.19.4/src/bitvec/slice/api.rs.html#2790

which looks fine to me. The macro is here: https://docs.rs/bitvec/0.19.4/src/bitvec/slice/api.rs.html#2712

Are you using a recent version of Rust?

If the action is caching ~/.cargo dir, maybe some files got mangled? Does clearing it help?

Yeah, that was the issue. I was able to figure out how to first update rust in the action, and that fixed the issues.

Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.