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

Use only ARGV after -- in create_rust_makefile #430

Merged

Conversation

y-yagi
Copy link
Contributor

@y-yagi y-yagi commented Oct 14, 2024

I sometimes use Rake with --trace option, but it fails with when loading create_rust_makefile.

$ bundle exec rake --trace
** Invoke default (first_time)
** Invoke test (first_time)
** Invoke compile (first_time)
** Invoke compile:x86_64-linux (first_time)
(omit)
cargo rustc  --manifest-path /home/y-yagi/src/github.com/y-yagi/watchcat/ext/watchcat/Cargo.toml --target-dir /home/y-yagi/src/github.com/y-yagi/watchcat/target --lib --profile release --trace -- -C linker=gcc -L native=/home/y-yagi/.rbenv/versions/3.3.4/lib -L native=/home/linuxbrew/.linuxbrew/opt/gmp/lib -C link-arg=-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/gmp/lib -C link-arg=-lm -l pthread
error: unexpected argument '--trace' found

  tip: a similar argument exists: '--crate-type'
  tip: to pass '--trace' as a value, use '-- --trace'

Usage: cargo rustc --manifest-path <PATH> --target-dir <DIRECTORY> --lib --profile <PROFILE-NAME> --crate-type <CRATE-TYPE> [ARGS]...

For more information, try '--help'.
make: *** [Makefile:566: /home/y-yagi/src/github.com/y-yagi/watchcat/target/release/libwatchcat.so] エラー 1
rake aborted!

This is because create_rust_makefile always tries to pass ARGV to cargo. To be honest, I'm not sure why create_rust_makefile uses ARGV. But, I think create_rust_makefile only calls via other commands(e.g. Ruby, Rake).
So using ARGV only after -- is commonplace I think.

I sometimes use Rake with `--trace` option, but it fails with when
loading `create_rust_makefile`.

```bash
$ bundle exec rake --trace
** Invoke default (first_time)
** Invoke test (first_time)
** Invoke compile (first_time)
** Invoke compile:x86_64-linux (first_time)
(omit)
cargo rustc  --manifest-path /home/y-yagi/src/github.com/y-yagi/watchcat/ext/watchcat/Cargo.toml --target-dir /home/y-yagi/src/github.com/y-yagi/watchcat/target --lib --profile release --trace -- -C linker=gcc -L native=/home/y-yagi/.rbenv/versions/3.3.4/lib -L native=/home/linuxbrew/.linuxbrew/opt/gmp/lib -C link-arg=-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/gmp/lib -C link-arg=-lm -l pthread
error: unexpected argument '--trace' found

  tip: a similar argument exists: '--crate-type'
  tip: to pass '--trace' as a value, use '-- --trace'

Usage: cargo rustc --manifest-path <PATH> --target-dir <DIRECTORY> --lib --profile <PROFILE-NAME> --crate-type <CRATE-TYPE> [ARGS]...

For more information, try '--help'.
make: *** [Makefile:566: /home/y-yagi/src/github.com/y-yagi/watchcat/target/release/libwatchcat.so] エラー 1
rake aborted!
```

This is because `create_rust_makefile` always tries to pass ARGV to `cargo`.
To be honest, I'm not sure why `create_rust_makefile` uses ARGV.
But, I think `create_rust_makefile` only calls via other
commands(e.g. Ruby, Rake).
So using ARGV only after `--` is commonplace I think.
@ianks
Copy link
Collaborator

ianks commented Oct 15, 2024

Good catch, ty

@ianks ianks merged commit ebb9d08 into oxidize-rb:main Oct 15, 2024
52 checks passed
@y-yagi y-yagi deleted the fix_args_handling_in_create_rust_makefile branch October 15, 2024 03:23
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

Successfully merging this pull request may close these issues.

2 participants