Closed
Description
I tried this code in Alpine Linux cross compiled to x86_64-unknown-linux-gnu
:
use std::env;
fn main() {
println!("{:?}", env::args_os().collect::<Vec<_>>());
}
For reference I ran this in a container on an M1 Macbook:
$ docker run --rm -it --platform linux/amd64 alpine
# apk add gcompat libgcc
I always see []
printed, even when I pass the program arguments.
I'm not sure this is an issue with the environment as the following C program works as expected:
#include <stdio.h>
int main(int argc, char **argv) {
for (int i = 0; i < argc; i++) {
printf("%d: %s\n", i, argv[i]);
}
}
Meta
rustc +nightly --version --verbose
:
rustc 1.79.0-nightly (becebb315 2024-04-17)
binary: rustc
commit-hash: becebb3158149a115cad8a402612e25436a7e37b
commit-date: 2024-04-17
host: aarch64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.3