Drewol / unnamed-sdvx-clone

A game based on K-Shoot MANIA and Sound Voltex
MIT License
795 stars 96 forks source link

[Bug] Broken compiler error?? (cc) (mac m1) #606

Closed drxjason closed 2 years ago

drxjason commented 2 years ago

I recently did a git pull to the game's source code, then i executed ./mac-cmake.sh and i get this error

-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.23.2/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/Library/Developer/CommandLineTools/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/jason/games/unnamed-sdvx-clone/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make -f Makefile cmTC_a15ce/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_a15ce.dir/build.make CMakeFiles/cmTC_a15ce.dir/build
    Building C object CMakeFiles/cmTC_a15ce.dir/testCCompiler.c.o
    /Library/Developer/CommandLineTools/usr/bin/cc   -arch arm64 -mmacosx-version-min=12.0 -MD -MT CMakeFiles/cmTC_a15ce.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_a15ce.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_a15ce.dir/testCCompiler.c.o -c /Users/jason/games/unnamed-sdvx-clone/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_a15ce
    /opt/homebrew/Cellar/cmake/3.23.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a15ce.dir/link.txt --verbose=1
    /Library/Developer/CommandLineTools/usr/bin/cc  -arch arm64 -mmacosx-version-min=12.0 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_a15ce.dir/testCCompiler.c.o -o cmTC_a15ce
    ld: library not found for -lSystem
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_a15ce] Error 1
    make: *** [cmTC_a15ce/fast] Error 2

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

To reproduce this:

  1. git clone the game's repository
  2. if theres any new commit, do a git pull thats exactly what i did
  3. Try to execute the cmake script...

2020 MacBook Air SoC: Apple M1

Drewol commented 2 years ago

do you have xcode installed? normally i think build tools are included with homebrew but it looks like they might be missing.

drxjason commented 2 years ago

do you have xcode installed? normally i think build tools are included with homebrew but it looks like they might be missing.

Yes i have xcode and its build utilities installed using xcode-select I can confirm this by going into the directory the build tools were installed and is/are working properly

Hinara commented 2 years ago

I'm sorry but I don't think that this is an USC issue, Things to try, maybe reinstall xcode or cmake (might be cmake) but this is an early fail of CMake for C compilation meaning we can't do anything to fix it on our side. Might try to look at this issue on stack overflow ? https://stackoverflow.com/questions/56156520/gfortran-error-ld-library-not-found-for-lsystem-when-trying-to-compile Or maybe this github issue ? https://github.com/ponylang/ponyc/issues/3684

drxjason commented 2 years ago

hinara's solution worked... it compiled successfully ~but now i get an incompatible framework error when i try to run it~

jason@Jasons-Mac unnamed-sdvx-clone % ./bin/usc-game
dyld[61138]: Library not loaded: @rpath/../Frameworks/ogg.framework/Versions/A/ogg
  Referenced from: /Users/jason/games-test/unnamed-sdvx-clone/bin/usc-game
  Reason: tried: '/Library/Frameworks/ogg.framework/Versions/A/ogg' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/System/Library/Frameworks/ogg.framework/Versions/A/ogg' (no such file)
zsh: abort      ./bin/usc-game

UPDATE: i had to copy the arm64 versions of required dependencies ogg vorbis freetype from /usr/local/lib to the /Library/Frameworks/ directory and it worked now. Im closing this issue... anyone who has problems like mine can refer to this issue