-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Underscore prefix detection broken if -g specified #5482
Comments
This fixes the meson underscore prefix test, which misbehaves when -g is passed, as it would detect the debug string without underscore first and incorrectly report that no underscore prefix for symbols is used. Fixes build issues with dav1d, which relies on the underscore prefix check. See: mesonbuild/meson#5482 Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
This fixes the meson underscore prefix test, which misbehaves when -g is passed, as it would detect the debug string without underscore first and incorrectly report that no underscore prefix for symbols is used. Fixes build issues with dav1d, which relies on the underscore prefix check. See: mesonbuild/meson#5482 Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
@jpakkane Possible solutions for this:
Personally I am in favor of the second option. |
Or possibly filter out |
@jpakkane That might work, although not sure whats the easiest way to do that? Especially if any compiler would use multiple args for that. Is there a way to filter part fo a list with another list in order, like:
|
filtered = [x for x in original_list if x not in things_to_take_out] |
That won't respect order though, so could lead to wrong, confusing, results:
|
This fixes the meson underscore prefix test, which misbehaves when -g is passed, as it would detect the debug string without underscore first and incorrectly report that no underscore prefix for symbols is used. Fixes build issues with dav1d, which relies on the underscore prefix check. See: mesonbuild/meson#5482 Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr> (cherry picked from commit 3426d7bcf98fee15c239ea2b3d815c613df82efe) Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
@jpakkane So the filtering approach is not really that feasible given that there are other flags than |
…gs to work around meson bug meson bug: mesonbuild/meson#5482
I just ran into this when updating from meson 0.51.0 and after 976c303 I had to strip |
…gs to work around meson bug meson bug: mesonbuild/meson#5482
…gs to work around meson bug meson bug: mesonbuild/meson#5482
|
I've also had to drop |
Reproduced on debug builds when Conan passes additional '-g' flag to CFLAGS. Meson fails to drop duplicate '-g' flags and the dav1d check 'cc.symbols_have_underscore_prefix' fails which leads to undefined symbols while linking. Seems like bug introduced after 0.51.0, upstream ref mesonbuild/meson#5482 Correct behaviour can be checked by locating string '%define PREFIX 1' in the generated config.asm.
* Add dav1d/0.8.1 * Use dl, pthread * Add bin to PATH Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * Add pkg_config anme * Enable assembly option by default * Bump * Downgrade to meson 0.51.0 due to prefix detection bug Reproduced on debug builds when Conan passes additional '-g' flag to CFLAGS. Meson fails to drop duplicate '-g' flags and the dav1d check 'cc.symbols_have_underscore_prefix' fails which leads to undefined symbols while linking. Seems like bug introduced after 0.51.0, upstream ref mesonbuild/meson#5482 Correct behaviour can be checked by locating string '%define PREFIX 1' in the generated config.asm. * Fix topics * Drop pdb from lib/ * Disable assembly for debug msvc * Fix typo Co-authored-by: Chris Mc <prince.chrismc@gmail.com> Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
|
@xry111 Why would 2. not work here? |
@ePirat with |
…gs to work around meson bug meson bug: mesonbuild/meson#5482
This is due to a bug in meson where it will not detect properly the compiler if the symbols need an undercore. mesonbuild/meson#5482 Fixes #821 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/845>
The cc.symbols_have_underscore_prefix() test in dav1d/meson.build returns the incorrect value (true) if -fprofile-instr-generate is specified in the CFLAGS environment variable. This is apparently a bug in Meson's symbols_have_underscore_prefix() function. See mesonbuild/meson#5482. Work around this bug by adding a special case for Linux in dav1d/meson.build. Part 1 of the fix for https://crbug.com/oss-fuzz/38512. Part 2 of the fix is to change oss-fuzz/projects/libavif/build.sh to run "bash dav1d_oss_fuzz.sh" instead of "bash dav1d.cmd".
The cc.symbols_have_underscore_prefix() test in dav1d/meson.build returns the incorrect value (true) if -fprofile-instr-generate is specified in the CFLAGS environment variable. This is apparently a bug in Meson's symbols_have_underscore_prefix() function. See mesonbuild/meson#5482. Work around this bug by adding a special case for Linux in dav1d/meson.build. Part 1 of the fix for https://crbug.com/oss-fuzz/38512. Part 2 of the fix is to change oss-fuzz/projects/libavif/build.sh to run "bash dav1d_oss_fuzz.sh" instead of "bash dav1d.cmd".
Similar to the problem with GCC's The following commands reproduce a linker error caused by this bug when building the dav1d library with Clang's
You will see a lot of "undefined reference" linker errors. The problem is that the following code in dav1d/meson.build malfunctions and incorrectly adds an underscore prefix to symbols defined in assembly language files:
|
upstream dav1d will move away from meson's |
As per discussion on IRC / Matrix with @ePirat, underscore detection will be moved to a hardcoded list based on toolchain and platform, and we will move the current broken compile check to a unit test that compares the compile check against the hardcoded list. We could use things like |
@ePirat do you have a draft branch / PR to implement the hard-coded list of underscore + toolchain + platform combination? We hit this in gstreamer again recently: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/978 |
@nirbheek Doing that is really tricky given the amount of platforms meson already supports, but I found a much better solution, will submit the PR for this probably tomorrow evening. |
22.04 has a buggy meson that breaks with -flto See: mesonbuild/meson#9989 mesonbuild/meson#5482
This is not an issue currently, due to #5481 hiding this bug but once that is solved, it will become an issue again.
If the cflags contain
-g
, the test for the underscore symbol would incorrectly return as soon as it finds the symbol with or without underscore, but when debug symbols are enabled using-g
, this will yield the false result. This can easily be illustrated by a small testcase:Would print:
as it first finds the symbol without the underscore, only later finds the symbol with underscore.
Of course this is not an issue when using the meson buildtype option, as meson will not use the
-g
argument from that for the test, but is an issue when-g
is contained in externally provided flags by env variables or crossfile.The text was updated successfully, but these errors were encountered: