-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Vala: unity build should merge Vala code, not C code #5280
Comments
If this build with just
But if I try to build it with
|
This problem still exists. The correct way for unity builds for Vala code is merging the Vala code not the generated C code. I tested with:
I have created a workaround that checks if building a unity build with I've attached that workaround and sample code for reproducing this issue. |
Our approach to unity builds with vala is broken, you cannot unify the generated C files, as they contain duplicate symbols. We would need to instead combine the files while they are still in their vala form, then convert that to C and compile the unified C file. This does not fix the linked issue, as this removed the ability to do vala unity builds, but it does allow running vala with `--unity=on`. Related: mesonbuild#5280
Our approach to unity builds with vala is broken, you cannot unify the generated C files, as they contain duplicate symbols. We would need to instead combine the files while they are still in their vala form, then convert that to C and compile the unified C file. This does not fix the linked issue, as this removed the ability to do vala unity builds, but it does allow running vala with `--unity=on`. Related: #5280
Our approach to unity builds with vala is broken, you cannot unify the generated C files, as they contain duplicate symbols. We would need to instead combine the files while they are still in their vala form, then convert that to C and compile the unified C file. This does not fix the linked issue, as this removed the ability to do vala unity builds, but it does allow running vala with `--unity=on`. Related: mesonbuild#5280
Meson currently does not support unity builds for vala sources out of the box: Older versions of Meson will try to unify the resulting C sources which fails because unifying them leads to duplicated symbols. Newer versions of Meson will simply refuse to unify vala sources and print a warning message. This commit introduces a bash script which simply checks if a unity build is requested and replaces all vala source files with a concatenation of those source files. This work-around works with both the older and newer behavior of Meson although the newer versions will still print a warning. This is a work-around for the following Meson bug: Vala: unity build should merge Vala code, not C code mesonbuild/meson#5280
When 2 C files generated from vala code merged in C code - unity builds failed almost always, because there are duplicated hidden C function.
Simple example included:
meson-bug.tar.gz
The text was updated successfully, but these errors were encountered: