Menu

#279 glew-1.13.0: undefined reference to `wglGetProcAddress@4'

2.0.0
closed
None
5
2016-02-06
2015-08-21
YuGiOhJCJ
No

Hello,

I am unable to cross-compile (linux -> windows) glew-1.13.0:

$ make SYSTEM=linux-mingw32 CC=i686-pc-mingw32-gcc LD=i686-pc-mingw32-ld
i686-pc-mingw32-gcc -DGLEW_NO_GLU -DGLEW_BUILD -O2 -Wall -W -Iinclude   -o tmp/linux-mingw32/default/shared/glew.o -c src/glew.c
i686-pc-mingw32-ld -shared -soname libglew32.dll --out-implib lib/libglew32.dll.a     -o lib/glew32.dll tmp/linux-mingw32/default/shared/glew.o  -lopengl32 -lgdi32 -luser32 -lkernel32 
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x3cc): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x3e8): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x404): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x418): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x42c): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x440): more undefined references to `wglGetProcAddress@4' follow
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x1783f): undefined reference to `wglGetCurrentDC@0'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x178af): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x178c3): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x178de): undefined reference to `wglGetCurrentDC@0'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x1795a): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x17ae0): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x17afc): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x17b1a): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x17efc): undefined reference to `wglGetProcAddress@4'
tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x17f18): more undefined references to `wglGetProcAddress@4' follow
make: *** [lib/glew32.dll] Error 1

Any idea why?

Thank you.
Best regards.

Discussion

  • Nigel Stewart

    Nigel Stewart - 2015-08-24

    Seems to work for me on Ubuntu 15.04. Can you describe more about your setup?

    $ make SYSTEM=linux-mingw32 CC=x86_64-w64-mingw32-gcc LD=x86_64-w64-mingw32-ld

     
  • Nigel Stewart

    Nigel Stewart - 2015-08-24
    • assigned_to: Nigel Stewart
    • Group: 1.13.0 --> 1.13.1
    • Priority: 1 --> 5
     
  • YuGiOhJCJ

    YuGiOhJCJ - 2015-08-24

    My setup is Slackware 14.1 and:
    - i686-pc-mingw32-binutils-2.24.51
    - i686-pc-mingw32-gcc-4.9.1
    - i686-pc-mingw32-mesa-9.1.3
    - i686-pc-mingw32-mingwrt-3.20.2
    - i686-pc-mingw32-w32api-3.17.2

    But don't worry because the problem seems to come from an other software than glew.
    Indeed, I discovered that glfw-3.1.1 that is also using the opengl32 library shows the same error:

    $ make
    [ 23%] Built target glfw
    Linking C executable boing.exe
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xa9): undefined reference to `wglGetProcAddress@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xd0): undefined reference to `wglGetProcAddress@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x140): undefined reference to `wglGetProcAddress@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x207): undefined reference to `wglGetProcAddress@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x248): undefined reference to `wglGetProcAddress@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xe07): undefined reference to `wglCreateContext@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xe5b): undefined reference to `wglShareLists@8'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xebe): undefined reference to `wglDeleteContext@4'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x10da): undefined reference to `wglMakeCurrent@8'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x10f3): undefined reference to `wglMakeCurrent@8'
    ../src/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1213): undefined reference to `wglGetProcAddress@4'
    collect2: error: ld returned 1 exit status
    make[2]: *** [examples/boing.exe] Error 1
    make[1]: *** [examples/CMakeFiles/boing.dir/all] Error 2
    make: *** [all] Error 2
    

    So, there are a lot of chance that the problem comes from the "i686-pc-mingw32-mesa-9.1.3" package that provides the "/usr/i686-pc-mingw32/lib/libopengl32.a" file.
    I have reported the bug to mesa too [1].

    Maybe this can help to understand the problem:

    $ nm /usr/i686-pc-mingw32/lib/libopengl32.a | grep wglGetProc
    00000000 I __imp__wglGetProcAddress
    00000000 T _wglGetProcAddress
    

    Can you check if you have the same result with the "nm" command and your "libopengl32.a" file?

    [1] https://bugs.freedesktop.org/show_bug.cgi?id=91711

     

    Last edit: YuGiOhJCJ 2015-08-24
  • YuGiOhJCJ

    YuGiOhJCJ - 2015-08-27

    OK I found how to solve this problem.
    Instead of using the libopengl32.a file provided by mesa I need to use the one provided by my cross-compiler.
    The problem is that my current cross-compiler [1] does not provide the /usr/i686-pc-mingw32/lib/libopengl32.a file.
    So, I have installed a new cross-compiler [2] that does correctly the job.

    Now, my cross-compiler already provides a /usr/i686-pc-mingw32/lib/libopengl32.a file.
    So, I should not cross-compiling mesa because it will overrides this file that will contain incorrect symbols.

    The libopengl32.a provided by my new cross-compiler contains the correct symbols:

    $ nm /usr/i686-w64-mingw32/lib/libopengl32.a | grep wglGetProc
    00000000 I __imp__wglGetProcAddress@4
    00000000 T _wglGetProcAddress@4
    

    The question is why I need to use the library provided by my cross-compiler and not the one from mesa?
    I don't know, but what is sure is that the problem is not related to the glew project.

    [1] http://www.mingw.org/
    [2] http://mingw-w64.org

     
  • Nigel Stewart

    Nigel Stewart - 2015-08-27

    Oh good. It does make sense to depend on the windows opengl32.dll, rather than Mesa.

     
  • Nigel Stewart

    Nigel Stewart - 2016-02-05
    • status: open --> closed
     
  • Nigel Stewart

    Nigel Stewart - 2016-02-05

    Closing, resolved.

     
  • Nigel Stewart

    Nigel Stewart - 2016-02-06
    • Group: 1.13.1 --> 2.0.0