Comment 0 for bug 1213725

Revision history for this message
James Le Cuirot (chewi) wrote :

I get the following errors when trying to build with a mingw32 toolchain (gcc 4.7.3) on Gentoo Linux.

mingw32-g++ -Wall -DXP_WIN=1 -std=c++0x -march=corei7 -O2 -pipe pluginloader.c communication.o handlemanager.o npclass.o npnfunctions.o apihook.o -lversion -lgdi32 -lole32 -o pluginloader.exe
pluginloader.c: In function 'bool InitDLL(std::string, std::string)':
pluginloader.c:263:37: error: 'SetDllDirectory' was not declared in this scope
pluginloader.c: In function 'int main(int, char**)':
pluginloader.c:393:36: error: '_fdopen' was not declared in this scope

I checked the headers and found that SetDllDirectory was not defined because no Windows version was set. Adding :-D_WIN32_WINNT=0x0502 to the flags fixes this. This version is the minimum required for this function and corresponds to Windows Server 2003 with SP1 or Windows XP with SP2.

_fdopen was not defined due to -std=c++0x, which enables __STRICT_ANSI__. After searching, I discovered that using -std=gnu++0x (or -std=gnu++11 as it should be now) works around this by enabling the new standards while also including this non-standard function.

Why didn't this affect you? I can hazard a guess. I initially tried to build this as an x64 executable using a x86_64-w64-mingw32 toolchain. I didn't encounter these problems but I did encounter a different one, which I fixed, before realising I was on the wrong track. I see that you are using a 32-bit "w64" toolchain. It was the "w64" bit that threw me but maybe there is still some difference between a 32-bit "w32" toolchain and a 32-bit "w64" toolchain.

I did get it to more or less work in the end. The test page worked and blinkbox.com looked like it was about to play something but eventually bombed with an error. I have only tried Silverlight 5.1 so far though, maybe 4 will work. I have created a Gentoo ebuild for Pipelight, which I will submit to Gentoo bugzilla soon.