libjxl: Building libjxl dependency Highway 0.14.0 halfway results in "Error running executable: Illegal instruction"
Hello. Hopefully I’m doing this right.
Describe the bug
I am trying to build libjxl (0.5) from the Arch Linux User Repository (AUR) and halfway while building its dependency Highway (0.14.0) from the AUR also , I get this error when I am using the GCC:
[ 56%] Building CXX object CMakeFiles/highway_test.dir/hwy/highway_test.cc.o
[ 58%] Linking CXX executable tests/highway_test
CMake Error at /usr/share/cmake-3.21/Modules/GoogleTestAddTests.cmake:77 (message):
Error running test executable.
Path: '/home/kylxbn/.cache/paru/clone/highway/src/build/tests/highway_test'
Result: Illegal instruction
Output:
Call Stack (most recent call first):
/usr/share/cmake-3.21/Modules/GoogleTestAddTests.cmake:173 (gtest_discover_tests_impl)
make[2]: *** [CMakeFiles/highway_test.dir/build.make:102: tests/highway_test] Error 1
make[2]: *** Deleting file 'tests/highway_test'
make[2]: Leaving directory '/home/kylxbn/.cache/paru/clone/highway/src/build'
make[1]: *** [CMakeFiles/Makefile2:368: CMakeFiles/highway_test.dir/all] Error 2
make[1]: Leaving directory '/home/kylxbn/.cache/paru/clone/highway/src/build'
make: *** [Makefile:146: all] Error 2
make: Leaving directory '/home/kylxbn/.cache/paru/clone/highway/src/build'
==> ERROR: A failure occurred in build().
Aborting...
error: failed to build 'highway-0.14.0-1':
When I try using the clang compiler, I get this:
[ 56%] Building CXX object CMakeFiles/highway_test.dir/hwy/highway_test.cc.o
[ 58%] Linking CXX executable tests/highway_test
CMake Error at /usr/share/cmake-3.21/Modules/GoogleTestAddTests.cmake:77 (message):
Error running test executable.
Path: '/home/kylxbn/.cache/paru/clone/highway/src/build/tests/highway_test'
Result: Illegal instruction
Output:
Call Stack (most recent call first):
/usr/share/cmake-3.21/Modules/GoogleTestAddTests.cmake:173 (gtest_discover_tests_impl)
make[2]: *** [CMakeFiles/highway_test.dir/build.make:102: tests/highway_test] Error 1
make[2]: *** Deleting file 'tests/highway_test'
make[2]: Leaving directory '/home/kylxbn/.cache/paru/clone/highway/src/build'
make[1]: *** [CMakeFiles/Makefile2:368: CMakeFiles/highway_test.dir/all] Error 2
make[1]: Leaving directory '/home/kylxbn/.cache/paru/clone/highway/src/build'
make: *** [Makefile:146: all] Error 2
make: Leaving directory '/home/kylxbn/.cache/paru/clone/highway/src/build'
This has been happening since libjxl 0.3.x days (not sure if even older versions are affected, since I only tried compiling 0.3.x), and I was thinking that it was just that my CPU is really old (since it doesn’t support SSE 4.2). But I guess I better ask for confirmation regarding this, too.
To Reproduce
I have Paru as my AUR helper, and just trying to install libjxl with it will trigger the error.
paru -S libjxl
It seems to be failing while building the test binaries for Highway. I’m not really familiar with how Highway works, but it looks like it will build test executables, then try to execute it. However, maybe because of that missing SSE 4.2 support on my CPU, some inline assembly code fails to run, resulting in that “Illegal instruction” error and the build failing.
Expected behavior
I was hoping that an Illegal instruction error would not occur.
Environment
- OS: Arch Linux with GNU/Linux 5.13.7-zen1-1-zen (Zen kernel)
- Desktop: KDE Plasma 5.22.4
- Multimedia: PipeWire 0.3.32 and Wayland 1.19 (with xorg-xwayland 21.1.2)
- Compiler version: GNU GCC 11.1.0 and Clang 12.0.1
- Compile flags: Please see below
- Terminal: yakuake
- Shell: bash 5.1.008
- CPU type: Intel Core 2 Duo P8400 (x86_64) @ 2.26GHz
- CPU flags:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm pti tpr_shadow vnmi flexpriority vpid dtherm ida - Hardware: 4GB RAM, 140GB HDD, Dell Latitude E5400
- cjxl/djxl version string: cjxl v0.5 (not sure if that’s how it’s shown–I wasn’t able to compile cjxl due to dependency problems)
Compile flags:
CARCH="x86_64"
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,zelro,-z,now"
Additional context
This is an old laptop and it probably does not support SSE 4.2. While using SIMD instructions is cool and all, maybe a fallback to good old x86_64 ISA would be good if the CPU does not support SIMD? I’m honestly not even sure if the compiler can detect it and if it can be done with stuff like preprocessor commands, but… Just a suggestion? I’m honestly not that familiar with C++.
This was how the build files were generated when I am using GCC
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HWY_EMSCRIPTEN
-- Performing Test HWY_EMSCRIPTEN - Failed
-- Found GTest: /usr/lib64/cmake/GTest/GTestConfig.cmake (found version "1.11.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kylxbn/.cache/paru/clone/highway/src/build
and this is for clang:
-- The C compiler identification is Clang 12.0.1
-- The CXX compiler identification is Clang 12.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HWY_EMSCRIPTEN
-- Performing Test HWY_EMSCRIPTEN - Failed
-- Found GTest: /usr/lib64/cmake/GTest/GTestConfig.cmake (found version "1.11.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kylxbn/.cache/paru/clone/highway/src/build
Hopefully this is useful! Please tell me if I can provide any more details and I would happily help.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- skip nanobenchmarks if rdtscp is not supported. Refs https://github.com/libjxl/libjxl/issues/408, thanks @error256 PiperOrigin-RevId: 394184820 — committed to google/highway by jan-wassenberg 3 years ago
- skip nanobenchmarks if rdtscp is not supported. Refs https://github.com/libjxl/libjxl/issues/408, thanks @error256 PiperOrigin-RevId: 394184820 — committed to google/highway by jan-wassenberg 3 years ago
- skip nanobenchmarks if rdtscp is not supported. Refs https://github.com/libjxl/libjxl/issues/408, thanks @error256 PiperOrigin-RevId: 394187316 — committed to google/highway by jan-wassenberg 3 years ago
Sure! I have some learning to do (I know what GDB, disassembly, stack traces, etc. are, but I have never used GDB before so this will be a new experience 😛 )
I’ll get back as soon as I have the data to report!
Thank you very much for being patient with me! I sincerely appreciate it.