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

Pass toolchain and user env variables to make invocation #777

Merged
merged 3 commits into from
Nov 27, 2021

Conversation

fmeum
Copy link
Member

@fmeum fmeum commented Aug 25, 2021

Fixes #776.

@fmeum
Copy link
Member Author

fmeum commented Sep 29, 2021

@UebelAndre Would you be able to take a look at this PR? Without it, the make can't really be used safely as it does not take Bazel toolchain information into account.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay! One thing I want to clarify just to make sure I understand the change before continuing 😄

foreign_cc/private/configure_vars.bzl Outdated Show resolved Hide resolved
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for putting this together! The last thing before an approval though, would you be able to add some regression test? The rules as they are now are very prone to regressions so I think it'd be very helpful to have either a unit test in ./tests or an integration test in ./examples. Do you have a minimal repro case you'd be willing to share?

@fmeum
Copy link
Member Author

fmeum commented Oct 4, 2021

Thank you so much for putting this together! The last thing before an approval though, would you be able to add some regression test? The rules as they are now are very prone to regressions so I think it'd be very helpful to have either a unit test in ./tests or an integration test in ./examples. Do you have a minimal repro case you'd be willing to share?

Could such an integration test also consist of a make project added to examples/third_party? I am making these fixes to build open-source dependencies after all, so they would be natural examples.

@UebelAndre
Copy link
Collaborator

It depends on the size of the project. We have some fairly large 3rd party examples currently but we feel they're worth always building since they have complex build scripts to exercise the rules and are widely used by users of rules_foreign_cc. I'd prefer a simplified example so if there were to be a regression. The iteration is fast and it's clear what the specific requirement is. Vs having to understand a larger project first to understand why a change broke support for it

@fmeum fmeum force-pushed the fix-make-env branch 5 times, most recently from 7b5682c to 01190b5 Compare October 5, 2021 08:14
@fmeum
Copy link
Member Author

fmeum commented Oct 5, 2021

It depends on the size of the project. We have some fairly large 3rd party examples currently but we feel they're worth always building since they have complex build scripts to exercise the rules and are widely used by users of rules_foreign_cc. I'd prefer a simplified example so if there were to be a regression. The iteration is fast and it's clear what the specific requirement is. Vs having to understand a larger project first to understand why a change broke support for it

I rebased this onto #796 and turned make_simple into a more complete integration test verifying the presence of toolchain linkopts and rule copts. However, I am hitting a CI failure on Windows that I don't understand: cl.exe fails to create liba.o. Do you have an idea what could be wrong here? If this is a known issue with cl.exe, I could reintroduce a wrapper script that uses clang-cl instead, I just found the test to be more realistic this way.

@fmeum fmeum force-pushed the fix-make-env branch 5 times, most recently from d6e1598 to dc0e013 Compare November 20, 2021 09:28
@fmeum
Copy link
Member Author

fmeum commented Nov 20, 2021

@jsharpe I reintroduced the wrapper and along the way fixed the test failure on Windows.

fmeum and others added 3 commits November 27, 2021 08:01
This requires making the make_simple Makefile more realistic by

* using CXX and forwarding it to the wrapper;
* using CXXFLAGS instead of CXX_FLAGS and not overwriting its contents.
@fmeum
Copy link
Member Author

fmeum commented Nov 27, 2021

@UebelAndre Could you take another look?

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! Sorry for the delay again! Thank you so much for putting this together and awesome job on identifying the windows issue 😄

@UebelAndre UebelAndre merged commit f61ce5d into bazel-contrib:main Nov 27, 2021
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.

make does not populate environment variables from the toolchain
3 participants