update build_host_protoc command for macos cross compilation#50922
update build_host_protoc command for macos cross compilation#50922janeyx99 wants to merge 1 commit intopytorch:masterfrom
Conversation
💊 CI failures summary and remediationsAs of commit 0f426b1e26 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
Codecov Report
@@ Coverage Diff @@
## master #50922 +/- ##
==========================================
+ Coverage 80.81% 81.00% +0.18%
==========================================
Files 1948 1916 -32
Lines 213213 209481 -3732
==========================================
- Hits 172309 169686 -2623
+ Misses 40904 39795 -1109 |
5bbda74 to
581b7ce
Compare
There was a problem hiding this comment.
For more context, it'd be really nice to just have:
execute_process(COMMAND ./scripts/build_host_protoc.sh --other-flags -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
...
But this causes a CMake error because it cannot parse the double quotes correctly. Out of the many alternatives I've tried, writing to a temp file was the only one that worked, but I am glad to switch to anything cleaner that also works.
581b7ce to
0f426b1
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@janeyx99 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
this should be in the other commit
0f426b1 to
751755c
Compare
Summary: Tests cross-compilation of ARM64 architecture in MacOS CI. This should be merged after PR #50243 and #50922 (adding a fix). The reason we pin the wheel to be version 0.36.2 is because lower versions cannot handle c38 as a tag for the wheel. Pull Request resolved: #49751 Reviewed By: albanD Differential Revision: D26411133 Pulled By: janeyx99 fbshipit-source-id: 00a5cf597aee10adea1547579270cb3b38732563
…#50922) Summary: Currently, adding a cross compile build is failing on CI due to a cmake builtin compiler check that does not pass due to cross compiling the host protoc library. Setting the CMAKE_TRY_COMPILE_TARGET_TYPE flag should fix it. (Based on this [SOF answer](https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program).) To test that this works, please run: `CMAKE_OSX_ARCHITECTURES=arm64 USE_MKLDNN=OFF USE_NNPACK=OFF USE_QNNPACK=OFF USE_PYTORCH_QNNPACK=OFF BUILD_TEST=OFF python setup.py install` from a Mac x86_64 machine with Xcode12.3 (anything with MacOS 11 SDK). Then, you can check that things were compiled for arm by running `lipo -info <file>` for any file in the `build/lib` directory. Pull Request resolved: pytorch#50922 Reviewed By: malfet Differential Revision: D26355054 Pulled By: janeyx99 fbshipit-source-id: 919f3f9bd95d7c7bba6ab3a95428d3ca309f8ead
Summary: Tests cross-compilation of ARM64 architecture in MacOS CI. This should be merged after PR pytorch#50243 and pytorch#50922 (adding a fix). The reason we pin the wheel to be version 0.36.2 is because lower versions cannot handle c38 as a tag for the wheel. Pull Request resolved: pytorch#49751 Reviewed By: albanD Differential Revision: D26411133 Pulled By: janeyx99 fbshipit-source-id: 00a5cf597aee10adea1547579270cb3b38732563
…#50922) Summary: Currently, adding a cross compile build is failing on CI due to a cmake builtin compiler check that does not pass due to cross compiling the host protoc library. Setting the CMAKE_TRY_COMPILE_TARGET_TYPE flag should fix it. (Based on this [SOF answer](https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program).) To test that this works, please run: `CMAKE_OSX_ARCHITECTURES=arm64 USE_MKLDNN=OFF USE_NNPACK=OFF USE_QNNPACK=OFF USE_PYTORCH_QNNPACK=OFF BUILD_TEST=OFF python setup.py install` from a Mac x86_64 machine with Xcode12.3 (anything with MacOS 11 SDK). Then, you can check that things were compiled for arm by running `lipo -info <file>` for any file in the `build/lib` directory. Pull Request resolved: pytorch#50922 Reviewed By: malfet Differential Revision: D26355054 Pulled By: janeyx99 fbshipit-source-id: 919f3f9bd95d7c7bba6ab3a95428d3ca309f8ead
Summary: Tests cross-compilation of ARM64 architecture in MacOS CI. This should be merged after PR pytorch#50243 and pytorch#50922 (adding a fix). The reason we pin the wheel to be version 0.36.2 is because lower versions cannot handle c38 as a tag for the wheel. Pull Request resolved: pytorch#49751 Reviewed By: albanD Differential Revision: D26411133 Pulled By: janeyx99 fbshipit-source-id: 00a5cf597aee10adea1547579270cb3b38732563
Currently, adding a cross compile build is failing on CI due to a cmake builtin compiler check that does not pass due to cross compiling the host protoc library. This PR edits the cmake config to make it work. Tested in #49751, specifically with https://app.circleci.com/pipelines/github/pytorch/pytorch/272514/workflows/82c6a000-75fd-4a03-a9ad-dcc834927af9/jobs/10841449.
Setting the CMAKE_TRY_COMPILE_TARGET_TYPE flag should fix it. (Based on this SOF answer.) This didn't fix it completely, and so I disabled the compiler checks entirely.
To test that this works, please run:
CMAKE_OSX_ARCHITECTURES=arm64 USE_MKLDNN=OFF USE_NNPACK=OFF USE_QNNPACK=OFF USE_PYTORCH_QNNPACK=OFF BUILD_TEST=OFF python setup.py installfrom a Mac x86_64 machine with Xcode12.3 (anything with MacOS 11 SDK).Then, you can check that things were compiled for arm by running
lipo -info <file>for any file in thebuild/libdirectory.