freeorion/freeorion-sdk

Can't Link GLEW when building FreeOrion (GiGiSDL) with Windows x64 SDK

Closed this issue · 6 comments

When trying to build FreeOrion in x64 configuration against the x64 SDK, I get a bunch of GLEW link errors. After I downloaded the GLEW binaries and replaced the .lib in the SDK with the x64 .lib from the download, the linker errors went away.

In particular, with the SDK downloaded glew32.lib:

1>------ Build started: Project: GiGiSDL, Configuration: Release x64 ------
1>   Creating library ../../GiGiSDL.lib and object ../../GiGiSDL.exp
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp_glewInit
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp_glewGetErrorString
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewBindFramebufferEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewBindRenderbufferEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewCheckFramebufferStatusEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewDeleteFramebuffersEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewDeleteRenderbuffersEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewFramebufferRenderbufferEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewFramebufferTexture2DEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewGenFramebuffersEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewGenRenderbuffersEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___glewRenderbufferStorageEXT
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___GLEW_EXT_framebuffer_object
1>SDLGUI.obj : error LNK2001: unresolved external symbol __imp___GLEW_EXT_packed_depth_stencil
1>../../GiGiSDL.dll : fatal error LNK1120: 14 unresolved externals

and with glew32.lib from the 2.1.0 x64 directory in the GLEW binary download:

1>------ Build started: Project: GiGiSDL, Configuration: Release x64 ------
1>SDLGUI.cpp
1>   Creating library ../../GiGiSDL.lib and object ../../GiGiSDL.exp
1>LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
1>GiGiSDL.vcxproj -> C:\Users\Geoff\Desktop\FOSDK11_x64\FreeOrion\msvc2017\GiGiSDL\../../GiGiSDL.dll
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

After also replacing glew32.dll I can build and run FreeOrion in x64 configuration.

There is option(on Windows x64) to use Conda-Forge.org with anaconda.org/conda-forge default repository in package miniforge and added conda-forge repository with:
`
conda config --add channels conda-forge

conda config --set channel_priority strict

conda install package-name
`

and then install freeorion dependencies(package names could be checked on anaconda.org) on Windows x64 and then set it up on VS project include and lib dependency paths from miniconda \Library directory(it contains lib, include).

But I have currently problems compiling GG because there are currently 62 errors(also VS 2022 project needs C++17 on GG)...

o01eg commented

Should be closed in #90

@o01eg FYI: I removed the x64 SDK files from the v11 and v12 SDK releases since they aren't really supported by the project files and the v12 one was definitely broken due to GLEW issues.

Since it's fixed in master, the x64 v13 release can be kept, though.

I'm not sure if the x64 v11 was actually broken, but it's probably easier to not have it, though if you prefer we can put it back...

o01eg commented

It's fine I think. I hope v13 will be released soon.