odevices / er-301

Firmware and SDK for the ER-301
https://www.orthogonaldevices.com/er-301
MIT License
127 stars 26 forks source link

Building on M1 #80

Open unremarkablegarden opened 1 year ago

unremarkablegarden commented 1 year ago
> git clone -b v0.7.0-dev1 https://github.com/odevices/er-301.git
> cd er-301
> make emu
[lua.mk darwin testing] C libs/lua54/lapi.c
...
[emu.mk darwin testing] C++(SWIG) testing/darwin/emu/od/glue/app_swig.cpp
testing/darwin/emu/od/glue/app_swig.cpp: In function 'int _wrap_FileBrowser_getCheckedPaths(lua_State*)':
testing/darwin/emu/od/glue/app_swig.cpp:16610:31: error: cannot bind non-const lvalue reference of type 'std::vector<std::__cxx11::basic_string<char> >&' to an rvalue of type 'std::vector<std::__cxx11::basic_string<char> >'
16610 |     stringVectorToLuaTable(L, result); SWIG_arg++; return SWIG_arg; fail: SWIGUNUSED; }  lua_error(L); return 0; }
      |                               ^~~~~~
testing/darwin/emu/od/glue/app_swig.cpp:2862:3: note:   after user-defined conversion: 'SwigValueWrapper<T>::operator T&&() const [with T = std::vector<std::__cxx11::basic_string<char> >]'
 2862 |   operator T&&() const { return std::move(*pointer.ptr); }
      |   ^~~~~~~~
testing/darwin/emu/od/glue/app_swig.cpp:3084:69: note:   initializing argument 2 of 'int stringVectorToLuaTable(lua_State*, std::vector<std::__cxx11::basic_string<char> >&)'
 3084 | int stringVectorToLuaTable(lua_State* L, std::vector<std::string> & vec);
      |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
make[1]: *** [testing/darwin/emu/od/glue/app_swig.o] Error 1
make: *** [emu] Error 2
dennisgsmith commented 9 months ago

FWIW I was able to successfully compile and start the emulator on my M1 Mac. Although the error I initially got was different.

~/projects/er-301 $ make emu
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f scripts/lua.mk
make[1]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f scripts/miniz.mk
make[1]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f scripts/lodepng.mk
make[1]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f scripts/emu.mk
[emu.mk darwin testing] C emu/hal/audio.c
make[1]: gcc-11: No such file or directory
make[1]: *** [testing/darwin/emu/emu/hal/audio.o] Error 1
make: *** [emu] Error 2
~/projects/er-301 $ testing/darwin/emu/emu.elf
dyld[91206]: Library not loaded: /opt/homebrew/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib
  Referenced from: <943FDF8E-E5EA-3E81-96AB-8C3B1058FF1E> /Users/dennissmith/projects/er-301/testing/darwin/emu/emu.elf
  Reason: tried: '/opt/homebrew/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib' (no such file), '/opt/homebrew/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib' (no such file), '/usr/local/lib/libgcc_s.1.1.dylib' (no such file), '/usr/lib/libgcc_s.1.1.dylib' (no such file, not in dyld cache)
zsh: abort      testing/darwin/emu/emu.elf

gcc was aliased to the wrong version. Installing gcc-11 and creating a symlink to it in the project directory fixed it.

brew install gcc@11
ln -s /opt/homebrew/bin/gcc-11 /opt/homebrew/bin/gcc
make emu
tibbon commented 3 weeks ago

I'm getting a slightly different error on my M1 mac with make emu

[emu.mk darwin testing] C emu/tls.c
In file included from /opt/homebrew/opt/sdl2/include/SDL2/SDL_platform.h:76,
                 from /opt/homebrew/opt/sdl2/include/SDL2/SDL_config.h:33,
                 from /opt/homebrew/opt/sdl2/include/SDL2/SDL_stdinc.h:31,
                 from /opt/homebrew/opt/sdl2/include/SDL2/SDL_main.h:25,
                 from /opt/homebrew/opt/sdl2/include/SDL2/SDL.h:32,
                 from emu/tls.c:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/TargetConditionals.h:140:50: error: missing binary operator before token "("
  140 | #if !defined(__has_extension) || !__has_extension(define_target_os_macros)
      |                                                  ^
make[1]: *** [testing/darwin/emu/emu/tls.o] Error 1
make: *** [emu] Error 2

Currently on MacOS 14.5 (23F79)