Skip to content

cpp-packaging.yml: install patch.exe via choco on Windows #1005

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

Closed
wants to merge 5 commits into from

Conversation

dconeybe
Copy link
Contributor

This is a workaround for the patch.exe from Strawberry Perl crashing when attempting to patch snappy at

https://github.com/firebase/firebase-ios-sdk/blob/4cf275ff08a5998da1712f7eb8bb0f613d73b97e/cmake/external/snappy.cmake#L37

The upgrade of the firebase-ios-sdk dependency from 9.1.0 to 9.2.0 in #1003 caused some GitHub Actions Windows runners to fail to build with this error:

Performing patch step for 'snappy'
patching file snappy.cc
Assertation failed!

Program: C:\Strawberry\c\bin\patch.exe
File: .\src\patch\2.5.9\patch-2.5.9-src\patch.c, Line 354

Expression: hunk

Note that #1003 has some special logic in 77f3e70 to remove the patching of the "snappy" library.

The problem appears to be that the GitHub Actions runners use the patch command that is bundled with Strawberry Perl, which cannot seem to handle the patch file format and crashes.

This PR attempts to fix the issue by installing the latest version of GNU patch using Chocolatey, in hopes that it will be chosen instead of the one from Strawberry Perl.

Googlers see b/236958574 for full details.

@dconeybe dconeybe added api: firestore skip-release-notes Skip release notes check labels Jun 23, 2022
@dconeybe dconeybe self-assigned this Jun 23, 2022
@dconeybe
Copy link
Contributor Author

dconeybe commented Jun 23, 2022

I've triggered the cpp_packaging workflow at fa8a18d to see if it works: https://github.com/firebase/firebase-cpp-sdk/actions/runs/2551400273

Update: It didn't work. Next I'll try adding chocolatey's patch.exe to the front of the PATH.

@dconeybe
Copy link
Contributor Author

dconeybe commented Jun 23, 2022

I've modified the workflow to explicitly prepend the directory of chocolatey's patch.exe to the front of the PATH in 76ac75b.

I've triggered the cpp_packaging workflow at this comment to see if it works: https://github.com/firebase/firebase-cpp-sdk/actions/runs/2551478788

Update: This didn't work because choco still installs an old version of patch: v2.5.9. This version crashes just like Strawberry Perl's, which is also v2.5.9.

@dconeybe
Copy link
Contributor Author

@dconeybe
Copy link
Contributor Author

Closing in favor of #1006

@dconeybe dconeybe closed this Jun 24, 2022
@dconeybe dconeybe deleted the dconeybe/PatchExeWindowsCppPackaging branch June 24, 2022 04:24
@firebase firebase locked and limited conversation to collaborators Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: firestore skip-release-notes Skip release notes check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant