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

Added support for win_flex_bison on Windows #771

Merged
merged 4 commits into from
Apr 20, 2021

Conversation

corco
Copy link
Collaborator

@corco corco commented Apr 20, 2021

As a first step towards compiling on Windows (#307), use WinFlexBison on Windows instead of compiling m4/flex/bison (which doesn't work)

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Apr 20, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no A contributor in the pull request has yet to sign the CLA with Google. label Apr 20, 2021
@corco
Copy link
Collaborator Author

corco commented Apr 20, 2021

@googlebot I signed it!

@google-cla
Copy link

google-cla bot commented Apr 20, 2021

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot removed the cla: no A contributor in the pull request has yet to sign the CLA with Google. label Apr 20, 2021
@googlebot googlebot added the cla: yes All contributors in pull request have signed the CLA with Google. label Apr 20, 2021
@mithro mithro requested a review from hzeller April 20, 2021 14:45
@mithro
Copy link
Collaborator

mithro commented Apr 20, 2021

Is there a way to verify this is working on GitHub Actions?

Copy link
Collaborator

@hzeller hzeller left a comment

Choose a reason for hiding this comment

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

Very cool!
I mostly only have one comment (changing the name of the workflow from mac to windows :) ).

Also I suggest if you can and have not already, run the changed bzl and added BUILD file through buildifier (from https://github.com/bazelbuild/buildtools ) which creates a uniform formatting (I don't have any complaints about the formatting on these, but this will make sure it is uniform).

Other than that, we're good to final review and merge once the CI is passing (I suspect it might take a few commits and pushes until github actions are happy)

.github/workflows/windows-compile.yml Outdated Show resolved Hide resolved
WORKSPACE Show resolved Hide resolved
bazel/bison.bzl Show resolved Hide resolved
- Only checking Flex/Bison targets at the moment
@hzeller hzeller merged commit 79e1fea into chipsalliance:master Apr 20, 2021
@hzeller
Copy link
Collaborator

hzeller commented Apr 20, 2021

Thanks, merged!

@corco corco deleted the win_flex_bison branch April 20, 2021 18:46
)

def win_flex_configure(name, url, sha256 = ""):
remote_win_flex_bison(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this win_flex_configure() be made to return early if we're not on Windows ?

There seems to be an issue with pre-fetching all the needed dependencies vs. what is then actually needed in download later in environments that separate out the fetching and building like on nixos; this is why it needs this patch:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/language-servers/verible/remove-unused-deps.patch

I suspect what is happening: the win_flex_configure() called from the WORKSPACE unconditionally downloads the dependencies , but then on a non-Windows system, the select() in the {bison,flex}.bzl realizes that it doesn't actually needs it, so it then leaves it out of the prepeared download blob.
Later, after disconnect from the network, on build, the unconditional download attempt will fail. At least this is what I think is happening.

Anyway, if here, we could just skip calling the remote_win_flex_bison() and register toolchain part if we're not on windows, that should probably help. Do you think you can add that @corco ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll will look at it at the end of the week

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I took a look. It seems that this issue is part of the problem. There may be a way to fix it in either nix or bazel, but I am not comfortable with either...

I would suggest to either wait until bazel fix the issue, or simply remove downloading win_flex_bison and require the user to install it prior with chocolatey, like the use_local_flex_bison flag. I would move toward that second solution if @hzeller agrees.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@hzeller Have you look at my previous comment now that Christmas vacations are over?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, sorry, indeed I didn't see your previous comment.
I think removing the download and let the user use_local_flex_bison sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes All contributors in pull request have signed the CLA with Google.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants