lantus / cannonball-nx

Nintendo Switch Port of Cannonball
46 stars 4 forks source link

'Fatal error: can't create obj/main.o: No such file or directory' and other build errors #9

Open slax57 opened 3 years ago

slax57 commented 3 years ago

Hi guys,

Just sharing my experience trying to build this project with a fresh (nov. 2020) install of DevkitPro.

If you're, like me, a beginner in Switch homebrew compiling, you may encounter the following error:

Fatal error: can't create obj/main.o: No such file or directory

This just means you need to create the obj folder (it is not done within the makefile)

mkdir obj

While you're at it, you should also create the release folder in the same way

mkdir obj

Now, the next problem I faced was this error:

c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/10.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2/src/SDL2-2.0.12/src/video/SDL_egl.c:479: undefined reference to `eglGetPlatformDisplay'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:75: release/cannonball.elf] Error 1

The solution for this was to make the following change to the makefile:

- LIBS      = -specs=$(DEVKITPRO)/libnx/switch.specs -g -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -L$(DEVKITPRO)/libnx/lib -L$(DEVKITPRO)/portlibs/switch/lib -lSDL2 -lnx
+ LIBS      = -specs=$(DEVKITPRO)/libnx/switch.specs -g -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -L$(DEVKITPRO)/libnx/lib -L$(DEVKITPRO)/portlibs/switch/lib -lSDL2 -lEGL -lGLESv2 -lglapi -ldrm_nouveau -lnx

Source: https://github.com/devkitPro/pacman-packages/issues/48

With all this done I was able to get this project to compile!

Thought it could be worth it to share this here.

These issues are no big deal, but I'm guessing they could be fixed easily, or maybe mentioned in the documentation.