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

Check for cargo when building rust language #2942

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

P-E-P
Copy link
Member

@P-E-P P-E-P commented Apr 5, 2024

Prevent rust language from building when cargo is missing.

@P-E-P P-E-P added the upstream Issue regarding upstreaming gccrs into GCC label Apr 5, 2024
@P-E-P P-E-P self-assigned this Apr 5, 2024
configure.ac Outdated Show resolved Hide resolved
configure.ac Outdated Show resolved Hide resolved
@tschwinge
Copy link
Member

Is it expected that GCC Rust build and test / build-and-check-gcc-48 failed here: configure: error: Cargo is required to build rust -- per the Install Deps step, Rust/Cargo is being installed? Is this hopefully just some kind of scripting issue?

@tschwinge tschwinge linked an issue Apr 7, 2024 that may be closed by this pull request
@tschwinge
Copy link
Member

Per a quick look, these changes look like (the first part of) how I think they should look like, thanks! In case there are requests for changes, I suggest to first get this reviewed on gcc-patches@gcc.gnu.org and committed upstream, before pushing to GCC/Rust (here).

@tschwinge
Copy link
Member

And then ("the next part") we should add a check that the object files that Cargo produces for a simple (dummy) crate can actually be linked into the GCC compiler we're about to build. This is to detect early cases like described in #2898 "cargo should build for the host system", or #2899 "Pass configuration flags to cargo", and still be able to react (disable Rust language, or sensible error message, as applicable), instead of later running into a build error.

@P-E-P
Copy link
Member Author

P-E-P commented Apr 8, 2024

And then ("the next part") we should add a check that the object files that Cargo produces for a simple (dummy) crate can actually be linked into the GCC compiler we're about to build. This is to detect early cases like described in #2898 "cargo should build for the host system", or #2899 "Pass configuration flags to cargo", and still be able to react (disable Rust language, or sensible error message, as applicable), instead of later running into a build error.

In fact, I've been hesitating for a long time to also check which edition of rust can be compiled but @CohenArthur convinced me to keep it simple.

@P-E-P P-E-P force-pushed the check-for-cargo-top-level branch 4 times, most recently from c60ce2b to 9876f36 Compare April 8, 2024 11:56
@CohenArthur
Copy link
Member

Per a quick look, these changes look like (the first part of) how I think they should look like, thanks! In case there are requests for changes, I suggest to first get this reviewed on gcc-patches@gcc.gnu.org and committed upstream, before pushing to GCC/Rust (here).

patch has been reviewed and approved by Richard Biener, so I think we can merge it here as well. @P-E-P do you want me to take care of the CI issue?

@P-E-P
Copy link
Member Author

P-E-P commented Apr 10, 2024

do you want me to take care of the CI issue?

@CohenArthur Yes please. I won't be able to work on it for a while.

@tschwinge
Copy link
Member

So, are you going to git push the patch into GCC upstream?

@CohenArthur
Copy link
Member

@tschwinge I was thinking of pushing it as part of our next upstream? would you rather it was pushed beforehand?

@tschwinge
Copy link
Member

tschwinge commented Apr 12, 2024

I prefer these generic non-trivial pieces to be integrated incrementally in GCC upstream: one after the other (in a logically meaningful order) instead of in bulk, so that there's some time for testing/stabilization between the individual parts.

@CohenArthur
Copy link
Member

alright :) that commit is good to upstream then I think. I'll fix the CI so we can merge it here

P-E-P and others added 4 commits April 22, 2024 16:20
Cargo presence will be checked during configuration
in the future, we therefore need to add it's
location to PATH.

ChangeLog:

	* .github/workflows/ccpp.yml: Add cargo to PATH.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Prevent rust language from building when cargo is
missing.

config/ChangeLog:

	* acx.m4: Add a macro to check for rust
	components.

ChangeLog:

	* configure: Regenerate.
	* configure.ac: Emit an error message when cargo
	is missing.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Cargo is temporarily required in order to build some parts of GCC rust
frontend. This requirement was not mentioned in the documentation.

gcc/ChangeLog:

	* doc/install.texi: Mention cargo requirement.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
ChangeLog:

	* .github/workflows/ccpp.yml: Add sourcing of cargo's environment file.
The warning shown in gcc/doc/install.texi has been moved down slightly
due to adding new lines for the Rust documentation.

ChangeLog:

	* .github/bors_log_expected_warnings: Fix line number of install.texi warning.
@P-E-P
Copy link
Member Author

P-E-P commented May 15, 2024

@tschwinge I'm a bit lost, should we merge this ? IIRC we already sent this upstream, so we should technically close this PR right ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Issue regarding upstreaming gccrs into GCC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add checking that cargo exists when building gccrs
3 participants