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

Fix duplicate definition errors when using unity builds #1193

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

apache-hb
Copy link
Contributor

This guards a couple of internal headers to prevent duplicate definition errors when unity builds are used via meson

@SanderMertens
Copy link
Owner

LGTM for now- is there a way this can be reproduced in CI? v4 is going to add a lot of new internal headers that might break your build (though I'm not 100% sure how it's failing).

@apache-hb
Copy link
Contributor Author

is there a way this can be reproduced in CI?

Building with meson setup build -Dunity=true -Dunity_size=200 will probably catch some errors as they pop up, unfortunately unity builds are a bit hard to reproduce perfectly.

v4 is going to add a lot of new internal headers that might break your build.

I already follow the master branch and keep it up to date, I'd be happy to make another pr once v4 releases to fix any issues that might have cropped up.

(though I'm not 100% sure how it's failing).

Unity builds cause multiple translation units to get merged together, in the case of unguarded internal headers this means symbols that were meant to be private to a single TU can leak into another TU that also defines the same symbols, causing the multiple definition errors.

@SanderMertens
Copy link
Owner

Ah ok, I'll see if that can be added to CI. Thx for the background!

@SanderMertens SanderMertens merged commit 5b47e5b into SanderMertens:master Apr 22, 2024
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants