stuffbydavid/Mine-imator

Compilation for macOS (arm64) for Apple Silicon processors

Opened this issue · 1 comments

I'm trying to compile arm64 version of Mine-Imator but I'm stuck on this:

[ 100%] Linking CXX executable Mine-imator
ld: warning: ignoring file External/Mac/libx264.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libzip.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libz.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libopenal.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libavformat.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libavcodec.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libswresample.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libswscale.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file External/Mac/libavutil.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_alBufferData", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_alDeleteBuffers", referenced from:
      CppProject::Sound::~Sound() in MovieLib.cpp.o
      CppProject::Sound::~Sound() in MovieLib.cpp.o
      CppProject::Sound::~Sound() in MovieLib.cpp.o
  "_alDeleteSources", referenced from:
      CppProject::SoundInstance::~SoundInstance() in SoundInstance.cpp.o
  "_alGenBuffers", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_alGenSources", referenced from:
      CppProject::SoundInstance::SoundInstance(CppProject::Sound*, bool) in SoundInstance.cpp.o
  "_alGetSourcef", referenced from:
      CppProject::audio_sound_get_track_position(long long) in AudioFunc.cpp.o
  "_alGetSourcei", referenced from:
      CppProject::SoundInstance::CleanSounds() in SoundInstance.cpp.o
  "_alSource3f", referenced from:
      CppProject::SoundInstance::SoundInstance(CppProject::Sound*, bool) in SoundInstance.cpp.o
  "_alSourcePlay", referenced from:
      CppProject::SoundInstance::SoundInstance(CppProject::Sound*, bool) in SoundInstance.cpp.o
  "_alSourceStop", referenced from:
      CppProject::SoundInstance::~SoundInstance() in SoundInstance.cpp.o
  "_alSourcef", referenced from:
      CppProject::SoundInstance::SoundInstance(CppProject::Sound*, bool) in SoundInstance.cpp.o
      CppProject::audio_sound_gain(long long, double, double) in AudioFunc.cpp.o
      CppProject::audio_sound_set_track_position(long long, double) in AudioFunc.cpp.o
  "_alSourcei", referenced from:
      CppProject::SoundInstance::SoundInstance(CppProject::Sound*, bool) in SoundInstance.cpp.o
      CppProject::audio_pause_sound(long long) in AudioFunc.cpp.o
      CppProject::audio_resume_sound(long long) in AudioFunc.cpp.o
  "_alcCloseDevice", referenced from:
      CppProject::AppHandler::~AppHandler() in AppHandler.cpp.o
  "_alcCreateContext", referenced from:
      CppProject::AppHandler::AppHandler(int, char**) in AppHandler.cpp.o
  "_alcDestroyContext", referenced from:
      CppProject::AppHandler::~AppHandler() in AppHandler.cpp.o
  "_alcMakeContextCurrent", referenced from:
      CppProject::AppHandler::AppHandler(int, char**) in AppHandler.cpp.o
      CppProject::AppHandler::~AppHandler() in AppHandler.cpp.o
  "_alcOpenDevice", referenced from:
      CppProject::AppHandler::AppHandler(int, char**) in AppHandler.cpp.o
  "_av_compare_ts", referenced from:
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_av_dict_set", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_av_frame_alloc", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_av_frame_free", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_av_frame_get_buffer", referenced from:
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_av_frame_make_writable", referenced from:
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_av_frame_unref", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_freep", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_guess_format", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_av_interleaved_write_frame", referenced from:
      CppProject::Encode(AVCodecContext*, AVFrame*, AVStream*) in MovieLib.cpp.o
  "_av_opt_set_int", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_opt_set_sample_fmt", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_packet_alloc", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::Encode(AVCodecContext*, AVFrame*, AVStream*) in MovieLib.cpp.o
  "_av_packet_free", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::Encode(AVCodecContext*, AVFrame*, AVStream*) in MovieLib.cpp.o
  "_av_packet_rescale_ts", referenced from:
      CppProject::Encode(AVCodecContext*, AVFrame*, AVStream*) in MovieLib.cpp.o
  "_av_packet_unref", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_read_frame", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_rescale_q", referenced from:
      CppProject::lib_movie_audio_sound_add(double, double, double, double, double) in MovieLib.cpp.o
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_av_samples_alloc", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_samples_get_buffer_size", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_av_write_trailer", referenced from:
      CppProject::lib_movie_done() in MovieLib.cpp.o
  "_avcodec_alloc_context3", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_close", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::lib_movie_done() in MovieLib.cpp.o
  "_avcodec_find_decoder", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_find_encoder", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_open2", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_parameters_from_context", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_parameters_to_context", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_receive_frame", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avcodec_receive_packet", referenced from:
      CppProject::Encode(AVCodecContext*, AVFrame*, AVStream*) in MovieLib.cpp.o
  "_avcodec_send_frame", referenced from:
      CppProject::Encode(AVCodecContext*, AVFrame*, AVStream*) in MovieLib.cpp.o
  "_avcodec_send_packet", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avformat_alloc_context", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avformat_alloc_output_context2", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avformat_close_input", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avformat_find_stream_info", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avformat_free_context", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
      CppProject::lib_movie_done() in MovieLib.cpp.o
  "_avformat_new_stream", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avformat_open_input", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_avformat_write_header", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_avio_close", referenced from:
      CppProject::lib_movie_done() in MovieLib.cpp.o
  "_avio_open", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_swr_alloc", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_swr_convert", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_swr_free", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_swr_init", referenced from:
      CppProject::Sound::Sound(CppProject::StringType) in MovieLib.cpp.o
  "_sws_freeContext", referenced from:
      CppProject::lib_movie_done() in MovieLib.cpp.o
  "_sws_getContext", referenced from:
      CppProject::lib_movie_start(CppProject::StringType, CppProject::StringType) in MovieLib.cpp.o
  "_sws_scale", referenced from:
      CppProject::lib_movie_frame(CppProject::StringType) in MovieLib.cpp.o
  "_zip_close", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
  "_zip_fclose", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
  "_zip_fopen_index", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
  "_zip_fread", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
  "_zip_get_num_entries", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
  "_zip_open", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
  "_zip_stat_index", referenced from:
      CppProject::lib_unzip(CppProject::StringType, CppProject::StringType) in FileLib.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Mine-imator] Error 1
make[1]: *** [CMakeFiles/Mine-imator.dir/all] Error 2
make: *** [all] Error 2

Also BUILD.md was a bit unclear for me, should I build it from terminal or inside xcode by creating a project with sudo cmake -G Xcode .?

I'm currently using this to built it inside terminal:

sudo cmake CMakeLists.txt \                                                                                                     
-DOpenMP_C_FLAGS=-fopenmp=lomp \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES="libomp" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="/opt/homebrew/opt/libomp/lib/libomp.dylib" \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp /opt/homebrew/opt/libomp/lib/libomp.dylib -I/opt/homebrew/opt/libomp/include" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp /opt/homebrew/opt/libomp/lib/libomp.dylib -I/opt/homebrew/opt/libomp/include" \

If I should compile it via Xcode that's the error I'm getting:

/Users/jacob/mim1native/Mine-imator/CppProject/CMakeFiles/Mine-imator.dir/Debug/cmake_pch.hxx cannot specify -o when generating multiple output files

The libraries in the External/ folder need to be rebuild with macOS-arm64, the BUILD.md contains instructions how they're built.
I use the XCode IDE to build.