intel/fastuidraw

Fails to compile on Windows (MinGW64)

Closed this issue · 8 comments

The makefile does not detect MinGW64 on Windows.
After manually overriding compiler detection it fails to link the dll.
The link command exceeds the windows command line limit of 8192 characters.

Hi,

I was unable to reproduce the issue; On my setup, FastUIDraw builds successfully for both MinGW32 and MinGW64 using the Msys2 shell. I have not targeted (and have not tested) mingw-make (which appears to be a variant of GNU make) or for that matter running that make in the windows shell (cmd.exe). I have only targeted and tested running from an msys shell.

What is your setup where it fails?

If you want to have the build work with mingw-make under cmd.exe, I am happy to review (and accept) pull requests for such support.

I don't really need it to work on normal command line.
But I'm still having problems getting it to compile on msys2.

A short guide how to build it with msys2 on windows would be good enough.

Required packages are:

pacman -Syu
pacman -Su

pacman -S make
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-freetype
pacman -S mingw-w64-x86_64-SDL2

I first tried using mingw32-make, which it didn't like.
Now I still get an error:

g++ -o build/ngl_generator/extractor build/ngl_generator/gl_flex.o build/ngl_generator/HeaderCreator.o
build/ngl_generator/filter /mingw64/include/GL/glcorearb.h
| build/ngl_generator/extractor macro_prefix=FASTUIDRAWgl
namespace="fastuidraw::gl_binding" path=/mingw64/include
output_cpp=src/fastuidraw/gl_backend/ngl_gl.cpp output_hpp=inc/fastuidraw/gl_backend/ngl_gl.hpp GL/glcorearb.h
g++ -g -Wall -Wextra -Wcast-qual -Wwrite-strings -Iinc -mms-bitfields -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include -std=c++11 -D_USE_MATH_DEFINES -DFASTUIDRAW_DEBUG -MT build/debug/GL/src/fastuidraw/gl_backend/gl_binding.o -MMD -MP -MF build/debug/GL/src/fastuidraw/gl_backend/gl_binding.d -c src/fastuidraw/gl_backend/gl_binding.cpp -o build/debug/GL/src/fastuidraw/gl_backend/gl_binding.o
In file included from inc/fastuidraw/gl_backend/ngl_header.hpp:23:0,
from src/fastuidraw/gl_backend/gl_binding.cpp:26:
src/fastuidraw/gl_backend/gl_binding.cpp: In function 'std::_cxx11::string {anonymous}::gl_error_check()':
inc/fastuidraw/gl_backend/ngl_gl.hpp:13:67: error: 'get_function_ptr_glGetError' is not a member of 'fastuidraw::gl_binding'
#define FASTUIDRAWglfunctionPointer(name) fastuidraw::gl_binding::get_function_ptr
##name()
^
src/fastuidraw/gl_backend/gl_binding.cpp:34:14: note: in expansion of macro 'FASTUIDRAWglfunctionPointer'
auto p = FASTUIDRAWglfunctionPointer(glGetError);
^~~~~~~~~~~~~~~~~~~~~~~~~~~

Seems like I'm missing the gl headers. I'm not sure which msys package to use for that

That is what it looks like; I advise to follow the readme and get the GL headers from khronos. Typing make with no arguments gives a blurb about where the build system expects to find them; it also tells how to override that value. My advice is to place the GL header glcorearb.h in the same place as the default (for MinGW64 that is /mingw64/include/GL/glcorearb.h.

Also you will need to delete the ngl_gl.cpp and ngl_gl.cpp files to make them get regenerated.

Thanks it compiled now.
I also had to install the package SDL2_image

pacman -S mingw-w64-x86_64-SDL2_image

for future reference:
mkdir /mingw64/include/GL
wget 'https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h' -O /mingw64/include/GL/glcorearb.h

On another note: the stroke width keys ] [ in the demos don't work on my german keyboard layout

This is likely from that the demos use SDL_SCANCODE_LEFTBRACKET and SDL_SCANCODE_RIGHTBRAKET directly on the pointer returned by SDL_GetKeyboardState(). I suppose I could use SDL_GetKeyFromScancode() to get the key code from the scan code and use that to print the help at startup.

I'd guess for German layout that the two keys right of the P key are the left and right bracket.

Given that it builds correctly, I will close this.