Skip to content

Bring up android+coreclr windows build. #112256

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

Merged
merged 12 commits into from
Feb 12, 2025
Merged

Conversation

steveisok
Copy link
Member

@steveisok steveisok commented Feb 7, 2025

This pull request includes various changes to improve the build process for Android and cross-compiling on Windows. The most important changes include updates to build scripts, configuration files, and the addition of new scripts.

A side benefit of this change is that it sets the table for being able to cross compile other non-Windows configurations on Windows.

Copy link
Contributor

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

@steveisok
Copy link
Member Author

@kotlarmilos @ivanpovazan the Android sample app goes through the appbuilder to the point where it invokes cmake. It'll fail because cmake isn't usually on PATH by itself. There is probably some pathing nonsense to fix as well.

@akoeplinger
Copy link
Member

It'll fail because cmake isn't usually on PATH by itself.

afaik we handle that in the runtime build itself by invoking the VsDevCmd.bat (Developer Command Prompt for Visual Studio) through init-vs-env.cmd which will bring the cmake included in VS into PATH.

I think it's fine if we document you need to run from Developer Command Prompt or have cmake in PATH for now so we don't need to complicate appbuilder (we basically have the same requirement of having cmake in PATH on the other platforms anyway)

@steveisok steveisok marked this pull request as ready for review February 10, 2025 13:50
@steveisok steveisok requested a review from a team February 10, 2025 13:50
@steveisok
Copy link
Member Author

This is ready... Cleanup suggestions and pointing out nits would be appreciated.

Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
@steveisok steveisok merged commit 08b488a into dotnet:main Feb 12, 2025
156 of 160 checks passed
@steveisok steveisok deleted the android-win-build branch February 12, 2025 00:40
grendello added a commit to grendello/runtime that referenced this pull request Feb 12, 2025
* main:
  [Android] Run CoreCLR functional tests on Android (dotnet#112283)
  [LoongArch64] Fix some assertion failures for Debug ILC building Debug NativeAOT testcases. (dotnet#112229)
  Fix suspicious code fragments (dotnet#112384)
  `__ComObject` doesn't support dynamic interface map (dotnet#112375)
  Native DLLs: only load imported DLLs from System32 (dotnet#112359)
  [main] Update dependencies from dotnet/roslyn (dotnet#112314)
  Update SVE instructions that writes to GC regs (dotnet#112389)
  Bring up android+coreclr windows build.  (dotnet#112256)
  Never use heap for return buffers (dotnet#112060)
  Wait to complete the test before releasing the agile reference. (dotnet#112387)
  Prevent returning disposed HTTP/1.1 connections to the pool (dotnet#112383)
  Fingerprint dotnet.js if writing import map to html is enabled (dotnet#112407)
  Remove duplicate definition of CORECLR_HOSTING_API_LINKAGE (dotnet#112096)
  Update the exception message to reflect current behavior. (dotnet#112355)
  Use enum for frametype not v table (dotnet#112166)
  Enable AltJits build for LoongArch64 and RiscV64 (dotnet#110282)
  Guard members of MonoType union & fix related bugs (dotnet#111645)
  Add optional hooks for debugging OpenSSL memory allocations (dotnet#111539)
  JIT: Optimize struct parameter register accesses in the backend (dotnet#110819)
  NativeAOT: Cover more opcodes in type preinitializer (dotnet#112073)
@@ -15,6 +15,9 @@
<EnableDefaultAssembliesToBundle>true</EnableDefaultAssembliesToBundle>
<!-- With Mono AOT on Android we default to not using AOT data file optimization as it can degrade runtime performance for small binary size improvements. -->
<_UseAotDataFile Condition="'$(RunAOTCompilation)' == 'true'">false</_UseAotDataFile>
<RepoDotnet Condition="'$(DOTNET_ROOT)' != ''">$(DOTNET_ROOT)/dotnet</RepoDotnet>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need this, you can just always call dotnet.cmd/dotnet.sh right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's unnecessary

jkotas added a commit to jkotas/runtime that referenced this pull request Feb 14, 2025
Comment on lines +382 to +394
if /i not "%__HostOS%" == "%__TargetOS%" (
if /i "%__HostOS%" == "" (
set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLR_CMAKE_TARGET_ARCH=%__TargetArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%"
)
)

set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLI_CMAKE_FALLBACK_OS=%__HostFallbackOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"

if /i "%__TargetOS%" == "android" (
if not "%__HostOS%" == "" (
set "__TargetOS=!__HostOS!"
)
)
Copy link
Member

Choose a reason for hiding this comment

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

These changes broke build of windows arm64-targeting x64-hosted crossdac (the build produces x64-targeting x64-hosted crossdac instead).

#112553

steveisok added a commit to steveisok/runtime that referenced this pull request Feb 14, 2025
dotnet#112256 added the ability to cross compile android on windows. This
regressed the win-arm64 crossdac build because it stopped passing CMAKE_TARGET_ARCH and CMAKE_TARGET_OS for
cross component builds where the host and target os's match.

This change makes sure the cmake variables are passed in all cases except when the hostos isn't passed in or is
windows (host == target).
jkotas added a commit that referenced this pull request Feb 16, 2025
steveisok added a commit to steveisok/runtime that referenced this pull request Feb 18, 2025
After dotnet#112256 landed, there was a change to zip the test assets
using `ZipFile.CreateFromDirectory` for cross platform support. This regressed `unzipAssets` in `MonoRunner.java`
because it naivley assumed that directories would come before files in the zip archive.

This change fixes the problem by making sure directories are created first before writing files to disk.

Fixes dotnet#112558
steveisok added a commit that referenced this pull request Feb 18, 2025
…12654)

After #112256 landed, there was a change to zip the test assets using `ZipFile.CreateFromDirectory` for cross platform support. This regressed `unzipAssets` in `MonoRunner.java` because it naivley assumed that directories would come before files in the zip archive.

This change fixes the problem by making sure directories are created first before writing files to disk.

Fixes #112558
jkotas pushed a commit that referenced this pull request Feb 20, 2025
#112256 added the ability to cross compile android on windows. This
regressed the win-arm64 crossdac build because it stopped passing CMAKE_TARGET_ARCH and CMAKE_TARGET_OS for
cross component builds where the host and target os's match.

This change makes sure the cmake variables are passed in all cases.
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants