> if cross-compiling a 32-bit build on a 64-bit host, then you must
invoke cmake with option "-DCMAKE_SYSTEM_PROCESSOR=i386".
$ make clean
$ cmake -DCMAKE_SYSTEM_PROCESSOR=i386 .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/constantine/Projects/piglit
[ 0%] Generating tests/util/piglit-dispatch-gen.c, tests/util/piglit-dispatch-gen.h, tests/util/piglit-util-gl-enum-gen.c
[ 0%] Built target piglit_dispatch_gen
[ 0%] Building C object target_api/no_api/tests/util/CMakeFiles/piglitutil.dir/piglit-log.c.o
[ 0%] Building C object target_api/no_api/tests/util/CMakeFiles/piglitutil.dir/piglit-util.c.o
[ 0%] Building C object target_api/no_api/tests/util/CMakeFiles/piglitutil.dir/piglit-util-egl.c.o
[interrupt output skipped]
$ file target_api/no_api/tests/util/CMakeFiles/piglitutil.dir/piglit-log.c.o
target_api/no_api/tests/util/CMakeFiles/piglitutil.dir/piglit-log.c.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
cmake version: 3.7.2
make version: GNU Make 4.2.1
I build 32bit piglit by adding -m32 CFLAGS and CXXFLAGS environment variables during cmake invocation.
If that works for you, please send a patch for the README to the mailing list.
I tried cleaning, then calling
CFLAGS=-m32 CXXFLAGS=-m32 cmake -DCMAKE_SYSTEM_PROCESSOR=i386 .
but `make` still builds x86-64 objects for me. Oh well. I just thought someone have a solution offhand. I'll look at it later, probably on holydays.
I sent a patch https://lists.freedesktop.org/archives/piglit/2017-March/021855.html
But what's interesting: it worked on the other PC, but now, at home, I built piglit, ran it, and it started skipping tests. Great. Turns out, it again built 64 bit instead of 32 bit, even with the known to work option. Unbelievable, they're even the same systems.
Turns out, cmake somehow retains flags of the old run(s), that's why the inconsistent results. The correct way to build 32-on-64 (I tested it by removing the source, and git-cloning it again):
cmake -DCMAKE_SYSTEM_PROCESSOR=x86 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 .
I'll write later the superseeding patch to README.
Fixed by https://cgit.freedesktop.org/piglit/commit/?id=7a6474d3a2fd58ada4bd003e309b4bf018d28ea0