jamesbowman / openexrpython

OpenEXR bindings for Python
Other
95 stars 35 forks source link

Fix build issues on OSX #35

Closed ShnitzelKiller closed 5 years ago

ShnitzelKiller commented 5 years ago

This is in reference to the errors described in #32, which was caused by the wrong standard library being used and not found by the compiler, due to python being built with an earlier version of OS X before that library was deprecated. This works around that by changing the target platform in the event that this is the case.

ShnitzelKiller commented 5 years ago

However, for some reason on OS X, OpenEXR's exceptions aren't detected as derived from std::exception and don't get caught by the corresponding try/catch statements. I don't know why this is.

meshula commented 5 years ago

FWIW, OpenEXR 2.3 no longer derives its exceptions from std::exception.

ShnitzelKiller commented 5 years ago

Why would they do that exactly?

meshula commented 5 years ago

It’s not a portable construction. On Windows, std::exception is not marked for symbol export, which means sub-classing exception and marking the subclass with __declspec export, will result in undefined behavior if static members are accessed.

meshula commented 5 years ago

I’m sorry, I misspoke. Iex::BaseExc used to be multiply-derived from std::string, which introduced the problems because std::string is not marked for symbol export. It is of course still derived from std::exception. https://github.com/openexr/openexr/commit/fa59776fd83a8f35ed5418b83bbc9975ba0ef3bc