dfleury2 / boss-rc500-editor

RC-500 Loop Station tool to play with the XML configuration
https://dfleury2.github.io/boss-rc500-editor/
MIT License
28 stars 5 forks source link

App does not work on M1 Mac (apple arm silicon) #13

Open allenhuish opened 2 years ago

allenhuish commented 2 years ago

Hi there,

I am migrating to a new Mac OS X computer with an M1 processor.

When starting the programme I receive the following error.

zsh: bad CPU type in executable: /Applications/Boss/RC/BossRc500

Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

Regards, Allen

dfleury2 commented 2 years ago

Hi, I do not have access to a M1 processor but just a x86 using Catalina under a VM. You can try to compile it on your machine, it may work using the steps in README. Regards,

allenhuish commented 2 years ago

Well, I have now spent about 3 hours trying to compile this on my mac. As a non-developer it has been a learning curve.

I have now succeeded in running the first part of the compilation instructions.

However, the process is now failing on the 'cmake ..' step.

The error message on screen is CMake Error at CMakeLists.txt:24 (find_package): By not providing "Findinja.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "inja", but CMake did not find one.

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

injaConfig.cmake
inja-config.cmake

Add the installation prefix of "inja" to CMAKE_PREFIX_PATH or set "inja_DIR" to a directory containing one of the above files. If "inja" provides a separate development package or SDK, be sure it has been installed.

I can see that this is looking for the cmake files, but cannot find the correct folder. However the environment variable appears to be set in the cmakefile as current directory (which is where I am running the command)

I have googled a fair bit, but I give up. Can you steer me in the right direction please?

allenhuish commented 2 years ago

Well, I carried on trying.

I hard-coded the environment variable into the cmakefile and bingo.

The app has fully compiled and is running on my m1 mac.

I have not tested any functionality yet.

Let me know how I can submit the compiled binary for you to distribute.

allenhuish commented 2 years ago

It also seems that I made an initial error about your application. Your compiled version will run an M1 Mac that has rosetta installed. When I first ran it I did not have it installed. I have just tested it and your binary works now. So I have wasted a lot of time.

However, I have also checked my binary and it is running natively as an arm application so it is an improvement on compatibility for the future.

dfleury2 commented 2 years ago

Hi, great job! Not sure I will need your binary because, I will not ask you to provide it for every version I will make. I can still add a note about Rosetta needed for backward compatibility.

But, it will be cool, if I can update the steps in the README so that it work fluently for a non-developper. For example, when you run the 'cmake ..' command, is there a file called 'injaConfig.cmake' or similar in the current directory (build ?). I will make the steps under my catalina environment to see if it works fine or not.

If you find any issue let me know, I will fix it as quick as possible. (I know there is an issue about the assign ranges when using "exotic" time signature like 7/8, ..., But I did not succeed to reproduce it)

allenhuish commented 2 years ago

Hmm, I did a lot of things, but the main thing is to use 'brew' to install both cmake and conan.

When install brew on macos it will automatically install xcode command line tools and this will install a variety of necessary tools.

You can then follow the instructions on your page for linux.

However, there are conan errors for a number of packages and these need to be built by using the following commands.

conan install libelf/0.8.13@ --build missing
conan install glib/2.73.1@ --build missing
conan install harfbuzz/4.3.0@ --build missing
conan install qt/6.3.0@ --build missing

When I did it I initially installed those packages via brew, but it did not solve the problem.

After fixing that problem there is a problem with cmake. Although inja is available in the current directory it is not found and fails. I fixed it by putting the file location into the makefile manually. I'm not sure if it's a problem with the environment variable code. So I put this text into CMakeLists.txt list(APPEND CMAKE_MODULE_PATH /Users/username/boss-rc500-editor/build) I also found that I had to go above the build directory when I finally did the make.

dfleury2 commented 2 years ago

Ok, I have added the missing "-b missing" on the conan install command. I will check for the missing APPEND on CMAKe_MODULE_PATH

dfleury2 commented 2 years ago

image Strange these lines are already present. I will made the compilation steps from scratch on catalina.

laenzlinger commented 2 years ago

I am on the same route as @allenhuish: I am trying to build on my m1 mac.

Unfortunately I am absolutely not expert in C++ tooling. Please apologise if I am asking stupid questions here. But I would be very glad to be guided to solve the problems.

What I tried so far:

The first error I got when running conan install .. -b missing

gcc -c -I. -I. -I.. -I../include -I./../include -I../srclib -I./../srclib -I../lib -O3 -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch arm64 -DNDEBUG -DINSTALLDIR=\"/Users/tzhlach2/.conan/data/libiconv/1.17/_/_/package/240c2182163325b213ca6886a7614c8ed2bf1738/bin\" -DLOCALEDIR=\"/Users/tzhlach2/.conan/data/libiconv/1.17/_/_/package/240c2182163325b213ca6886a7614c8ed2bf1738/share/locale\" ./iconv.c
/bin/sh ../libtool --mode=link gcc  -O3 -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch arm64 iconv_no_i18n.o ../srclib/libicrt.a ../lib/libiconv.la  -o iconv_no_i18n
libtool: link: gcc -O3 -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch arm64 iconv_no_i18n.o -o iconv_no_i18n  ../srclib/libicrt.a ../lib/.libs/libiconv.a
ld: warning: ignoring file ../srclib/libicrt.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file ../lib/.libs/libiconv.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture arm64:
  "__libiconv_version", referenced from:
      _print_version in iconv_no_i18n.o
  "_iconv_canonicalize", referenced from:
      _main in iconv_no_i18n.o
  "_libiconv", referenced from:
      _subst_mb_to_uc_fallback in iconv_no_i18n.o
      _subst_uc_to_mb_fallback in iconv_no_i18n.o
      _subst_mb_to_wc_fallback in iconv_no_i18n.o
      _subst_wc_to_mb_fallback in iconv_no_i18n.o
      _convert in iconv_no_i18n.o
  "_libiconv_close", referenced from:
      _main in iconv_no_i18n.o
  "_libiconv_open", referenced from:
      _main in iconv_no_i18n.o
  "_libiconvctl", referenced from:
      _main in iconv_no_i18n.o
      _convert in iconv_no_i18n.o
  "_libiconvlist", referenced from:
      _main in iconv_no_i18n.o
  "_program_name", referenced from:
      _main in iconv_no_i18n.o
      _usage in iconv_no_i18n.o
      _error in iconv_no_i18n.o
  "_rpl_free", referenced from:
      _convert in iconv_no_i18n.o
  "_rpl_strerror", referenced from:
      _error in iconv_no_i18n.o
  "_safe_read", referenced from:
      _convert in iconv_no_i18n.o
  "_set_program_name", referenced from:
      _main in iconv_no_i18n.o
  "_uc_width", referenced from:
      _update_line_column in iconv_no_i18n.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [iconv_no_i18n] Error 1
make: *** [all] Error 2
libiconv/1.17:

Afterwards running cmake .. results in the same error as @allenhuish got above

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

Would you be willing to share the steps that you have taken to compile it on your M1 ?

Many thanks. I would be happy to create a PR with the build instructions once I got it working

laenzlinger commented 2 years ago

The above build problem was fixed by uninstall binutils (brew uninstall binutils)

After removing it, the application was working without issues.

dfleury2 commented 2 years ago

I have no current access to a M1 apple machine, so I will be not able to produce a binary for this target machine. Sorry. Glad you figured out yourself how to build it. Not easy for a beginner. Well done.