HaxeFoundation / hashlink

A virtual machine for Haxe
https://hashlink.haxe.org/
MIT License
813 stars 158 forks source link

v1.12 make fails on maxOS Monterey 12.5.1 M1 cpu #557

Open elliott5 opened 2 years ago

elliott5 commented 2 years ago

brew bundle seems to work, make fails:

% brew bundle
==> Tapping homebrew/bundle
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-bundle'...
remote: Enumerating objects: 6720, done.
remote: Counting objects: 100% (794/794), done.
remote: Compressing objects: 100% (192/192), done.
remote: Total 6720 (delta 666), reused 677 (delta 602), pack-reused 5926
Receiving objects: 100% (6720/6720), 1.55 MiB | 4.10 MiB/s, done.
Resolving deltas: 100% (3952/3952), done.
Tapped 1 command (98 files, 1.9MB).
Installing cmake
Installing jpeg-turbo
Installing libpng
Installing sdl2
Installing libogg
Installing libvorbis
Installing openal-soft
Installing mbedtls@2
Installing libuv
Installing openssl
Installing sqlite
Homebrew Bundle complete! 11 Brewfile dependencies now installed.

% make
cc -Wall -O3 -I src -msse2 -mfpmath=sse -std=c11 -D LIBHL_EXPORTS -m64 -I include -I /usr/local/include -I /usr/local/opt/libjpeg-turbo/include -I /usr/local/opt/jpeg-turbo/include -I /usr/local/opt/sdl2/include/SDL2 -I /usr/local/opt/libvorbis/include -I /usr/local/opt/openal-soft/include -Dopenal_soft  -DGL_SILENCE_DEPRECATION -o include/pcre/pcre_chartables.o -c include/pcre/pcre_chartables.c 
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
error: unknown FP unit 'sse'
make: *** [include/pcre/pcre_chartables.o] Error 1
elliott5 commented 2 years ago

In good news, hl compiled on OSX/X86 runs on OSX/M1, provided that libhl.dylib is also moved with it ... and both installed at the usual locations.

elliott5 commented 2 years ago

I can get my "hello world" program (generated with HashLink/C) to compile and link correctly by adding an -arch x86_64 flag.

Which then runs correctly on my M1 Mac (via the magic of Rosetta 2).

gcc -O3 -o hello -std=c11  out/main.c  -I ./../hashlink-1.12/src -I ./out -lhl -L /usr/local/lib    -arch x86_64 
tobil4sk commented 2 years ago

Might be relevant: https://github.com/HaxeFoundation/hashlink/issues/457

curldivergence commented 2 years ago

Hi, I'm curious - is anybody working on aarch64 JIT at the moment? Unfortunately calling C compiler is not convenient for my use case, and NekoVM is marked as deprecated :( Thanks!

danielo515 commented 1 year ago

In my case, make just outputs this:

make: ./hl: Command not found
cc -Wall -O3 -I src -msse2 -mfpmath=sse -std=c11 -D LIBHL_EXPORTS -m64 -I include -I /usr/local/include -I /usr/local/opt/libjpeg-turbo/include -I /usr/local/opt/jpeg-turbo/include -I /usr/local/opt/sdl2/include -I /usr/local/opt/libvorbis/include -I /usr/local/opt/openal-soft/include -Dopenal_soft  -DGL_SILENCE_DEPRECATION -o include/pcre/pcre2_auto_possess.o -c include/pcre/pcre2_auto_possess.c -I include/pcre -D HAVE_CONFIG_H -D PCRE2_CODE_UNIT_WIDTH=16
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
error: unknown FP unit 'sse'
make: *** [include/pcre/pcre2_auto_possess.o] Error 1
wynan commented 12 months ago

Though Hashlink still does not work, make will succeed now on Apple Silicon now that this PR is merged and compiling to C works: https://github.com/HaxeFoundation/hashlink/commit/dacd8fb13fa16185a8b658c049b4081adcdc241c

yz-xlame commented 3 months ago

try

make clean
make uninstall

then edit ~/.zprofile or ~/.bash_profile use x86 brew package

export PATH="/usr/local/bin:$PATH"

then

arch -x86_64 make
sudo  arch -x86_64 make install

work for me