dreamworksanimation / openmoonray

MoonRay is DreamWorks’ open-source, award-winning, state-of-the-art production MCRT renderer.
https://openmoonray.org/
Apache License 2.0
4.32k stars 254 forks source link

Compile errors with "-Werror=format-security" #119

Open bhaveshpandey opened 1 year ago

bhaveshpandey commented 1 year ago

Is anyone else running into these errors when building Moonray?

/build/source/arras/arras4_core/arras4_log/lib/arras4_log/SyslogLogger.cc: In member function 'virtual void arras4::log::SyslogLogger::log(arras4::log::Logger::Level, const char*)':
/build/source/arras/arras4_core/arras4_log/lib/arras4_log/SyslogLogger.cc:36:39: error: format not a string literal and no format arguments [-Werror=format-security]
   36 |     syslog(sPriorities[level], message);

I am using GCC 9.3 however, I am however using a later version of glibc than suggested by the VFXPlatform CY2022 (which I feel is the one used looking at the recommended GCC version).

kjeffery commented 1 year ago

The warning is not technically wrong: the compiler is unable to verify that the string is formatted correctly.

Does it compile if you change the line to:

syslog(sPriorities[level], "%s", message);

?

bhaveshpandey commented 3 months ago

Hi @kjeffery , yes that fixes it however I run into some other issues while building moonrayShaderParser and moonrayShaderDiscovery . I could not find anyway to disable building of USD facing functionality. Is there a convenient way of doing so that you know of?