mesonbuild / mesonbuild/wrapdb

expat cmake config file case sensitivity issue if size_t not in sys/types.h

Open
#708 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Meson
Stars
118
Forks
298
Avg merge
2d 2h
Merged PRs (30d)
24

Description

If the sys/types.h header doesn't define size_t, this config.set runs in the meson.build in the expat wrap:

```
if not cc.has_header_symbol('sys/types.h', 'size_t')
config.set('size_t', 'unsigned')
endif
```
The line in the expat_config.h.cmake file looks like this:

```
/* Define to 'unsigned' if does not define. */
#cmakedefine size_t @SIZE_T@
```

From debugging mesonlib/universal.py a bit, it seems like these two symbols have to be the same case. If you specify case matching the first cmakedefine param, then you get a blank #define because it can't match the upper case SIZE_T in the confis (which in this case defines size_t to nothing which makes for all sorts of fun), if you specify upper case SIZE_T then it doesn't do the substitution at all and you undef size_t. Doesn't seem like there's a way to fix this without modifying the cmake file, maybe in the patch file to make the second var lowercase. Or, is cmake case insensitive and meson should match size_t to SIZE_T for the substitution?

If I change it to `#cmakedefine size_t @size_t@` it works as expected and outputs `#define size_t unsigned`

Chris

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the expat wrap's meson.build and expat_config.h.cmake, then read the relevant substitution logic in mesonlib/universal.py. Compare how size_t and SIZE_T are matched during configuration. The fix is complete when the generated config defines size_t as unsigned when sys/types.h does not provide it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.