libcross2d-examples icon indicating copy to clipboard operation
libcross2d-examples copied to clipboard

Cmake Build Issues on Arch Based Linux.

Open Zeludon opened this issue 7 years ago • 2 comments

Hey I followed the build instructions included in the readme, adapting the packages for what is available on Arch

This guide was used for the switch packages and they (switch-dev switch-bzip2 switch-freetype switch-glad switch-glm switch-libdrm_nouveau switch-libpng switch-mesa switch-pkg-config switch-sdl2 switch-zlib ) all installed successfully.

The linux build packages libsdl2-dev libfreetype6-dev libglm-dev were replaced by their pacman equivalents, sdl2 freetype2 glm as arch does not use separate dev packages.

Unfortunately, attempting to build with DBUILD_LINUX=1 results in the following

make texture.elf  
Scanning dependencies of target texture.data
[  0%] Built target texture.data
[ 97%] Built target cross2d
Scanning dependencies of target texture.elf
[ 98%] Linking CXX executable texture.elf
/usr/bin/ld: ../../libcross2d/libcross2d.a(gl_renderer.cpp.o): in function `c2d::GLRenderer::draw(c2d::VertexArray*, c2d::Transform const&, c2d::Texture const*)':
gl_renderer.cpp:(.text+0x80c): undefined reference to `SDL_GL_GetDrawableSize'
/usr/bin/ld: ../../libcross2d/libcross2d.a(sdl2_gl_renderer.cpp.o): in function `c2d::SDL2Renderer::SDL2Renderer(c2d::Vector2<float> const&)':
sdl2_gl_renderer.cpp:(.text+0x71): undefined reference to `SDL_Init'

#... many more lines of sdl2 related errors

collect2: error: ld returned 1 exit status
make[3]: *** [examples/texture/CMakeFiles/texture.elf.dir/build.make:90: examples/texture/texture.elf] Error 1
make[2]: *** [CMakeFiles/Makefile2:310: examples/texture/CMakeFiles/texture.elf.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:322: examples/texture/CMakeFiles/texture.elf.dir/rule] Error 2
make: *** [Makefile:183: texture.elf] Error 2

Similarly building the switch package with DBUILD_SWITCH=1 results in a different error

make texture.nro
[  0%] Built target texture.data
Scanning dependencies of target cross2d
[  1%] Building CXX object libcross2d/CMakeFiles/cross2d.dir/source/skeleton/audio.cpp.o
In file included from /home/USER/libcross2d-examples/libcross2d/source/skeleton/audio.cpp:7:
/home/USER/libcross2d-examples/libcross2d/include/cross2d/c2d.h:136:10: fatal error: switch.h: No such file or directory
 #include <switch.h>
          ^~~~~~~~~~
compilation terminated.
make[3]: *** [libcross2d/CMakeFiles/cross2d.dir/build.make:63: libcross2d/CMakeFiles/cross2d.dir/source/skeleton/audio.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:96: libcross2d/CMakeFiles/cross2d.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:482: examples/texture/CMakeFiles/texture.nro.dir/rule] Error 2
make: *** [Makefile:248: texture.nro] Error 2

It would be very much appreciated if I could be pointed in the right direction on how to fix this, aside from switching linux distributions, as that really shouldn't be necessary.

Zeludon avatar Jan 20 '19 14:01 Zeludon

Hi,

for the switch error, are you sure you did install devkitpro to "/opt/devkitpro " and you did export the swtich sdk variables ( export DEVKITPRO=/opt/devkitpro ) ?

Else, can you provide me the exact distribution and version you are using? I'm going to make a VM and take a closer look.

Cpasjuste avatar Jan 21 '19 11:01 Cpasjuste

Yes I'm fairly sure.

I added these lines to my ~/.profile and they are accessible from my zsh instance.

export DEVKITPRO=/opt/devkitpro
export DEVKITARM=/opt/devkitpro/devkitARM
export DEVKITPPC=/opt/devkitpro/devkitPPC

As for my distribution it is Manjaro KDE 18.0. Available here https://manjaro.org/download/kde/

Thanks for your time as I'd enjoy trying this library out.

Zeludon avatar Jan 21 '19 11:01 Zeludon