Can't pass GLEW check when building with Scons

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderators: Forum Moderators, Developers

Post Reply
Posts: 2
Joined: August 20th, 2016, 10:12 am

Can't pass GLEW check when building with Scons

Post by Tramontana » May 24th, 2018, 4:39 pm

Hi everyone! I haven't been following the releases of Wesnoth for a while, and now i'm having trouble when compiling the game due to some missing dependencies.

With this commit, Scons checks for OpenGL and GLEW libraries before building Wesnoth.

As TDM-GCC doesn't come with GLEW already installed, i tried to download its latest version following these instructions.
I put the files where the guide says to place them, respectively:

bin/glew32.dll -> C:\TDM-GCC-64\x86_64-w64-mingw32\bin
lib/glew32.lib -> C:\TDM-GCC-64\x86_64-w64-mingw32\lib
include/GL/glew.h -> C:\TDM-GCC-64\x86_64-w64-mingw32\include\GL
include/GL/wglew.h -> C:\TDM-GCC-64\x86_64-w64-mingw32\include\GL

Anyway, i don't know why, Scons fails when checking for GLEW and it stops compiling Wesnoth.

I'm building Wesnoth on Windows 10 64 bit.

The build/config.log says this:

Code: Select all

scons: Configure: Checking for OpenGL Extension Wrangler... 
build\sconf_temp\conftest_26.c <-
  |        #include <GL/glew.h>
  |        int main()
  |        {
  |            glewInit();
  |        }
gcc -o build\sconf_temp\conftest_26.o -c -m32 -Wall -Wextra -Werror=non-virtual-dtor -D_GNU_SOURCE -isystem scons_dependencies\boost_1_59_0 -isystem scons_dependencies\include\SDL2 build\sconf_temp\conftest_26.c
gcc -o build\sconf_temp\conftest_26.exe -m32 -mwindows build\sconf_temp\conftest_26.o -Lscons_dependencies\boost_1_59_0\stage\lib -Lscons_dependencies\lib -lboost_filesystem-mgw51-mt-1_59 -lboost_locale-mgw51-mt-1_59 -lboost_thread-mgw51-mt-1_59 -lboost_system-mgw51-mt-1_59 -lboost_random-mgw51-mt-1_59 -lboost_iostreams-mgw51-mt-1_59 -lm -lcrypto -lz -lboost_bzip2-mgw51-mt-1_59 -lws2_32 -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -lSDL2_image -lvorbisfile -lopengl32 -lglew32
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/lib/glew32.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
scons: Configure: no
Anyone knows where did i go wrong?

User avatar
Windows Packager
Posts: 272
Joined: April 1st, 2008, 4:45 pm
Location: Russia/Moscow

Re: Can't pass GLEW check when building with Scons

Post by loonycyborg » May 24th, 2018, 11:49 pm

Seems it finds it but it's in invalid format. Probably incompatible toolchains are used to build it. Maybe try building GLEW with your TDM GCC. I think GLEW's makefile supports mingw builds.
"meh." - zookeeper

Posts: 2
Joined: August 20th, 2016, 10:12 am

Re: Can't pass GLEW check when building with Scons

Post by Tramontana » June 3rd, 2018, 9:12 pm

Recompiling GLEW did work. I'll post here the instructions i followed.

1) Download GLEW source files

2) Unzip GLEW folder

3) Open Windows Command Prompt (cmd.exe) and move to the GLEW folder (for example "C:\Users\Tramontana\Downloads\glew-2.1.0\glew-2.1.0")

4) Type the following line in the Command Prompt:
g++ -m32 -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew.c
This should create "glew.o"; you will find it in the "src" subdirectory

5) If "glew.o" was successfully created, type this in the Command Prompt:
g++ -m32 -nostdlib -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
Now you should have two new files: "libglew32.dll.a" and "glew.dll" in the "lib" subdirectory

6) Now type:
ar cr lib/libglew32.a src/glew.o
And this should build "libglew32.a" inside "lib"

7) Copy "glew.dll" and paste it in "...\scons_dependencies\bin"

8 ) Copy "libglew.a" and "libglew.dll.a" and paste them in "...\scons_dependencies\lib"

Being a complete newbie, i admit i don't understand anything of the code i've written here. Anyway, i hope this can be helpful to someone.

Post Reply