meson icon indicating copy to clipboard operation
meson copied to clipboard

tests: add a test case for the `MACOSX_DEPLOYMENT_TARGET` env

Open kleisauke opened this issue 3 years ago • 6 comments

It could cause functions to be incorrectly detected as found when the prefix: '#include <...>' argument is omitted. This only happens when compiling with a new XCode toolchain while targeting an older macOS version.

See: https://github.com/mesonbuild/meson/issues/3482.


Context: https://github.com/lovell/sharp/issues/3438 https://github.com/lovell/sharp-libvips/pull/164

kleisauke avatar Nov 08 '22 10:11 kleisauke

Commit f96948e7c2a1d0ebc47b4f9ae662f6f4bcdc2eef didn't work, as expected.

Compiler stdout:
 
Compiler stderr:
 
Checking for function "pthread_jit_write_protect_np" : YES 

test cases/common/260 has_function darwin/meson.build:13:0: ERROR: Assert failed: not cc.has_function('pthread_jit_write_protect_np')

Let's see if commit d07a7120116009ab5391249e0a63cd091d05e55d fixes this.

kleisauke avatar Nov 08 '22 10:11 kleisauke

I think the test case could be directly included in test cases/common/36 has function/.

eli-schwartz avatar Nov 08 '22 12:11 eli-schwartz

Ah, looking at commit https://github.com/mesonbuild/meson/commit/ac58c13bbfa6c7b47cc54f30e32bd405c944076d and issue https://github.com/mesonbuild/meson/issues/3482, I think this bug only occurs when the prefix: '#include <...>' option of cc.has_function() is ommitted for these symbols. https://github.com/mesonbuild/meson/blob/e68fcac919b332c7f9469672a243d2aab1bfea0a/mesonbuild/compilers/mixins/clike.py#L813-L824

Commit 02304907749e0173d52356c0f029061c7fbfc512 adds these accordingly, let's see if the CI passes now.

kleisauke avatar Nov 08 '22 12:11 kleisauke

Codecov Report

Merging #11011 (341c917) into master (2ec3fe7) will decrease coverage by 2.62%. The diff coverage is n/a.

:exclamation: Current head 341c917 differs from pull request most recent head 7efd86a. Consider uploading reports for the commit 7efd86a to get more accurate results

@@            Coverage Diff             @@
##           master   #11011      +/-   ##
==========================================
- Coverage   68.83%   66.20%   -2.63%     
==========================================
  Files         414      207     -207     
  Lines       90016    44929   -45087     
  Branches    21278     9927   -11351     
==========================================
- Hits        61960    29744   -32216     
+ Misses      23402    12852   -10550     
+ Partials     4654     2333    -2321     
Impacted Files Coverage Δ
scripts/run_tool.py 0.00% <0.00%> (-100.00%) :arrow_down:
scripts/clangtidy.py 0.00% <0.00%> (-93.34%) :arrow_down:
templates/cstemplates.py 35.48% <0.00%> (-64.52%) :arrow_down:
scripts/coverage.py 0.00% <0.00%> (-64.36%) :arrow_down:
templates/javatemplates.py 36.66% <0.00%> (-63.34%) :arrow_down:
templates/rusttemplates.py 37.93% <0.00%> (-62.07%) :arrow_down:
templates/dlangtemplates.py 37.93% <0.00%> (-62.07%) :arrow_down:
templates/fortrantemplates.py 39.28% <0.00%> (-60.72%) :arrow_down:
scripts/clangformat.py 0.00% <0.00%> (-50.00%) :arrow_down:
modules/icestorm.py 57.14% <0.00%> (-40.00%) :arrow_down:
... and 283 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Nov 08 '22 12:11 codecov[bot]

Commit 02304907749e0173d52356c0f029061c7fbfc512 seems to fix it. Let's see if CI still passes when I revert commit d07a7120116009ab5391249e0a63cd091d05e55d.

kleisauke avatar Nov 08 '22 13:11 kleisauke

... that seems to pass CI as well. I'm not sure if Meson can do anything about this, other than what is described in https://github.com/mesonbuild/meson/issues/3482.

I reported these two upstream issues at: https://gitlab.gnome.org/GNOME/glib/-/issues/2766#note_1590861 https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/78/diffs#note_1629043

Let me know if this PR is still appropriate, it could be useful as a regression test.

kleisauke avatar Nov 08 '22 14:11 kleisauke

Rebased on top of the master branch, since the CI failures on the macOS runner do not seem to be related to this PR.

kleisauke avatar Dec 10 '22 14:12 kleisauke

I'll abandon this PR, the -Wl,-no_weak_imports linker flag logic is already covered by test cases/osx/3 has function xcode8 added in commit 97c2321740602ed43a5fbf0ca2cad53a2a622cee (unfortunately, that test is only run on XCode 8, see e.g. commit https://github.com/mesonbuild/meson/commit/d812a0c90c722b2f6183f283fa42eb26732b5762, so CI does not catch regressions for that test, IIUC). https://github.com/mesonbuild/meson/blob/100456de0761ee949e2277c97746cb8571b6ba39/mesonbuild/compilers/mixins/clang.py#L104-L110

See also the summary at https://github.com/mesonbuild/meson/pull/11011#discussion_r1045096397 for why this cannot be resolved in Meson itself when the prefix: '#include <...>' argument is omitted.

https://gitlab.gnome.org/GNOME/glib/-/issues/2766#note_1590861

FWIW, macOS 10.13 was EOL'ed 2 years ago, so it's probably not worth fixing that in GLib.

https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/78/diffs#note_1629043

This is now being tracked in issue https://gitlab.freedesktop.org/gstreamer/orc/-/issues/44. I deliberately didn't open a PR there because I don't have access to iOS devices.

kleisauke avatar Dec 12 '22 13:12 kleisauke