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

error: unexpected argument '-–' found #1638

Closed
4 of 11 tasks
bread-mountain4 opened this issue Mar 7, 2025 · 11 comments
Closed
4 of 11 tasks

error: unexpected argument '-–' found #1638

bread-mountain4 opened this issue Mar 7, 2025 · 11 comments

Comments

@bread-mountain4
Copy link

Checklist

Describe your issue

I am not able to build anything with cross after installing it via cargo install cross

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.5

Example

cross build -–target=armv7-unknown-linux-gnueabihf
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.85.0 (4d91de4e4 2025-02-17)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
error: unexpected argument '-–' found

Usage: cargo build [OPTIONS]

For more information, try '--help'.

Additional information / notes

No response

@Emilgardis
Copy link
Member

Emilgardis commented Mar 7, 2025

Can you please show the output of the command when adding -v

@bread-mountain4
Copy link
Author

bread-mountain4 commented Mar 7, 2025

cross -v build -–target=armv7-unknown-linux-gnueabihf
+ cargo metadata --format-version 1
+ rustc --print sysroot
+ rustup toolchain list
+ rustup --verbose toolchain add stable-x86_64-unknown-linux-gnu --profile minimal
debug: read metadata version: '12'
debug: updating existing install for 'stable-x86_64-unknown-linux-gnu'
debug: toolchain directory: '/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
debug: creating temp file: /home/me/.rustup/tmp/ka8p_1kstqre31cp_file
debug: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256'
debug: downloading with reqwest
debug: deleted temp file: /home/me/.rustup/tmp/ka8p_1kstqre31cp_file
debug: toolchain is already up to date

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.85.0 (4d91de4e4 2025-02-17)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker
+ /usr/bin/docker run --userns host -e 'PKG_CONFIG_ALLOW_CROSS=1' -e 'XARGO_HOME=/xargo' -e 'CARGO_HOME=/cargo' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=me' --rm --user 1000:1000 -v /home/me/.xargo:/xargo:z -v /home/me/.cargo:/cargo:z -v /cargo/bin -v /home/me/rusttest:/project:z -v /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:z,ro -v /home/me/rusttest/target:/target:z -w /project -i -t ghcr.io/cross-rs/x86_64-unknown-linux-gnu:0.2.5 sh -c 'PATH=$PATH:/rust/bin cargo -v build '\''-–target=armv7-unknown-linux-gnueabihf'\'' --target x86_64-unknown-linux-gnu'
error: unexpected argument '-–' found

Usage: cargo build [OPTIONS]

For more information, try '--help'.
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu

@Emilgardis
Copy link
Member

What shell is this run in?
The command passed makes no sense at all.

cargo -v build '-–target=armv7-unknown-linux-gnueabihf' --target x86_64-unknown-linux-gnu

Could you try updating to cross from the main branch?

cargo install cross --git https://github.com/cross-rs/cross

@Emilgardis
Copy link
Member

Oh! Could this be a bad parsing, try not using =

@bread-mountain4
Copy link
Author

Looks like the same issue w/o the = on latest release for cross

cross -v build -–target armv7-unknown-linux-gnueabihf
+ cargo metadata --format-version 1
+ rustc --print sysroot
+ rustup toolchain list
+ rustup --verbose toolchain add stable-x86_64-unknown-linux-gnu --profile minimal
debug: read metadata version: '12'
debug: updating existing install for 'stable-x86_64-unknown-linux-gnu'
debug: toolchain directory: '/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
debug: creating temp file: /home/me/.rustup/tmp/ydaf4ep3xtcob231_file
debug: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256'
debug: downloading with reqwest
debug: deleted temp file: /home/me/.rustup/tmp/ydaf4ep3xtcob231_file
debug: toolchain is already up to date

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.85.0 (4d91de4e4 2025-02-17)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker
+ /usr/bin/docker run --userns host -e 'PKG_CONFIG_ALLOW_CROSS=1' -e 'XARGO_HOME=/xargo' -e 'CARGO_HOME=/cargo' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=me' --rm --user 1000:1000 -v /home/me/.xargo:/xargo:z -v /home/me/.cargo:/cargo:z -v /cargo/bin -v /home/me/rusttest:/project:z -v /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:z,ro -v /home/me/rusttest/target:/target:z -w /project -i -t ghcr.io/cross-rs/x86_64-unknown-linux-gnu:0.2.5 sh -c 'PATH=$PATH:/rust/bin cargo -v build '\''-–target'\'' armv7-unknown-linux-gnueabihf --target x86_64-unknown-linux-gnu'
error: unexpected argument '-–' found

Usage: cargo build [OPTIONS]

For more information, try '--help'.
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu

@bread-mountain4
Copy link
Author

Similar error if I uninstall cross and re-install from git directly

cross -v build -–target armv7-unknown-linux-gnueabihf
+ cargo metadata --format-version 1
+ rustc --print sysroot
+ /usr/bin/docker
+ /usr/bin/docker version -f '{{ .Server.Os }},,,{{ .Server.Arch }}'
+ /usr/bin/docker info -f {{.SecurityOptions}}
+ rustup toolchain list
+ rustup
+ rustup toolchain add stable-x86_64-unknown-linux-gnu --profile minimal --force-non-host
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.85.0 (4d91de4e4 2025-02-17)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker run --userns host -e 'XARGO_HOME=/home/me/.xargo' -e 'CARGO_HOME=/home/me/.cargo' -e 'CROSS_RUST_SYSROOT=/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=me' -e 'CROSS_RUSTC_MAJOR_VERSION=1' -e 'CROSS_RUSTC_MINOR_VERSION=85' -e 'CROSS_RUSTC_PATCH_VERSION=0' --name cross-stable-x86_64-unknown-linux-gnu-4972f-4d91de4e4-x86_64-unknown-linux-gnu-36cde-1741399380547 --rm --user 1000:1000 -v /home/me/.xargo:/home/me/.xargo:z -v /home/me/.cargo:/home/me/.cargo:z -v /home/me/.cargo/bin -v /home/me/rusttest:/home/me/rusttest:z -v /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:z,ro -v /home/me/rusttest/target:/target:z -w /home/me/rusttest -t ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main sh -c 'PATH="$PATH":"/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" cargo -v build '\''-–target'\'' armv7-unknown-linux-gnueabihf --target x86_64-unknown-linux-gnu'
Unable to find image 'ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main' locally
main: Pulling from cross-rs/x86_64-unknown-linux-gnu
d9802f032d67: Pull complete 
3ad1bb56a8c1: Pull complete 
dda1b2fa5cc7: Pull complete 
8bfc7833b6e4: Pull complete 
a90c89307da4: Pull complete 
c9df36cc84c8: Pull complete 
cb3a9cefdabf: Pull complete 
e06840818cde: Pull complete 
39a83f986dcc: Pull complete 
fbed48866a79: Pull complete 
f976503a76fc: Pull complete 
0eac5be2a86a: Pull complete 
5c77d4244886: Pull complete 
5541c0ca7fc8: Pull complete 
cb80a4fef305: Pull complete 
b4f2b8f6bece: Pull complete 
Digest: sha256:e3f405433eb4f7f47d08702fd1e8b90fb02da223c1e80d0290fc92535e4ac89f
Status: Downloaded newer image for ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main
error: unexpected argument '-–' found

Usage: cargo build [OPTIONS]

For more information, try '--help'.
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu

@bread-mountain4
Copy link
Author

What shell is this run in? The command passed makes no sense at all.

zsh 5.9 (x86_64-pc-linux-gnu)

@Emilgardis
Copy link
Member

Emilgardis commented Mar 8, 2025

does it work in bash?

@bread-mountain4
Copy link
Author

Unfortunately, similar error when running under bash GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)

cross -v build -–target armv7-unknown-linux-gnueabihf
+ cargo metadata --format-version 1
+ rustc --print sysroot
+ /usr/bin/docker
+ /usr/bin/docker version -f '{{ .Server.Os }},,,{{ .Server.Arch }}'
+ /usr/bin/docker info -f {{.SecurityOptions}}
+ rustup toolchain list
+ rustup
+ rustup toolchain add stable-x86_64-unknown-linux-gnu --profile minimal --force-non-host
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.85.0 (4d91de4e4 2025-02-17)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker run --userns host -e 'XARGO_HOME=/home/me/.xargo' -e 'CARGO_HOME=/home/me/.cargo' -e 'CROSS_RUST_SYSROOT=/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=me' -e 'CROSS_RUSTC_MAJOR_VERSION=1' -e 'CROSS_RUSTC_MINOR_VERSION=85' -e 'CROSS_RUSTC_PATCH_VERSION=0' --name cross-stable-x86_64-unknown-linux-gnu-4972f-4d91de4e4-x86_64-unknown-linux-gnu-36cde-1741479724165 --rm --user 1000:1000 -v /home/me/.xargo:/home/me/.xargo:z -v /home/me/.cargo:/home/me/.cargo:z -v /home/me/.cargo/bin -v /home/me/rusttest:/home/me/rusttest:z -v /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:z,ro -v /home/me/rusttest/target:/target:z -w /home/me/rusttest -t ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main sh -c 'PATH="$PATH":"/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" cargo -v build '\''-–target'\'' armv7-unknown-linux-gnueabihf --target x86_64-unknown-linux-gnu'
error: unexpected argument '-–' found

Usage: cargo build [OPTIONS]

For more information, try '--help'.
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu

@Emilgardis
Copy link
Member

Oh! You have accidentally used a en dash :)

use minus minus -- and this should work

Image

@bread-mountain4
Copy link
Author

hah, must have been some bad copy paste. that worked on zsh, thank you so much.

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