Lameguy64 / PSn00bSDK

The most powerful open source SDK for the PS1 (as far as open source PS1 SDKs go). Not recommended for beginner use.
Other
854 stars 68 forks source link

mipsel-none-elf for macos #87

Open VityaSchel opened 1 month ago

VityaSchel commented 1 month ago

Please release binary files for building with psn00bsdk on macos, it appears that everything is good until build process uses binary files such as mipsel-none-elf-gcc which obviously results in zsh: exec format error since binary files are for linux, not arm mac Can you guide me to the right direction there?

VityaSchel commented 1 month ago

I guess I should start with building toolchain myself https://github.com/Lameguy64/PSn00bSDK/blob/master/doc/toolchain.md and then the sdk itself https://github.com/Lameguy64/PSn00bSDK/blob/master/doc/installation.md#building-from-source

VityaSchel commented 1 month ago

Update: I'm trying to build gcc but getting "too many errors emitted, stopping now". I tried

make CFLAGS="-w -Wno-error -fmax-errors=0" CXXFLAGS="-w -Wno-error -fmax-errors=0" -j 4

no flags help, it still stops make after 20 errors

Upd2: I tried gmake and it looks like it worked for a second but then I have another error: ld: symbol(s) not found for architecture arm64 clang++: error: linker command failed with exit code 1 (use -v to see invocation) when installing so I gave up

VityaSchel commented 1 month ago

I managed to install mipsel-none-elf (binutils and gcc parts) from this project https://github.com/grumpycoders/pcsx-redux/blob/main/src/mips/psyqo/GETTING_STARTED.md#macos It works and I can finally run mipsel-none-elf-gcc. After copying all bin executables from /opt/homebrew/Cellar/mipsel-none-elf-gcc/14.2.0/bin and /opt/homebrew/Cellar/mipsel-none-elf-binutils/2.43/bin to psn00b SDK's bin folder and running make on one of the examples I still get error:

cmake -S . -B ./build -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=/Users/hloth/Documents/PSn00bSDK-0.24-Linux/lib/libpsn00b/cmake/sdk.cmake
-- The C compiler identification is unknown
-- Detecting C compiler ABI info
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.30.4/share/cmake/Modules/GNUInstallDirs.cmake:253 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  /Users/hloth/Documents/PSn00bSDK-0.24-Linux/lib/libpsn00b/cmake/internal_setup.cmake:8 (include)
  /Users/hloth/Documents/PSn00bSDK-0.24-Linux/share/psn00bsdk/examples/graphics/fpscam/build/CMakeFiles/CMakeScratch/TryCompile-OA9Q77/CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Users/hloth/Documents/PSn00bSDK-0.24-Linux/bin/mipsel-none-elf-gcc
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.30.4/share/cmake/Modules/GNUInstallDirs.cmake:253 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  /Users/hloth/Documents/PSn00bSDK-0.24-Linux/lib/libpsn00b/cmake/internal_setup.cmake:8 (include)
  /Users/hloth/Documents/PSn00bSDK-0.24-Linux/share/psn00bsdk/examples/graphics/fpscam/build/CMakeFiles/CMakeScratch/TryCompile-KKVl9H/CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Check for working C compiler: /Users/hloth/Documents/PSn00bSDK-0.24-Linux/bin/mipsel-none-elf-gcc - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.30.4/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/Users/hloth/Documents/PSn00bSDK-0.24-Linux/bin/mipsel-none-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/hloth/Documents/PSn00bSDK-0.24-Linux/share/psn00bsdk/examples/graphics/fpscam/build/CMakeFiles/CMakeScratch/TryCompile-KKVl9H'

    Run Build Command(s): /usr/local/bin/ninja -v cmTC_0f2a1
    [1/2] /Users/hloth/Documents/PSn00bSDK-0.24-Linux/bin/mipsel-none-elf-gcc -DNDEBUG=1 -DPSN00BSDK=1 -I/Users/hloth/Documents/PSn00bSDK-0.24-Linux/lib/libpsn00b/cmake/../../../include/libpsn00b -g -Wa,--strip-local-absolute -ffreestanding -fno-builtin -nostdlib -fdata-sections -ffunction-sections -fsigned-char -fno-strict-overflow -fdiagnostics-color=always -msoft-float -march=r3000 -mtune=r3000 -mabi=32 -mno-mt -mno-llsc -O2 -o CMakeFiles/cmTC_0f2a1.dir/testCCompiler.c.obj -c /Users/hloth/Documents/PSn00bSDK-0.24-Linux/share/psn00bsdk/examples/graphics/fpscam/build/CMakeFiles/CMakeScratch/TryCompile-KKVl9H/testCCompiler.c
    FAILED: CMakeFiles/cmTC_0f2a1.dir/testCCompiler.c.obj
    /Users/hloth/Documents/PSn00bSDK-0.24-Linux/bin/mipsel-none-elf-gcc -DNDEBUG=1 -DPSN00BSDK=1 -I/Users/hloth/Documents/PSn00bSDK-0.24-Linux/lib/libpsn00b/cmake/../../../include/libpsn00b -g -Wa,--strip-local-absolute -ffreestanding -fno-builtin -nostdlib -fdata-sections -ffunction-sections -fsigned-char -fno-strict-overflow -fdiagnostics-color=always -msoft-float -march=r3000 -mtune=r3000 -mabi=32 -mno-mt -mno-llsc -O2 -o CMakeFiles/cmTC_0f2a1.dir/testCCompiler.c.obj -c /Users/hloth/Documents/PSn00bSDK-0.24-Linux/share/psn00bsdk/examples/graphics/fpscam/build/CMakeFiles/CMakeScratch/TryCompile-KKVl9H/testCCompiler.c
    mipsel-none-elf-gcc: fatal error: cannot execute 'cc1': posix_spawnp: No such file or directory
    compilation terminated.
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)

-- Configuring incomplete, errors occurred!

So look at this line: mipsel-none-elf-gcc: fatal error: cannot execute 'cc1': posix_spawnp: No such file or directory. I tried googling it but couldn't find anything. My guess is that sdk.cmake is built specifically for linux, thus asking for cc1 or posix_spawnp or whatever else is exclusive to linux and not available on macos, won't work So I guess I should compile the sdk.cmake somehow for macos? I will try https://github.com/Lameguy64/PSn00bSDK/blob/master/doc/installation.md#building-from-source

VityaSchel commented 1 month ago

Still getting the same error when trying to compile psn00b sdk: posix_spawnp: No such file or directory