Warns & errors building glfw.dll wit

anonymous wrote on Monday, April 30, 2012:

Note - I just posted this as an issue in the bug tracker but just cross-
posting here in case any forum users have fought this fight before me… onward:

This is on a fairly fresh vanilla Win7 64-bit installation with the latest
mingw64, in a clean (freshly extracted) GLFW 2.7.5 source directory calling
make win32-msys.

BUILDING LIBS

1. Warning at gcc -c -I. -I… -Wall -mwin32 -O2 -o win32_init.o
win32_init.c:
win32_init.c: In function ‘_glfwPlatformTerminate’:
win32_init.c:353:27: warning: cast to pointer from integer of different size

2. Warning at gcc -c -I. -I… -Wall -mwin32 -O2 -mdll -DGLFW_BUILD_DLL
-D_GLFW_NO_DLOAD_GDI32 -D_GLFW_NO_DLOAD_WINMM -o win32_init_dll.o
win32_init.c:
win32_init.c: In function ‘_glfwPlatformTerminate’:
win32_init.c:353:27: warning: cast to pointer from integer of different size

But the relevant output files do get created in .\lib\win32: glfw.dll
libglfwdll.a and libglfw.a. However I worry those might be corrupted, since
it’s impossible for me to link to them via gcc later on - if interested, see
<http://stackoverflow.com/questions/10369513/dll-linking-via-windows-cgo-gcc-
ld-gives-undefined-reference-to-function-e> for all my troubles with this. :slight_smile:

** BUILDING EXAMPLES

3. Warning at triangle.exe, pong3d.exe, splitview.exe, mipmaps.exe,
gears.exe, boing.exe, wave.exe, heightmap.exe:
c:/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/4.6.1/…/…/…/…/x86_64-w64-mi
ngw32/bin/ld.exe: warning: cannot find entry symbol _mainCRTStartup;
defaulting to 0000000000401000

Not so for listmodes.exe, mthello.exe, mtbench.exe and particles.exe. Indeed
those 4 are the only ones running properly here afterwards, the others just
exit immediately without outputs or errors (naturally, since there is no
entry point for them).

BUILDING TESTS

4. Warning at accuracy.exe, dynamic.exe:
c:/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/4.6.1/…/…/…/…/x86_64-w64-mi
ngw32/bin/ld.exe: warning: cannot find entry symbol _mainCRTStartup;
defaulting to 0000000000401000

No such problem for defaults.exe. For dynamic.exe it then proceeds with the
following errors:

C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x1c):
undefined reference to `__imp_glfwGetVersion’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x62):
undefined reference to `__imp_glfwInit’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0xcf):
undefined reference to `__imp_glfwOpenWindow’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x10b)
: undefined reference to `__imp_glfwSetWindowTitle’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x118)
: undefined reference to `__imp_glfwSetWindowSizeCallback’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x123)
: undefined reference to `__imp_glfwSwapInterval’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x14a)
: undefined reference to `__imp_glfwGetWindowParam’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x151)
: undefined reference to `__imp_glfwSwapBuffers’
C:\Users\roxor\AppData\Local\Temp\cc8hsorn.o:dynamic.c:(.text.startup+0x174)
: undefined reference to `__imp_glfwTerminate’
collect2: ld returned 1 exit status
make: *** Error 1
make: Leaving directory `/c/glfw64/tests’
make: *** Error 2

Now this is the test for a program loading the dynamic link library. You might
think that’s simply missing the necessary libs (.a and .dll) in the correct
places, but do note at this very point I DID have all the necessary includes
and libs (from an earlier GLFW make that was *exactly* the same as the
above, same versions, same warnings, same output files) in the correct
places:

- libglfwdll.a in \MinGW64\x86_64-w64-mingw32\lib (next to libglu32.a,
libopengl32.a)
- glfw.h in \MinGW64\x86_64-w64-mingw32\include\GL (next to gl.h, glaux.h,
glu.h)
- glfw.dll in \windows and \windows\system32 (next to opengl32.dll,
glu32.dll)**

anonymous wrote on Thursday, May 31, 2012:

Not sure if anyone will ever care to prepare GLFW for 64-bit Windows - after
all it’s been only more than half a decade since 64-bit machines and OSes
gained widespread use - but for all of the above, there have been a few
helpful comments at Stackoverflow:

<http://stackoverflow.com/questions/10377930/building-glfw-with-mingw64-gcc-
entry-symbol-warnings-linker-errors/10805655>

Point being is, applying those to the source base for future versions of the
GLFW distribution might make building a 64-bit glfw.dll a lot less painful -
or even succeed at the first attempt!

elmindreda wrote on Tuesday, July 03, 2012:

These issues have been fixed in GLFW 2.7.6, which will be released shortly.