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

Add support for Linux host #2

Open
MichalStrehovsky opened this issue Jul 18, 2023 · 1 comment
Open

Add support for Linux host #2

MichalStrehovsky opened this issue Jul 18, 2023 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@MichalStrehovsky
Copy link
Owner

We're currently limited to Windows host because I was lazy to write the clang shim batch file in Bash.

@echo off
@where zig >nul 2>&1
@if ERRORLEVEL 1 (
echo Error: zig is not on the PATH. Install zig and make sure it's on PATH. Follow instructions at https://github.com/MichalStrehovsky/PublishAotCross.
exit /B 1
)
set args=%*
rem Works around zlib not being available with zig. This is not great.
set args=%args:-lz =%
rem Work around a .NET 8 Preview 6 issue
set args=%args:'-Wl,-rpath,$ORIGIN'=-Wl,-rpath,$ORIGIN%
rem Work around parameters unsupported by zig. Just drop them from the command line.
set args=%args:--discard-all=--as-needed%
set args=%args:-Wl,-pie =%
set args=%args:-pie =%
rem Works around zig linker dropping necessary parts of the executable.
set args=-Wl,-u,__Module %args%
rem Run zig cc
zig cc %args%

Windows host is also guarded here:

<Import Project="Crosscompile.targets" Condition="$(RuntimeIdentifier.Contains('linux')) and $([MSBuild]::IsOSPlatform('Windows'))" />

@MichalStrehovsky MichalStrehovsky added help wanted Extra attention is needed good first issue Good for newcomers labels Jul 18, 2023
@scgm0
Copy link

scgm0 commented Oct 17, 2024

I managed to get Linux to Windows cross-compilation working via msvc-wine; may I file a PR for that?
demo: https://github.com/scgm0/NativeAotTest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants