lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

Undefined behavior sanitizer fails Debug build with GCC 4.8.x #147

Closed fischermario closed 8 years ago

fischermario commented 8 years ago

I tried to build the latest lwan under Ubuntu 14.04 (gcc 4.8.4) with

cmake .. -DCMAKE_BUILD_TYPE=Debug

and got this after starting make:

Scanning dependencies of target mimegen [ 2%] Building C object common/CMakeFiles/mimegen.dir//tools/mimegen.c.o cc: error: unrecognized command line option ‘-fsanitize=undefined’ make[2]: * [common/CMakeFiles/mimegen.dir//tools/mimegen.c.o] Error 1 make[1]: * [common/CMakeFiles/mimegen.dir/all] Error 2 make: *\ [all] Error 2

The reason for this error is the GCC version. I found out that you need

I have attached a patch to correct the behavior of cmake and to make the right decision: lwan_sanitizer_20160520.patch.txt

In the long run I would recommend to stick to a tested solution like: https://github.com/arsenm/sanitizers-cmake

lpereira commented 8 years ago

Applied the patch, thank you! I've starred the sanitizers-cmake repository, so that I can eventually use it.