fgsfdsfgs / QuakespasmNX

Nintendo Switch port of Quakespasm
http://quakespasm.sourceforge.net
26 stars 3 forks source link

Linking error #2

Closed Ch0wW closed 5 years ago

Ch0wW commented 5 years ago

Devkitpro is at the latest version.

c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/libnx/lib\libnx.a(gfx.o): in function `gfxInitResolution':
/home/davem/projects/devkitpro/pacman-packages/libnx/src/source/display/gfx.c:364: multiple definition of `gfxInitResolution'; C:/devkitPro/portlibs/switch/lib\libEGL.a(drivers_switch_egl_switch.c.o):egl_switch.c:(.text.gfxInitResolution+0x0): first defined here
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/libnx/lib\libnx.a(gfx.o): in function `gfxInitResolutionDefault':
/home/davem/projects/devkitpro/pacman-packages/libnx/src/source/display/gfx.c:371: multiple definition of `gfxInitResolutionDefault'; C:/devkitPro/portlibs/switch/lib\libEGL.a(drivers_switch_egl_switch.c.o):egl_switch.c:(.text.gfxInitResolutionDefault+0x0): first defined here
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/libnx/lib\libnx.a(gfx.o): in function `gfxConfigureCrop':
/home/davem/projects/devkitpro/pacman-packages/libnx/src/source/display/gfx.c:375: multiple definition of `gfxConfigureCrop'; C:/devkitPro/portlibs/switch/lib\libEGL.a(drivers_switch_egl_switch.c.o):egl_switch.c:(.text.gfxConfigureCrop+0x0): first defined here
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/libnx/lib\libnx.a(gfx.o): in function `gfxConfigureResolution':
/home/davem/projects/devkitpro/pacman-packages/libnx/src/source/display/gfx.c:401: multiple definition of `gfxConfigureResolution'; C:/devkitPro/portlibs/switch/lib\libEGL.a(drivers_switch_egl_switch.c.o):egl_switch.c:(.text.gfxConfigureResolution+0x0): first defined here
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/libnx/lib\libnx.a(gfx.o): in function `gfxConfigureTransform':
/home/davem/projects/devkitpro/pacman-packages/libnx/src/source/display/gfx.c:498: multiple definition of `gfxConfigureTransform'; C:/devkitPro/portlibs/switch/lib\libEGL.a(drivers_switch_egl_switch.c.o):egl_switch.c:(.text.gfxConfigureTransform+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/libnx/switch_rules:80: /opt/devkitpro/home/QuakespasmNX/quakespasm/quakespasmnx.elf] Error 1
make: *** [Makefile.nx:232: build] Error 2

Strangely, nxQuake2 doesn't have the compiling error that QuakeSpasmNX does.

fgsfdsfgs commented 5 years ago

This has not yet been updated for use with latest libnx, which has some potentially breaking gfx changes.

Ch0wW commented 5 years ago

Indeed, some of the changes broke some parts.

I managed to compile and adapt it (commit ==> https://github.com/Ch0wW/QuakespasmNX/commit/c96d3659aafc9d8d73a18d18e76ae68c94ab7dcd ) . However, now it crashes saying the following :

Error: Couldn't init SDL video: displayIndex must be in the range 0 - -1.

fgsfdsfgs commented 5 years ago

Yeah, I tried the same after your NXQuake 2 PR and got the same error. There has been a long-running memory corruption issue that I haven't tracked down, maybe that's what's causing this.

fgsfdsfgs commented 5 years ago

For a dumb and ugly workaround we can just avoid initializing SDL video and creating windows entirely, instead polling input manually. I tried that in the Doom 3 port and it works, but it's really not a good solution. The fact that I have been poking around EGL shit and using SDL video at the same time and nothing has broken before is kind of a miracle in itself.

fgsfdsfgs commented 5 years ago

This has been fixed in the latest revision. I misunderstood some things related to how SDL2 graphics work. Turns out that using nwindowGetDefault() or the default console renderer at all brings in additional init/deinit routines that break some stuff in SDL because vi and the display are already initialized when we're calling SDL_CreateWindow. So we need to either exclusively use SDL stuff or do whatever we were doing before.