AlisterT / openjazz

OpenJazz
GNU General Public License v2.0
275 stars 49 forks source link

Wii build instructions - need help #109

Closed knerlington closed 5 months ago

knerlington commented 5 months ago

I'm having tons of SDL issues trying to compile this for Wii. First of all I'm confused over whether or not SDL2 can be used for homebrew platforms at all. The file Platform-helpers.cmake hints at only 1.2 being compatible in this case.

Using Ninja as the generator or not and leaving the CMakeLists.txt as it comes from the repo, SDL_LIBRARY and SDL_INCLUDE_DIR aren't found:

sudo cmake -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/Wii.cmake -B OJ -S . -G Ninja
-- No source code formatter or static analysis tool enabled.
-- Could NOT find Threads (missing: Threads_FOUND) 
CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find SDL (missing: SDL_LIBRARY SDL_INCLUDE_DIR)                                                        
Call Stack (most recent call first):                                                                               
  /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)                   
  /usr/share/cmake-3.28/Modules/FindSDL.cmake:224 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)                              
  CMakeLists.txt:135 (find_package) 

On Kali I have libsdl1.2-dev, libsdl1.2debian installed.

For SDL to be found I have to add the following to CMakeLists.txt:

list(APPEND CMAKE_PREFIX_PATH "/usr/include/SDL")
list(APPEND CMAKE_PREFIX_PATH "/usr/lib/")

But then the compilation fails when the project attempts to statically link OpenJazz.elf to the dynamic libSDL.so:

[100%] Linking CXX executable OpenJazz.elf
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.1.0/../../../../powerpc-eabi/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libSDL.so'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/OpenJazz.dir/build.make:807: OpenJazz.elf] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/OpenJazz.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

Sorry for tons of updates on the issue, but I'm really struggling here.

EDIT: Is there a non-static build option? Could it be my devkitpro setup perhaps? When generating the build files I get this:

sudo cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake -B OJ -S . -G Ninja
-- The CXX compiler identification is GNU 13.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/devkitpro/devkitPPC/bin/powerpc-eabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No source code formatter or static analysis tool enabled.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Could NOT find Threads (missing: Threads_FOUND) 
-- Found SDL: /usr/lib/x86_64-linux-gnu/libSDLmain.a;/usr/lib/x86_64-linux-gnu/libSDL.so (found version "1.2.68") 
-- Looking for C++ include sys/socket.h
-- Looking for C++ include sys/socket.h - not found
carstene1ns commented 5 months ago

No offense, but you really need to start over. You are confusing things and have likely broken it more as a result. You have tried to use the SDL library for Linux (with the CMAKE_PREFIX_PATH additions) and this will not work.

First of all, do not use sudo with cmake, this only ever makes sense when installing things, but here this will mess up file permissions and such.

You currently need to install sdl1.2 for wii, I have not yet changed the code to use sdl2 for wii (only in dev branch, but this is currently not usable). Use dkp-pacman -S --needed wii-sdl.

Use a clean build directory and repository checkout. Then

$DEVKITPRO/portlibs/wii/bin/powerpc-eabi-cmake -B build-wii . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build-wii
cmake --install build-wii --prefix dist-wii

This should have created a distribution with dol file in dist-wii directory.

knerlington commented 5 months ago

From a two day annoyance to a few seconds for success! I thought everything you needed for Wii building was included in the predefined dkp-pacman group "wii-dev". Did not know there was a wii-sdl group so this makes sense.

I actually have to use sudo in most cases even when I use cmake because of how permissions for my user in my Kali installation are configured. Without it I would not be able to compile successfully.

Thank you so much for your help. Now for the fun stuff!