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 check for tizen in ilc and crossgen2 #90310

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

ashaurtaev
Copy link
Contributor

@ashaurtaev ashaurtaev commented Aug 10, 2023

Fix tizen x64 build error:

ILCompiler -> /home/runtime/artifacts/bin/coreclr/linux.x64.Release/ilc/ilc.dll
Generating native code
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find crtbeginS.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find -lgcc: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find -lgcc: No such file or directory
clang : error : linker command failed with exit code 1 (use -v to see invocation) [/home/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]
/home/runtime/.packages/microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/build/Microsoft.NETCore.Native.targets(360,5): error MSB3073: The command ""/usr/bin/clang-14" --gcc-toolchain=/home/runtime/.tools/rootfs/x64/usr "/home/runtime/artifacts/obj/coreclr/ILCompiler/x64/Release/native/ilc.o" -o "/home/runtime/artifacts/bin/coreclr/linux.x64.Release/ilc/native/ilc" -fuse-ld=bfd /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/sdk/libbootstrapper.o /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/sdk/libRuntime.ServerGC.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/sdk/libeventpipe-enabled.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/sdk/libstdc++compat.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/framework/libSystem.Native.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/framework/libSystem.Globalization.Native.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/framework/libSystem.IO.Compression.Native.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/framework/libSystem.Net.Security.Native.a /home/runtime/.packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-rc.1.23401.3/framework/libSystem.Security.Cryptography.Native.OpenSsl.a --sysroot=/home/runtime/.tools/rootfs/x64 -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -pthread -ldl -lz -lrt -lm -pie -Wl,-pie -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr --target=x86_64-linux-gnu -Wl,--discard-all -Wl,--gc-sections" exited with code 1. [/home/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]
  1. Create tizen x64 rootfs
    sudo ./eng/common/cross/build-rootfs.sh x64 tizen

  2. Build command:
    ROOTFS_DIR=/home/runtime/.tools/rootfs/x64 ./build.sh --portablebuild false --cross --clang --arch x64 --runtimeConfiguration Release --librariesConfiguration Release --subset clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools+libs.native /p:EnableSourceLink=false /p:UseSharedCompilation=false

cc @gbalykov @alpencolt @t-mustafin

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Aug 10, 2023
@jkotas jkotas requested a review from sbomer August 14, 2023 18:08
@jkotas
Copy link
Member

jkotas commented Aug 14, 2023

@sbomer Could you please take a look? (This condition was introduced with the switch to Mariner-backed official builds.)

@@ -15,7 +15,7 @@
<!-- Disable native AOT on FreeBSD when cross building from Linux. -->
<NativeAotSupported Condition="'$(TargetOS)' == 'freebsd' and '$(CrossBuild)' == 'true'">false</NativeAotSupported>
<PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot>
<SysRoot Condition="'$(NativeAotSupported)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<SysRoot Condition="'$(NativeAotSupported)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows' and $(OutputRID.StartsWith('tizen')) != 'true'">$(ROOTFS_DIR)</SysRoot>
Copy link
Member

Choose a reason for hiding this comment

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

The condition is becoming more complex and it is dupicated in 4 places. Should we move it to more central location to deduplicate it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to remake the solution to use NativeAotSupported condition on the advice of @sbomer and not to complicate the state of the SysRoot condition.

@sbomer
Copy link
Member

sbomer commented Aug 14, 2023

Is the AOT'd ILCompiler expected to run on tizen? Since the tizen build is a cross-build with a tizen rootfs, I think it makes sense to honor the CrossBuild setting here (without knowing much else about the tizen build). If the intention is to avoid producing an AOT'd crossgen to run on tizen, maybe it would be better to add the condition to NativeAotSupported instead?

@ashaurtaev
Copy link
Contributor Author

Is the AOT'd ILCompiler expected to run on tizen? Since the tizen build is a cross-build with a tizen rootfs, I think it makes sense to honor the CrossBuild setting here (without knowing much else about the tizen build). If the intention is to avoid producing an AOT'd crossgen to run on tizen, maybe it would be better to add the condition to NativeAotSupported instead?

Yes, it is expected to work in the future. Created the solution with NativeAotSupported condition.

@jkotas
Copy link
Member

jkotas commented Aug 17, 2023

@sbomer Does this look good to you as well?

@jkotas jkotas merged commit b0368ec into dotnet:main Aug 17, 2023
108 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-crossgen2-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants