libarchive: zstd feature check via cc.has_header_symbol() fails with internal (subproject) dependency
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- build-system
Research direction
Start in meson.build around line 802 and compare the zstd block with the liblzma handling above it. Reproduce the configuration with zstd supplied through a subproject fallback; done means the build configures successfully and sets the zstd feature checks according to the dependency version.
Written by the indexing model from the issue text.
Description
Bug report
Line 802 of meson.build says:
we can't use cc.has_function() on dependencies since they might be
internal, so check headers instead
However, the zstd block just below does exactly what this comment warns
against, but with cc.has_header_symbol() instead of cc.has_function():
foreach sym : ['ZSTD_compressStream', 'ZSTD_minCLevel']
if cc.has_header_symbol(
'zstd.h',
sym,
dependencies: zstd_dep,
)
cc.has_header_symbol() has the same limitation as cc.has_function():
it rejects internal dependencies in the dependencies: kwarg. This
fails with:
meson.build:347:10: ERROR: Dependencies must be external dependencies
To reproduce
Use zstd via a subproject fallback (i.e. dependency('libzstd', ...)
resolves through fallback:/wrap, not pkg-config/cmake), for example
when zstd isn't installed system-wide and libarchive is built as a
subproject with zstd=enabled.
Environment
- Meson 1.12.0
- libarchive 3.8.9
Suggested fix
Replace the has_header_symbol() calls with a version check, since
Dependency.version() works for both internal and external
dependencies (see liblzma handling a few lines above for a similar
pattern already in this file):
zstd_version = zstd_dep.version()
if zstd_version == 'unknown' or zstd_version.version_compare('>=1.0.0')
cdata.set('HAVE_ZSTD_compressStream', 1)
endif
if zstd_version == 'unknown' or zstd_version.version_compare('>=1.4.0')
cdata.set('HAVE_ZSTD_minCLevel', 1)
endif
I've tested this patch locally and it resolves the issue while keeping
zstd statically linked via a subproject.
- Dominant language
- Meson
- Stars
- 118
- Forks
- 298
- Avg merge
- 2d 14m
- Merged PRs (30d)
- 25
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mesonbuild/wrapdb
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mesonbuild/wrapdb#2734 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
mesonbuild/wrapdb#2717 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
mesonbuild/wrapdb#2789 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
mesonbuild/wrapdb#2772 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
mesonbuild/wrapdb#2770 ·
All issues in mesonbuild/wrapdb
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oSoWoSo/vOid_Community_repOsitory#147 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
agentic-workflows cascade-suspected
Difficulty 1/5 Under an hour Newbie friendliness 88/100