Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on Apple Silicon #242

Closed
emiellensink opened this issue Dec 11, 2020 · 14 comments
Closed

Build fails on Apple Silicon #242

emiellensink opened this issue Dec 11, 2020 · 14 comments

Comments

@emiellensink
Copy link

emiellensink commented Dec 11, 2020

Hi,

I've been trying to build fs-uae on my new M1 machine. I've cloned the master branch and used brew to install the required dependencies. I'm not running brew under rosetta, so things may also be a little flaky there. The dependencies needed for UAE I got installed without any warnings or errors though.

When building, bootstrap and configure finish without issue, though I have to configure with jit disabled.

Make fails, it seems on running one of the source code generators early in the build process.

emiel@aether ~/T/u/fs-uae> make                                                                                                                                       master
depbase=`echo src/genlinetoscr.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
	g++ -DHAVE_CONFIG_H -I.  -DMACOSX -DMACOS -DUAE -DFSUAE    -I./flac/include -I./gen -I./src -I./src/jit -I./src/include -I./src/od-fs -I./src/od-fs/include -I./src/od-win32 -I./src/od-win32/caps -I./libfsemu/include -I./fsemu/src  -I./glad/include   -I./libudis86/include  -I./prowizard/include   -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/Cellar/glib/2.66.2_1/include -I/opt/homebrew/Cellar/glib/2.66.2_1/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.66.2_1/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.44/include -DLUA_USE_POSIX -I/opt/homebrew/Cellar/zlib/1.2.11/include -I/opt/homebrew/Cellar/libpng/1.6.37/include/libpng16  -D_THREAD_SAFE -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -I/opt/homebrew/include/SDL2 -I/opt/homebrew/Cellar/zlib/1.2.11/include  -fno-strict-overflow -fno-strict-aliasing -Wno-format-truncation -Waddress -Werror=missing-declarations -Wpointer-arith -fvisibility=hidden -I/opt/homebrew/Cellar/libmpeg2/0.5.1/include/mpeg2dec -g -O2 -MT src/genlinetoscr.o -MD -MP -MF $depbase.Tpo -c -o src/genlinetoscr.o src/genlinetoscr.cpp &&\
	mv -f $depbase.Tpo $depbase.Po
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
g++ -I/opt/homebrew/Cellar/glib/2.66.2_1/include -I/opt/homebrew/Cellar/glib/2.66.2_1/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.66.2_1/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.44/include -DLUA_USE_POSIX -I/opt/homebrew/Cellar/zlib/1.2.11/include -I/opt/homebrew/Cellar/libpng/1.6.37/include/libpng16  -D_THREAD_SAFE -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -I/opt/homebrew/include/SDL2 -I/opt/homebrew/Cellar/zlib/1.2.11/include  -fno-strict-overflow -fno-strict-aliasing -Wno-format-truncation -Waddress -Werror=missing-declarations -Wpointer-arith -fvisibility=hidden -I/opt/homebrew/Cellar/libmpeg2/0.5.1/include/mpeg2dec -g -O2 -headerpad_max_install_names -pagezero_size 0x2000 -rpath @executable_path/../Frameworks   -L/opt/homebrew/opt/zlib/lib -o gen/genlinetoscr src/genlinetoscr.o  -lm -ldl   -framework Carbon -framework Cocoa -L/opt/homebrew/Cellar/glib/2.66.2_1/lib -L/opt/homebrew/opt/gettext/lib -lgthread-2.0 -lglib-2.0 -lintl -framework IOKit -framework OpenAL -framework OpenGL -L/opt/homebrew/Cellar/zlib/1.2.11/lib -L/opt/homebrew/Cellar/libpng/1.6.37/lib -lpng16 -lz   -L/opt/homebrew/lib -lSDL2 -L/opt/homebrew/lib -lSDL2_ttf -lSDL2 -L/opt/homebrew/Cellar/zlib/1.2.11/lib -lz  -L/opt/homebrew/Cellar/libmpeg2/0.5.1/lib -lmpeg2 -lmpeg2convert
./gen/genlinetoscr > ./gen/linetoscr.cpp
/bin/sh: line 1: 69831 Killed: 9               ./gen/genlinetoscr > ./gen/linetoscr.cpp
make: *** [gen/linetoscr.cpp] Error 137
emiel@aether ~/T/u/fs-uae>

Is there something simple I'm missing, or is the new architecture causing trouble? If it helps, here is my configuration summary:

Configuration summary for FS-UAE:

  Building for OS:   darwin20.1.0 ("macos")
  Building for CPU:  aarch64
  Module extension:  .so

  LIBMPEG2_CFLAGS:   -I/opt/homebrew/Cellar/libmpeg2/0.5.1/include/mpeg2dec
  LIBMPEG2_LIBS:     -L/opt/homebrew/Cellar/libmpeg2/0.5.1/lib -lmpeg2 -lmpeg2convert
  OPENAL_CFLAGS:     
  OPENAL_LIBS:       -framework OpenAL
  OPENGL_CFLAGS:     
  OPENGL_LIBS:       -framework OpenGL
  OS_CPPFLAGS:       -DMACOSX -DMACOS
  OS_LDFLAGS:        -headerpad_max_install_names -pagezero_size 0x2000 -rpath @executable_path/../Frameworks
  SDL2_CFLAGS:       -D_THREAD_SAFE -I/opt/homebrew/include/SDL2
  SDL2_LIBS:         -L/opt/homebrew/lib -lSDL2

@rofl0r
Copy link

rofl0r commented Dec 12, 2020

what happens when you run gen/genlinetoscr > ./gen/linetoscr.cpp by hand ?
in case it's a shell script running sh -x gen/genlinetoscr > ./gen/linetoscr.cpp might give additional clues.

@emiellensink
Copy link
Author

emiellensink commented Dec 12, 2020

Sorry, I should have mentioned earlier that I tried that. Here's the output when I run it manually.

emiel@aether ~/T/u/fs-uae> ./gen/genlinetoscr ./gen/linetoscr.cpp                                  master
[1]    71042 killed     ./gen/genlinetoscr ./gen/linetoscr.cpp
emiel@aether ~/T/u/fs-uae> file ./gen/genlinetoscr                                             137 master
./gen/genlinetoscr: Mach-O 64-bit executable arm64
emiel@aether ~/T/u/fs-uae>                                                                         master

Interestingly, if I pretend nothing went wrong (which won't make the build complete of course, but it gives some more insights), the next tool also fails:

emiel@aether ~/T/u/fs-uae> ./gen/genblitter i > ./gen/blit.h                                       master
[1]    71119 killed     ./gen/genblitter i > ./gen/blit.h
emiel@aether ~/T/u/fs-uae>                                                                     137 master

@renaudguerin
Copy link

I am having the exact same problem :


  Building for OS:   darwin20.2.0 ("macos")
  Building for CPU:  aarch64
  Module extension:  .so

  LIBMPEG2_CFLAGS:   -I/opt/homebrew/Cellar/libmpeg2/0.5.1/include/mpeg2dec
  LIBMPEG2_LIBS:     -L/opt/homebrew/Cellar/libmpeg2/0.5.1/lib -lmpeg2 -lmpeg2convert
  OPENAL_CFLAGS:
  OPENAL_LIBS:       -framework OpenAL
  OPENGL_CFLAGS:
  OPENGL_LIBS:       -framework OpenGL
  OS_CPPFLAGS:       -DMACOSX -DMACOS
  OS_LDFLAGS:        -headerpad_max_install_names -pagezero_size 0x2000 -rpath @executable_path/../Frameworks
  SDL2_CFLAGS:       -D_THREAD_SAFE -I/opt/homebrew/include/SDL2
  SDL2_LIBS:         -L/opt/homebrew/lib -lSDL2```
  
 ```$ make
./gen/genblitter f > ./gen/blitfunc.cpp
/bin/sh: line 1: 38259 Killed: 9               ./gen/genblitter f > ./gen/blitfunc.cpp
make: *** [gen/blitfunc.cpp] Error 137

I've tried running it in a debugger :

(lldb) target create "./gen/genblitter"
Current executable set to '/Users/renaudg/code/fs-uae/gen/genblitter' (arm64).
(lldb) r
error: Malformed Mach-o file
(lldb)

@emiellensink
Copy link
Author

emiellensink commented Dec 29, 2020

@FrodeSolheim I've made the compile work on Apple Silicon. PR is attached. This should have no consequences for the regular Intel builds.

#243

@rofl0r
Copy link

rofl0r commented Dec 30, 2020

Apple Silicon

i've seen various issues (also in other repos) opened with these exact buzz words. is this the official marketing slogan for apple's new chip?

@emiellensink
Copy link
Author

Yes. It seems now Apple Silicon will be the name of their series of desktop CPU's. The M1 is the first chip released in this series.

@FrodeSolheim
Copy link
Owner

This should have no consequences for the regular Intel builds.

I'm not entirely sure this is true - I comment more on this in the pull request

@mithrendal
Copy link

great that this will probably getting fixed 😍... in the meantime if you have a M1 mac and like to retro game during new years day and the next free days on your M1 powered mac you could head to https://github.com/dirkwhoffmann/vAmiga a modern Amiga Emulator specifically designed for the mac which also runs brilliantly on the M1 AppleSilicon.

@emiellensink
Copy link
Author

vAmiga is very nice for games. It also runs troublesome software (like desert dream) without a hitch. And it compiles with a nice native Xcode project. However... UAE is much more full featured, and to run my old Amiga set-up with graphics card and everything, unfortunately vAmiga is not mature enough.
Thanks for the tip though!

@FrodeSolheim
Copy link
Owner

I implemented the fix from the pull request conditionally in 06024a1 (only specify pagezero_size for x86-64). Please test :)

@FrodeSolheim
Copy link
Owner

I've gotten reports that 06024a1 fixed the reported build problem, so I'm closing this issue!

@renaudguerin
Copy link

Hi,

Thanks for the great work on fixing the ARM build !

@FrodeSolheim I believe a Universal Intel/ARM bundle would require more work still, but are you planning to release at least an ARM-only official "FS-UAE Suite" .dmg ?

I tried to build one from dist/macos, but the signing step failed as I don't have an Apple dev account, and I'm not sure if that's even an optional step on Big Sur/AS.

Thanks!

@emiellensink
Copy link
Author

Some other things have kept me busy the last few days, but I'm also getting successful builds, so thanks a lot for that 👍

@FrodeSolheim
Copy link
Owner

@renaudguerin Official ARM64 builds are available on https://fs-uae.net/download#macosx :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants