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

Debug vs release #24

Open
philberty opened this issue Jun 24, 2021 · 3 comments
Open

Debug vs release #24

philberty opened this issue Jun 24, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@philberty
Copy link
Member

philberty commented Jun 24, 2021

From reading through the code so far I am unsure if there is a way to turn on debug on which requires the -g option for gccrs. Also not sure how to turn on optimizations -O0, -O1, -O2, -O3 etc.

If there is a debug / release thing I would suggest debug should be -g -O0 and for release -g -O2 for now if you need default options.

A question, is there options in cargo to pass extra flags to rustc outside of cargo using an environment variable? Just wondering if we need a mechanism to be able to override these defaults with an environment variable.

@philberty philberty added the enhancement New feature or request label Jun 24, 2021
@bjorn3
Copy link
Contributor

bjorn3 commented Jun 24, 2021

If there is a debug / release thing I would suggest debug should be -g -O0 and for release -g -O2 for now if you need default options.

Cargo will pass -Cdebuginfo=0/1/2 and -Copt-level=0/1/2/3/s/z to rustc/cargo-gccrs according to the used cargo profile. I believe -Copt-level=3 is the default for the release profile, though the CARGO_PROFILE_RELEASE_OPT_LEVEL env var can be used to override it without changing Cargo.toml.

Side note are their options in cargo to pass extra flags to rustc outside of cargo using an environment variable?

That is the RUSTFLAGS env var.

@CohenArthur
Copy link
Member

CohenArthur commented Jun 24, 2021

This ties a bit into #20

I think it's important that we handle stuff such as RUSTFLAGS so that users can ideally use cargo build and cargo gccrs build without setting any extra environment variables or having to modify their Cargo.toml.

However, we should also handle some specific gcc options with variables such as GCCRSFLAGS or something, in case the users do want some specific behavior when using cargo gccrs ...

@bjorn3
Copy link
Contributor

bjorn3 commented Jun 24, 2021

RUSTFLAGS is handled by cargo automatically. Rustc doesn't know about RUSTFLAGS either.

However, we should also handle some specific gcc options with variables such as GCCRSFLAGS or something, in case the users do want some specific behavior when using cargo gccrs ...

Makes sense. It could also be using -Cllvm-args. (Yes I know, it is a bad name. I use it in cg_clif too. cc rust-lang/compiler-team#421)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants