1. Jason McKesson
  2. Unofficial OpenGL SDK
  3. Issues
Issue #52 new

Fails to compile on Windows w/MinGW

Anonymous created an issue

When attempting to compile using MinGW, I get the following error(s):

include/glload/_int_gl_exts.hpp:4840:18: error: declaration does not declare any thing [-fpermissive] extern _detail::Proc_glMemoryBarrier MemoryBarrier;

There are other errors as well, but they look to be directly related to this.

I'm using the latest 32bit version of MinGW (build 2013072200; GNU Make 3.82.9, GCC 4.8.1)

Command output is below:

E:\client\playground\opengl\glsdk_0_5_2>premake4 gmake Building configurations... Running action 'gmake'... Generating Makefile... Generating glload/Makefile... Generating glimg/Makefile... Generating glfw/Makefile... Generating freeglut/Makefile... Generating glutil/Makefile... Generating glmesh/Makefile... Done.

E:\client\playground\opengl\glsdk_0_5_2>make "==== Building glload (debug) ====" gl_load_cpp.cpp In file included from include/glload/gl_all.hpp:9:0, from source/gl_load_cpp.cpp:4: include/glload/_int_gl_exts.hpp:4840:18: error: declaration does not declare any thing [-fpermissive] extern _detail::Proc_glMemoryBarrier MemoryBarrier; ^ source/gl_load_cpp.cpp:4181:46: error: expected unqualified-id before '=' token _detail::Proc_glMemoryBarrier MemoryBarrier = 0; ^ source/gl_load_cpp.cpp: In function 'void gl::CopyFunctionPointers()': source/gl_load_cpp.cpp:7501:17: error: expected primary-expression before '=' token MemoryBarrier = _funcptr_glMemoryBarrier; ^ source/gl_load_cpp.cpp:10080:17: error: expected primary-expression before '=' token MemoryBarrier = _funcptr_glMemoryBarrier; ^ Makefile:135: recipe for target 'Debug/gl_load_cpp.o' failed make[1]: [Debug/gl_load_cpp.o] Error 1 Makefile:16: recipe for target 'glload' failed make: [glload] Error 2

E:\client\playground\opengl\glsdk_0_5_2>

