Skip to content

Conversation

@jkoritzinsky
Copy link
Member

Compile the repo minipal as an object and static library for usage across the product as a single unit instead of separate source files.

…ross the product as a single unit instead of separate source files.
@jkotas
Copy link
Member

jkotas commented Oct 16, 2024

I can try linking the minipal into libSystem.Native as well, but I think I'll get duplicate symbol errors.

I think you want to tweak the order of libraries passed to the linker and/or ship minipal as a separate library.

@jkoritzinsky
Copy link
Member Author

Yeah I'll probably end up having to ship it as a separate library. I was hoping not to, but that's likely the easiest option all-around.

@am11
Copy link
Member

am11 commented Oct 16, 2024

I'll get duplicate symbol errors.

rt-sz and /ba are green. We only get duplicate errors without PRIVATE modifier, which we have, so it's all good. 👍

@jkotas
Copy link
Member

jkotas commented Oct 16, 2024

/ba is not green. Mono AOT tests are failing with:

/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018: duplicate symbol '_minipal_get_length_utf8_to_utf16' in: [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018:     /tmp/helix/working/A4E308C2/w/B6300A50/e/publish/libmonosgen-2.0.a(utf8.c.o) [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018:     /tmp/helix/working/A4E308C2/w/B6300A50/e/publish/libSystem.Native.a(utf8.c.o) [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018: ld: 14 duplicate symbols for architecture arm64 [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018: clang: error: linker command failed with exit code 1 (use -v to see invocation) 

@am11
Copy link
Member

am11 commented Oct 16, 2024

/ba is not green. Mono AOT tests are failing with:

/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018: duplicate symbol '_minipal_get_length_utf8_to_utf16' in: [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018:     /tmp/helix/working/A4E308C2/w/B6300A50/e/publish/libmonosgen-2.0.a(utf8.c.o) [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018:     /tmp/helix/working/A4E308C2/w/B6300A50/e/publish/libSystem.Native.a(utf8.c.o) [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018: ld: 14 duplicate symbols for architecture arm64 [/private/tmp/helix/working/A4E308C2/w/B6300A50/e/publish/ProxyProjectForAOTOnHelix.proj]
/tmp/helix/working/A4E308C2/p/build/common/LibraryBuilder.targets(28,5): error MSB4018: clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Ah, I had to scroll up a bit to see the first node 🙈

@am11
Copy link
Member

am11 commented Oct 16, 2024

Reorder libraries on the command line when linking for Unix.

Now that we switched to ILC's LKG packages, will it help? Fixing mono is pretty simple in comparison. :)

@jkoritzinsky
Copy link
Member Author

Given how much I've had to fight mono to get symbols working right here in the first place, I really don't think fixing mono is easier. In fact, I see it as significantly more difficult to fix that various different build configurations (it's really easy to end up with a configuration in Mono where you don't have the symbols available at all while also having one where you have symbol duplicates).

@jkoritzinsky
Copy link
Member Author

I think I got the library order right now. Can I get another round of reviews?

@jkoritzinsky jkoritzinsky merged commit a5eced4 into dotnet:main Oct 17, 2024
@jkoritzinsky jkoritzinsky deleted the minipal-objlib branch October 17, 2024 21:14
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2024
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.

7 participants