Closed rsvensson closed 1 year ago
Hey @rsvensson , thanks for this report. This is an interesting error.
After searching for the "illegal hardware instruction" message, I've learned that this happens when the compiled binary is using an instruction code (of the CPU) that is not available on the actual CPU. (eg.: when using an avx2
instruction, while your CPU is not capable of avx2
instructions.)
If this is true, then as a maintainer of the source code of the program, I can't do much about it. It's more likely the package creation issue... As a workaround I would recommend to compile Bear from source on your machine, with the appropriate compiler flags, to ensure that it is able to run on your machine's CPU.
Thanks for your reply. Yes indeed, this was my first assumption (although as far as I know all Arch Linux packages are compatible on all x86_64 CPUs), which is why I tried compiling it from source myself as I mentioned. But in that case the unit tests are failing with the same exception even when I specify core2 as march, which I think should be enough to prevent any unsupported instructions.
I will try to compile again with a generic march rather than core2.
So compiling it with -march=x86-64
made no difference to my issue. I do understand it's out of your control though, and it's most likely some weird issue on my end. I have absolutely no idea what it could be though, and so far this is the only time I've ran into this.
Describe the bug When trying to run bear on my old laptop with a Core2Duo CPU it fails with the error 'illegal hardware instruction'. Compilation works fine and produces a working binary when not using bear. I'm using the Arch Linux package of bear, which works perfectly fine on my desktop PC using a zen3 CPU. At first I thought it was related to me using a cross-compiler, but it happens even with a simple hello world C file using standard GCC. It could of course be caused by something other than the CPU used as it does seem strange, but 'illegal hardware instruction' sounds CPU related to me.
The following backtrace is produced when running
bear --verbose -- gcc -o test test.c
with a simple hello world C file:When attempting to build bear from source, it fails the intercept and citnames unit tests with an Illegal exception as well:
This also happens even if I specify
-march=core2
as aCFLAGS
andCXXFLAGS
option. There were no further details in the test log that I could see, other than that it failed at the first step.The CPU in question is a Core2Duo T7250 with the following flags:
To Reproduce For me it's as simple as compiling any C file on a core2duo CPU on Arch Linux.
Expected behavior Bear should function correctly regardless of what X86_64 CPU I'm using.
Environment:
Thanks for making this wonderful tool. Please let me know if I can supply any additional information.