Comments (8)

  1. Yannick Boesmans

    I have the exact same problem.

    I have a full MinGW system set up but compiling the GLSDK does not work. Originally I was trying to build the one which comes with the OpenGL tutorials from Alfonse, but those didn't work either. The problem seems to have something to do with "MemoryBarrier".

    This is what I get when i run make:

    ==== Building glload (debug) ====
    Creating Debug
    gl_load.c
    gl_load_cpp.cpp
    
    In file included from include/glload/gl_all.hpp:9:0,
            from source/gl_load_cpp.cpp:4:
    include/glload/_int_gl_exts.hpp:4840:18: error: declaration does not declare anything [-fpermissive]
            extern _detail::Proc_glMemoryBarrier MemoryBarrier;
    
    source/gl_load_cpp.cpp:4181:46: eroor: expectued unqualified-id before '=' token
            _detail::Proce_glMemoryBarrier MemoryBarrier = 0;
    
    source/gl_load_cpp.cpp: In function 'void gl::CopyFunctionPointer()':
    source/gl_load_cpp.cpp:7501:17: eroor: expected primary-expression before '=' token
            MemoryBarrier = funcptr_glMemoryBarrier;
    
    source/gl_load_cpp.cpp:10080:17: eroor: expected primary-expression before '=' token
            MemoryBarrier = funcptr_glMemoryBarrier;
    
    make[1]: *** [Debug/gl_load_cpp.o] Error 1
    make: *** [glload] Error 2
    

    So it seems to me that "MemoryBarrier" is not recognized or not correctly initialized.

    Is there anything I can do to fix this or something I can try? I would very much like to get this working.

    Thanks for looking at this.

  2. inmost-light

    Yannick Boesmans The problem is this snippet from winnt.h:

    #if _WIN32_WINNT >= _WIN32_WINNT_VISTA
    # if defined(_AMD64_) || defined(__X86_64)
    #  define MemoryBarrier __faststorefence
    
    # elif defined(_IA64_)
    
    #  define MemoryBarrier __mf
    # else
    
       void __mingworg_MemoryBarrier(void);
    #  define MemoryBarrier __mingworg_MemoryBarrier
    # endif
    
    #else
    
    # define MemoryBarrier
    #endif
    

    So what you can do is to #undef MemoryBarrier or rename it into MemoryBarrierHack or something. Either way, you'll have to edit glsdk source code.

    Edit: It works with VS, because depending on the flags, MemoryBarrier can be defined as a function and not a macro - http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208(v=vs.85).aspx.

  3. cva_

    This

    #undef MemoryBarrier
    

    could be insert to

    glsdk_0_5_2\glload\include\glload\_int_glx_exts.hpp
    

    before this line

    namespace gl
    

    Many thanks to tno

  4. Unknown Name

    I had the same problems trying to build the sdk with MinGW. I inserted the line above "namespace gl" as suggested by cva_ and I succesfully built the debug version. I'm trying to build the release version now. When I enter "make config=release", I get an error at line 210 in the Draw.cpp file. Any ideas as to how to build the release version?

    C:\work\arcsynthesis\glsdk>make config=release
    ==== Building glload (release) ====
    ==== Building glimg (release) ====
    ==== Building freeglut (release) ====
    ==== Building glutil (release) ====
    ==== Building glmesh (release) ====
    Draw.cpp
    In file included from ../glm/glm/./core/func_packing.hpp:129:0,
                     from ../glm/glm/glm.hpp:67,
                     from include/glmesh/Draw.h:17,
                     from source/Draw.cpp:11:
    ../glm/glm/./core/func_packing.inl: In function 'glm::core::type::uint glm::core
    ::function::packing::packHalf2x16(const glm::detail::tvec2<float>&)':
    ../glm/glm/./core/func_packing.inl:134:18: warning: dereferencing type-punned po
    inter will break strict-aliasing rules [-Wstrict-aliasing]
      return *(uint*)&Pack;
                      ^
    include/glmesh/StreamBuffer.h: At global scope:
    <command-line>:0:9: error: expected unqualified-id before numeric constant
    include/glmesh/StreamBuffer.h:193:9: note: in expansion of macro 'Release'
        bool Release();
             ^
    source/Draw.cpp: In member function 'int glmesh::Draw::InternalRender()':
    <command-line>:0:9: error: expected unqualified-id before numeric constant
    source/Draw.cpp:210:13: note: in expansion of macro 'Release'
       if(!m_map.Release())
                 ^
    <command-line>:0:9: error: expected ')' before numeric constant
    source/Draw.cpp:210:13: note: in expansion of macro 'Release'
       if(!m_map.Release())
                 ^
    make[1]: *** [Release/Draw.o] Error 1
    make: *** [glmesh] Error 2
    
    C:\work\arcsynthesis\glsdk>
    
  5. Carl Reed

    Thanks for the quick response. I applied the suggest changes to glmesh/glmesh.lua and regenerated my makefile. I still get an error for Draw.cpp : /

    C:\Users\cr364m\Desktop\Tutorial 0.3.8\glsdk\glmesh>make config=release
    Draw.cpp
    In file included from ../glm/glm/./core/func_packing.hpp:129:0,
                     from ../glm/glm/glm.hpp:67,
                     from include/glmesh/Draw.h:17,
                     from source/Draw.cpp:11:
    ../glm/glm/./core/func_packing.inl: In function 'glm::core::type::uint glm::core
    ::function::packing::packHalf2x16(const glm::detail::tvec2<float>&)':
    ../glm/glm/./core/func_packing.inl:134:18: warning: dereferencing type-punned po
    inter will break strict-aliasing rules [-Wstrict-aliasing]
      return *(uint*)&Pack;
                      ^
    include/glmesh/StreamBuffer.h: At global scope:
    <command-line>:0:9: error: expected unqualified-id before numeric constant
    include/glmesh/StreamBuffer.h:193:9: note: in expansion of macro 'Release'
        bool Release();
             ^
    source/Draw.cpp: In member function 'int glmesh::Draw::InternalRender()':
    <command-line>:0:9: error: expected unqualified-id before numeric constant
    source/Draw.cpp:210:13: note: in expansion of macro 'Release'
       if(!m_map.Release())
                 ^
    <command-line>:0:9: error: expected ')' before numeric constant
    source/Draw.cpp:210:13: note: in expansion of macro 'Release'
       if(!m_map.Release())
                 ^
    make: *** [build/Release/Draw.o] Error 1
    
    C:\Users\cr364m\Desktop\Tutorial 0.3.8\glsdk\glmesh>
    

    Any other suggestions? -Thanks again

  6. Log in to comment