-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Description
When switching lib-lwip's memory allocation mode from Heap to Memory Pools via menuconfig, the build for the nginx application in catalog-core fails due to invalid use of GNU statement expressions in preprocessor expressions.
Steps to reproduce
- Clone catalog-core and setup according to the instructions
- Change into
nginxdirectory and enter menuconfig
make menuconfig
- Navigate to
Library Configuration -> lwip -> Memory allocation mode -> Memory pools
- Save and exit menuconfig
- Build with
make -j $(nproc)
- Observe the error
Observed Error
/home/unikraft/nginx/nginx-pan/workdir/unikraft/include/uk/essentials.h:105:10: error: token "{" is not valid in preprocessor expressions
105 | ({ \
| ^
/home/unikraft/nginx/nginx-pan/workdir/libs/lib-lwip/include/lwipopts.h:293:24: note: in expansion of macro ‘MAX’
293 | #define PBUF_POOL_SIZE MAX(((TCP_WND + TCP_MSS - 1) / TCP_MSS), 2 * IP_REASS_MAX_PBUFS)
| ^~~
...
Root Cause
The macro MAX(...) from uk/essentials.h is defined as
#define MAX(a, b) \
({ \
__typeof__(a) __a = (a); \
__typeof__(b) __b = (b); \
__a > __b ? __a : __b; \
})
This is a GNU C Statement Expression which appears to fail when used inside preprocessor directives.
Environment
- Unikraft version: 0.19.0~9603a4ab
- Host OS: Ubuntu 24.04
- Architecture: x86_64
Metadata
Metadata
Assignees
Labels
No labels