lv_binding_js icon indicating copy to clipboard operation
lv_binding_js copied to clipboard

add Apple Sillicon (macOS arm64) simulator build

Open Frulko opened this issue 1 year ago • 1 comments

Hi, Following my old issue #2

I tried to get back on my local project to try to make it worked on macOS arm64. And it was quite easy in fact.

My changes are about :

  • adding a custom make build for macos arm following the #2
  • adding a way in CMakeLists.txt to detect arm on MacOS and use Simulator instead of build for linux arm.

Now I can build on my MacBook Pro M1.

Thanks for you awesome work Have a nice day :)

Frulko avatar Aug 17 '23 07:08 Frulko

Hey, thanks for sending this!

I'm currently using make dev-x86 to compile and run the simulator on my M1 Mac:

$ make dev-x86

...

-- summary of build options:
    Install prefix:  /usr/local
    Target system:   Darwin
    Compiler:
      C compiler:    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc (Clang)
      CFLAGS:         -O0 -Wall -g -ggdb -std=gnu99

...

It's counterintuitive because it does define the platform as x86, but when checking the binary type, it matches arm64:

$ file dev_x86/lvgljs
dev_x86/lvgljs: Mach-O 64-bit executable arm64

I checked this PR and running make dev-macos-arm is giving me an error:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
  The CMAKE_C_COMPILER:

    /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
make: *** [dev-macos-arm] Error 1

The fact that the first works for me and the second not, and the other way around for you, leads me to believe there may be some environment issue. Here's my toolchain version:

GNU Make 3.81
cmake version 3.27.3
Apple clang version 14.0.3 (clang-1403.0.22.14.1)

Could you share your toolchain version numbers to further investigate?

derekstavis avatar Aug 21 '23 04:08 derekstavis

Closing this since the whole build process has changed. Please report back if you still have a problem

derekstavis avatar Aug 05 '24 01:08 derekstavis