pspdev / psp-packages

https://pspdev.github.io/psp-packages/
The Unlicense
23 stars 13 forks source link

SDL2 stopped working because libpspvram's valloc clashes with newlib when compiling #52

Closed sharkwouter closed 1 year ago

sharkwouter commented 1 year ago

This is the output I see when building the example from https://pspdev.github.io:

wouter@wouter-pc:~/sdl2-psp/build$ make
[ 50%] Linking C executable square
/home/wouter/pspdev/bin/../lib/gcc/psp/11.2.0/../../../../psp/bin/ld: /home/wouter/pspdev/psp/lib/libpspvram.a(vram.c.obj): in function `valloc':
(.text+0x1c): multiple definition of `valloc'; /home/wouter/pspdev/psp/lib/libc.a(lib_a-valloc.o):/home/runner/work/pspdev/pspdev/build/psptoolchain/build/psptoolchain-allegrex/build/newlib/build-psp/psp/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/valloc.c:13: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/square.dir/build.make:103: square] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/square.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
wouter@wouter-pc:~/sdl2-psp/build$ rm -rf ./*
wouter@wouter-pc:~/sdl2-psp/build$ psp-cmake .. && make
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/wouter/pspdev/bin/psp-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/wouter/pspdev/bin/psp-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /home/wouter/pspdev/bin/psp-pkg-config (found version "1.7.3") 
-- Checking for one of the modules 'sdl2'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wouter/sdl2-psp/build
Scanning dependencies of target square
[ 50%] Building C object CMakeFiles/square.dir/main.c.obj
[100%] Linking C executable square
/home/wouter/pspdev/bin/../lib/gcc/psp/11.2.0/../../../../psp/bin/ld: /home/wouter/pspdev/psp/lib/libpspvram.a(vram.c.obj): in function `valloc':
(.text+0x1c): multiple definition of `valloc'; /home/wouter/pspdev/psp/lib/libc.a(lib_a-valloc.o):/home/runner/work/pspdev/pspdev/build/psptoolchain/build/psptoolchain-allegrex/build/newlib/build-psp/psp/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/valloc.c:13: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/square.dir/build.make:103: square] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/square.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
veselcraft commented 1 year ago

Having exact same issue

sharkwouter commented 1 year ago

So the following is going to be the solution for this:

It's a bit of a shame, but I don't think there is a better solution right now. I could maybe add some compiler warning to people using libpspvram.

fjtrujy commented 1 year ago

So the following is going to be the solution for this:

  • Rename valloc in libpspvram
  • Make sure everyone who needs to know that this changed knows about this!
  • Update upstream SDL to use the new name
  • Update the PSPBUILD to use the updated version

It's a bit of a shame, but I don't think there is a better solution right now. I could maybe add some compiler warning to people using libpspvram.

Great approach!

sharkwouter commented 1 year ago

Okay, I've now changed this. The automated build is running. Within the next 2 hours the fix will become available in the latest development build.