MinecraftMachina / ManyMC

📦 A familiar Minecraft Launcher with native support for macOS arm64 (M1)
GNU General Public License v3.0
500 stars 19 forks source link

Cannot build #59

Closed bushaev-denis closed 2 years ago

bushaev-denis commented 2 years ago

Describe the bug Cannot build

To reproduce

git clone ....
sudo chmod +x build.sh
sudo ./build.sh

Expected behavior Successfully build

Logs

rm: dist: No such file or directory
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ - broken
CMake Error at /Users/dez/homebrew/Cellar/cmake/3.23.1/share/cmake/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "/usr/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/dez/ManyMC/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make -f Makefile cmTC_9ea79/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_9ea79.dir/build.make CMakeFiles/cmTC_9ea79.dir/build
    Building CXX object CMakeFiles/cmTC_9ea79.dir/testCXXCompiler.cxx.o
    /usr/bin/clang++   -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.7 -MD -MT CMakeFiles/cmTC_9ea79.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_9ea79.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_9ea79.dir/testCXXCompiler.cxx.o -c /Users/dez/ManyMC/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    Linking CXX executable cmTC_9ea79
    /Users/dez/homebrew/Cellar/cmake/3.23.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9ea79.dir/link.txt --verbose=1
    /usr/bin/clang++  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_9ea79.dir/testCXXCompiler.cxx.o -o cmTC_9ea79
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_9ea79] Error 1
    make: *** [cmTC_9ea79/fast] Error 2

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

System configuration

bushaev-denis commented 2 years ago

This fixes with adding new cmake flag (build.sh)

    -CFLAGS=-stdlib=libc++

But then ive got new error

CMake Error at CMakeLists.txt:120 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
bushaev-denis commented 2 years ago

Ok, this also fixed with replace

if(APPLE AND EXISTS /opt/homebrew/opt/qt@5)
    list(APPEND CMAKE_PREFIX_PATH "/Users/dez/homebrew/opt/qt@5/bin")
endif()

to

list(APPEND CMAKE_PREFIX_PATH "/Users/dez/homebrew/opt/qt@5")

on CMakeList.txt

But then ive got new error 😢

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Library/Developer/CommandLineTools/usr/bin/cc 
Build flags: 
Id flags:  

The output was:
1
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /Library/Developer/CommandLineTools/usr/bin/c++ 
Build flags: 
Id flags:  

The output was:
1
ld: library not found for -lc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
bushaev-denis commented 2 years ago

MAYBE my answer will look funny to people who know what's going on here 😄 . (im just php/js coder) But in the end I fixed this problem by adding just 2 lines before project(Launcher) CMakeList.txt

set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
list(APPEND CMAKE_PREFIX_PATH "/Users/dez/homebrew/opt/qt@5")
project(Launcher)
bushaev-denis commented 2 years ago

Now its your problem @ViRb3 😆