mmp / pbrt-v2

Source code for the version of pbrt described in the second edition of "Physically Based Rendering"
http://pbrt.org
989 stars 343 forks source link

incompatiable with gcc 4.8.2 #16

Closed zhou13 closed 10 years ago

zhou13 commented 10 years ago

On linux, I got a segmentation fault on some serene. This happens on gcc-4.8.2. But it seems work fine on gcc-4.7.

segmentation fault  pbrt killeroo-gold.pbrt
mmp commented 10 years ago

Unfortunately I'm having trouble finding a linux system with gcc 4.8.2. Could you recompile pbrt with debugging enabled (e.g. 'make OPT=-g') and run it under a debugger and send a stack trace for where it's crashing? I'd definitely like to fix this!

BachiLi commented 10 years ago

This is actually caused by a bug in std::nth_element in gcc, as pbrt uses nth_element for BVH construction, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800

mmp commented 10 years ago

Nice find--thanks! In a7bf7eaea319f7927ceb478cd3df95545e5e1d14, I've added a check for g++ 4.8.2 in core/pbrt.h; it will issue an error if that version is used.

cgmb commented 9 years ago

a7bf7eaea319f7927ceb478cd3df95545e5e1d14 is a rather frustrating solution. GCC 4.8.2 is the version used by both Ubuntu 14.04 and CentOS 7. Both distributions patched the bug, but the #error forces the build to fail anyways.