YafaRay / libYafaRay

libYafaRay is a free open-source montecarlo raytracing engine released under the LGPL 2.1 license. Raytracing is a rendering technique for generating realistic images by tracing the path of light through a 3D scene.
http://www.yafaray.org
61 stars 8 forks source link

Issue building with clang #9

Closed waebbl closed 2 years ago

waebbl commented 2 years ago

I received a report from our testing team with an issue building libYafaRay v3.5.1 with clang (possibly using libcxx from clang instead of standard c++ library from gcc) on Gentoo Linux.

The error is

/var/tmp/portage/media-gfx/yafaray-3.5.1-r1/work/libYafaRay-3.5.1/include/core_api/surface.h:118:19: error: no member named 'numeric_limits' in namespace 'std'

A full build log can be seen with the bug report at https://bugs.gentoo.org/830949

I'm the maintainer of the package in Gentoo. Don't hesitate to request any more input from me, if needed or if I can be of support in resolving this.

DavidBluecame commented 2 years ago

Hello,

Sorry for my late reply, it's been a few complicated days :)

I think this is caused by a missing header that for some reason does not cause issues when using gcc, etc. I'll take a look asap. Thanks for reporting this!

DavidBluecame commented 2 years ago

I've tried to replicate this issue in Ubuntu 20.04LTS, using clang-12 but I have been unable to. It builds v3.5.1 correctly.

Installing Gentoo just to test this would be way too time consuming for me, unfortunately.

However I think (but I cannot test this) that adding this line to the list of includes within any header/source files that break with that error should fix the problem.

#include <limits>

As v3 is no longer under development, perhaps they can add this kind of patch in the Gentoo building process so we don't have to change the source upstream just for this?

Please let me know if this helps or if you need any further actions. Thanks!

DavidBluecame commented 2 years ago

Just a reference about this problem, seems that some compilers are starting to require more explicit headers inclusion in recent versions: https://stackoverflow.com/questions/4798936/numeric-limits-was-not-declared-in-this-scope-no-matching-function-for-call-t

DavidBluecame commented 2 years ago

I'll take this into account for v4 development.

waebbl commented 2 years ago

Thanks for looking into this. I'm gonna check if adding the limits header file will solve this.

waebbl commented 2 years ago

Adding #include <limits> in include/core_api/surface.h solved the issue with clang compiler.

DavidBluecame commented 2 years ago

Thanks for letting me know, closing :-)