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

Automatically export '__managed__Main' when needed #105353

Merged

Conversation

Sergio0694
Copy link
Contributor

Overview

Follow up to #103504. This PR makes __managed__Main be automatically exported as well, and adds a unit test.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 23, 2024
@Sergio0694
Copy link
Contributor Author

/usr/bin/ld: CMakeFiles/CustomMainWithStubExeNative.dir/CustomMainWithStubExeNative.cpp.o: in function `main':
/__w/1/s/src/tests/nativeaot/CustomMainWithStubExe/CustomMainWithStubExeNative.cpp:26: undefined reference to `IncrementExitCode'
/usr/bin/ld: /__w/1/s/src/tests/nativeaot/CustomMainWithStubExe/CustomMainWithStubExeNative.cpp:27: undefined reference to `__managed__Main'

Mmh I think I clearly got something wrong in that CMake list. Not really familiar with it to be honest 😅

@MichalStrehovsky
Copy link
Member

Mmh I think I clearly got something wrong in that CMake list. Not really familiar with it to be honest 😅

This is linker complaining it doesn't know where to resolve the references. The test tree builds native components before managed components so there's nothing we can provide. I think the only option is to LoadLibrary/GetProcAddress here like the https://github.com/dotnet/runtime/tree/main/src/tests/nativeaot/SmokeTests/SharedLibrary test is doing.

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/auto-export-custom-native-main branch from ac80c48 to e3ce06d Compare July 29, 2024 00:55
@Sergio0694
Copy link
Contributor Author

I included those changes but the tests are still failing:

Output:
        chmod: cannot access '/datadisks/disk1/work/A93309BA/w/9EBC0916/e/nativeaot/CustomMainWithStubExe/CustomMainWithStubExe//native/CustomMainWithStubExe': No such file or directory
        /datadisks/disk1/work/A93309BA/p/nativeaottest.sh: line 15: /datadisks/disk1/work/A93309BA/w/9EBC0916/e/nativeaot/CustomMainWithStubExe/CustomMainWithStubExe//native/CustomMainWithStubExe: No such file or directory

I'm probably missing something obvious, but I'm not really familiar with the test infra here. I could use a hint 😅

@Sergio0694
Copy link
Contributor Author

@jkotas CI is green now 🎉

I think we're a little bit past the RC1 snap, do we need to go through some process to get this into .NET 9?

@jkotas
Copy link
Member

jkotas commented Jul 31, 2024

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

This is a bug-fix level change.

@jkotas
Copy link
Member

jkotas commented Jul 31, 2024

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas jkotas merged commit 3577d44 into dotnet:main Aug 1, 2024
108 of 114 checks passed
@Sergio0694 Sergio0694 deleted the user/sergiopedri/auto-export-custom-native-main branch August 1, 2024 05:56
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-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