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

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

Closed
sharkwouter opened this issue Oct 16, 2022 · 4 comments

Comments

@sharkwouter
Copy link
Member

sharkwouter commented Oct 16, 2022

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
@sharkwouter sharkwouter changed the title SDL2 stopped working because libpspvram crashes with newlib SDL2 stopped working because libpspvram's valloc clashes with newlib when compiling Oct 16, 2022
@veselcraft
Copy link

Having exact same issue

@sharkwouter
Copy link
Member Author

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.

@fjtrujy
Copy link
Member

fjtrujy commented Oct 17, 2022

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
Copy link
Member Author

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.

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

3 participants