Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake fails in wsl #215

Open
oomek opened this issue Feb 15, 2020 · 7 comments
Open

cmake fails in wsl #215

oomek opened this issue Feb 15, 2020 · 7 comments

Comments

@oomek
Copy link

oomek commented Feb 15, 2020

I've been trying to cross-compile demos in WSL on Windows 10 using using MXE environment. When I run cmake everything seems fine except 2 errors:

oomek@radek-pc:/mnt/d/documents/gitkraken/freetype-gl/build$ x86_64-w64-mingw32.static-cmake ..
== Using MXE wrapper: /opt/mxe/usr/bin/x86_64-w64-mingw32.static-cmake
     - cmake version 3.15.4
     - warnings for unused CMAKE_POLICY_DEFAULT variables can be ignored
== Using MXE toolchain: /opt/mxe/usr/x86_64-w64-mingw32.static/share/cmake/mxe-conf.cmake
== Using MXE runresult: /opt/mxe/usr/share/cmake/modules/TryRunResults.cmake
== Adding "-DCMAKE_BUILD_TYPE=Release"
loading initial cache file /opt/mxe/usr/share/cmake/modules/TryRunResults.cmake
-- The C compiler identification is GNU 5.5.0
-- The CXX compiler identification is GNU 5.5.0
-- Check for working C compiler: /opt/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-gcc
-- Check for working C compiler: /opt/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-g++
-- Check for working CXX compiler: /opt/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.static-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building for Windows target system
-- Building with GNU compiler
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for math.h
-- Looking for math.h - found
-- Looking for cos in m
-- Looking for cos in m - found
-- Looking for cos
-- Looking for cos - found
-- Looking for fabs
-- Looking for fabs - found
-- Looking for floor
-- Looking for floor - found
-- Looking for fmod
-- Looking for fmod - found
-- Looking for pow
-- Looking for pow - found
-- Looking for roundf
-- Looking for roundf - found
-- Looking for round
-- Looking for round - found
-- Looking for sin
-- Looking for sin - found
-- Looking for sqrt
-- Looking for sqrt - found
-- Looking for tan
-- Looking for tan - found
-- Looking for M_PI
-- Looking for M_PI - found
-- Found OpenGL: opengl32
== Custom MXE File: /opt/mxe/usr/share/cmake/modules/FindFreetype.cmake
-- Found PkgConfig: /opt/mxe/usr/bin/x86_64-w64-mingw32.static-pkg-config (found version "0.28")
-- Checking for module 'freetype2'
--   Found freetype2, version 23.1.17
-- Found GLEW: /opt/mxe/usr/x86_64-w64-mingw32.static/lib/libGLEW.a
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13") found components:  doxygen missing components:  dot
-- Could NOT find AntTweakBar (missing: ANT_TWEAK_BAR_INCLUDE_PATH ANT_TWEAK_BAR_LIBRARY)
-- Found Fontconfig: /opt/mxe/usr/x86_64-w64-mingw32.static/lib/libfontconfig.a
CMake Error at /opt/mxe/usr/x86_64-pc-linux-gnu/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find ImageMagick (missing: ImageMagick_compare_EXECUTABLE)
Call Stack (most recent call first):
  /opt/mxe/usr/x86_64-pc-linux-gnu/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /opt/mxe/usr/x86_64-pc-linux-gnu/share/cmake-3.15/Modules/FindImageMagick.cmake:278 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  tests/CMakeLists.txt:6 (find_package)

I've built MXE's dependencies, including ImageMagick but it fails anyway. Also there is no AntTweakBar in MXE. Any clues?

@oomek
Copy link
Author

oomek commented Feb 15, 2020

Ok, I've succeeded generating makefiles by:
x86_64-w64-mingw32.static-cmake -Dfreetype-gl_BUILD_TESTS=OFF ..
Not sure if it's required though, because now when I try to make I'm getting linking errors:

Scanning dependencies of target markup
[ 37%] Building C object demos/CMakeFiles/markup.dir/markup.c.obj
[ 38%] Linking C executable markup.exe
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x7a): undefined reference to `__imp___glewUseProgram'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x89): undefined reference to `__imp___glewUniformMatrix4fv'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x90): undefined reference to `__imp___glewGetUniformLocation'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x102): undefined reference to `__imp___glewUniform1i'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x122): undefined reference to `__imp___glewUniform3f'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x1bb): undefined reference to `__imp___glewActiveTexture'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text+0x1ef): undefined reference to `__imp___glewBlendColor'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text.startup+0xdb): undefined reference to `__imp_glewInit'
CMakeFiles/markup.dir/objects.a(markup.c.obj):markup.c:(.text.startup+0xee): undefined reference to `__imp_glewGetString'
...
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x263): undefined reference to `__imp___glewDeleteBuffers'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x277): undefined reference to `__imp___glewDeleteBuffers'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x422): undefined reference to `__imp___glewBindBuffer'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x45b): undefined reference to `__imp___glewBufferData'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x49c): undefined reference to `__imp___glewBufferData'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x4d3): undefined reference to `__imp___glewGenBuffers'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x4f0): undefined reference to `__imp___glewGenBuffers'
../libfreetype-gl.a(vertex-buffer.c.obj):vertex-buffer.c:(.text+0x50a): undefined reference to `__imp___glewBufferSubData'
...

@oomek
Copy link
Author

oomek commented Feb 16, 2020

Anyone please?

@rougier
Copy link
Owner

rougier commented Feb 18, 2020

I'm not familiar with MXE but t seems the library has not be compiled with glew for some reason. Since cmake found it , it seems to be installed but maybe it's an old version. Can you check on your env what is the version ?

@oomek
Copy link
Author

oomek commented Feb 18, 2020

@rougier
Copy link
Owner

rougier commented Feb 20, 2020

Did you play with CMakefile configuration to check for the compile/link flags ? Also, maybe it's worth asking on MXE if anybody can help you on this problem.

@oomek
Copy link
Author

oomek commented Feb 20, 2020

It was wrong linking parameters i think, but I haven't tested it yet. For win32 i should be linked with parameters -lopengl32 -lgdi32 instead of -lGL. That's what worked in another similar project.

@rougier
Copy link
Owner

rougier commented Feb 21, 2020

Can you fixed it using ccmake ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants