The #4486 fix for `CACHELINE_SIZE` probe on qemu-user is incomplete, libzmq v4.3.5 compilation still fails
envgap__zeromq__libzmq-4834
01 / FAILURE SIGNATURE
As reported upstream
error: ‘undefined’ was not declared in this scope
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
00f12d22f3e1413b65665b288d665923af90df2e- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
zeromq/libzmq #4834 · read the original issue
There is an already merged past PR trying to fix a compilation error on s390x when running in qemu-user emulation.
* https://github.com/zeromq/libzmq/pull/4486
## Steps to reproduce
I am still seeing this issue happening for myself:
(https://github.com/opendatahub-io/notebooks/actions/runs/21263557165/job/61196980881#step:19:2288)
```
/tmp/tmp2d4gyw1v/build/_deps/bundled_libzmq-src/src/curve_client.cpp:3:
/tmp/tmp2d4gyw1v/build/_deps/bundled_libzmq-build/platform.hpp:22:28:
error: ‘undefined’ was not declared in this scope
22 | #define ZMQ_CACHELINE_SIZE undefined
| ^~~~~~~~~
/tmp/tmp2d4gyw1v/build/_deps/bundled_libzmq-src/src/command.hpp:191:26:
note: in expansion of macro ‘ZMQ_CACHELINE_SIZE’
191 | __attribute__ ((aligned (ZMQ_CACHELINE_SIZE)))
| ^~~~~~~~~~~~~~~~~~
```
This is PyZMQ building the bundled libzmq.
## Investigation
```
cmake -P /dev/stdin <<'EOF'
set(CACHELINE_SIZE "undefined")
if(CACHELINE_SIZE STREQUAL ""
OR CACHELINE_SIZE EQUAL 0
OR CACHELINE_SIZE EQUAL -1
OR CACHELINE_SIZE EQUAL "undefined")
set(ZMQ_CACHELINE_SIZE 64)
else()
set(ZMQ_CACHELINE_SIZE ${CACHELINE_SIZE})
endif()
message(STATUS "ZMQ_CACHELINE_SIZE: ${ZMQ_CACHELINE_SIZE}")
EOF
```
produces
-- ZMQ_CACHELINE_SIZE: undefined
## Suggested fix
Use [`STREQUAL`](https://cmake.org/cmake/help/latest/command/if.html#strequal) instead of [`EQUAL`](https://cmake.org/cmake/help/latest/command/if.html#equal) to compare with the `"undefined"` string.
Perform the STREQUAL exact-match string comparisons first and the coercing EQUAL comparisons only after that.
```
cmake -P /dev/stdin <<'EOF'
set(CACHELINE_SIZE "undefined")
if(CACHELINE_SIZE STREQUAL ""
OR CACHELINE_SIZE STREQUAL "undefined"
OR CACHELINE_SIZE EQUAL 0
OR CACHELINE_SIZE EQUAL -1)
set(ZMQ_CACHELINE_SIZE 64)
else()
set(ZMQ_CACHELINE_SIZE ${CACHELINE_SIZE})
endif()
message(STATUS "ZMQ_CACHELINE_SIZE: ${ZMQ_CACHELINE_SIZE}")
EOF
```04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]