openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] Issue when compiling with MinGW and pthreads


From: Nick Porcino
Subject: Re: [Openexr-devel] Issue when compiling with MinGW and pthreads
Date: Wed, 3 Jan 2018 23:49:01 +0000

That makes sense to me.


From: Openexr-devel <openexr-devel-bounces+address@hidden> on behalf of Etienne Sandré-Chardonnal <address@hidden>
Sent: Wednesday, January 3, 2018 7:26:52 AM
To: address@hidden
Subject: [Openexr-devel] Issue when compiling with MinGW and pthreads
 
Dear OpenEXR developpers,

I have an old issue when building IlmBase with MinGW, which is still there in 2.2.1

MinGW comes in two thread API flavors : the win32 or pthreads API. The most widely used is the pthread flavor, as shown on the sourceforge download page:

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/

However, the thread part of IlmBase uses that preprocessor code:

#if defined _WIN32 || defined _WIN64
    #ifdef NOMINMAX
        #undef NOMINMAX
    #endif
    #define NOMINMAX
    #include <windows.h>
    #include <process.h>
#elif HAVE_PTHREAD
    #include <pthread.h>
#endif

With MinGW pthread flavor, _WIN32 is always defined, and autoconf properly sets the HAVE_PTHREAD macro. Which means both are defined. The above preprocessor code then includes the Win32 API which is incorrect, causing compile errors. Replacing the whole preprocessor block by:

    #include <pthread.h>

In all threading ilmbase source solves the issue.

Would it be possible to patch this? I think that first testing for HAVE_PTHREADS and testing for _WIN32 if the first is not set would solve the issue, without harm to other platforms and compilers. What do you think?

Thanks!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]