32-bit Windows builds have wrong function signature

26 views
Skip to first unread message

Benjamin Young

unread,
Apr 27, 2023, 2:14:23 PM4/27/23
to angleproject
I stumbled on this trying to build an SDL2/GLES2 app with Angle on Windows, utilizing the MINGW32 flavor of MSYS2.

When linking, I always got these undefined reference errors:
C:/msys64/mingw32/bin/sdl2gles2tri.c:(.text+0x83): undefined reference to `_imp__glShaderSource@16' C:/msys64/mingw32/bin/sdl2gles2tri.c:(.text+0x93): undefined reference to `_imp__glCompileShader@4' C:/msys64/mingw32/bin/sdl2gles2tri.c:(.text+0xb2): undefined reference to `_imp__glGetShaderiv@12'
etc.

Looking at the Khronos headers shipped in both MSYS2, as well as the binary distributions like:
https://storage.googleapis.com/angle-builds/angle-3729-linux-x64.tar.gz

The Khronos headers use a different calling convention on _WIN32, as seen here:


/*------------------------------------------------------------------------- * Definition of KHRONOS_APIENTRY *------------------------------------------------------------------------- * This follows the return type of the function and precedes the function * name in the function prototype. */ #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC) /* Win32 but not WinCE */ # define KHRONOS_APIENTRY __stdcall #else # define KHRONOS_APIENTRY #endif

If I remove that preprocessor condition, everything links fine. It seems like Angle should be mangling the abi to match on 32-bit windows builds.

However, I can't seem to find 32-bit windows builds for Angle, so maybe this is just a known and not-supported thing.

-- Ben

Benjamin Young

unread,
Apr 27, 2023, 2:15:38 PM4/27/23
to angleproject
I forgot to link in the MSYS2 issue I opened:
https://github.com/msys2/MINGW-packages/issues/16971
Reply all
Reply to author
Forward
0 new messages