Linking on Apple M1 Max
When attempting to build the example file reptile.carp, I get the following error: ld: warning: ignoring file /usr/local/lib/libSDL2.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
This makes sense, as I have built SDL2 for arm64.
Is there a way to tell carp to build and link for macOS-arm64?
I did a stack build and stack install hoping this would build a native ARM binary, but I still am seeing the link error.
Typing (target-arch) in the repl shows this:
鲤 (target-arch)
I did not understand the form `("x86_64")` at REPL:1:2.
Traceback:
(target-arch) at REPL:1:1.
I was able to install the x86_64 libraries and use Rosetta2 emulation to build. I wasn't able to figure out how to get stack to build a arm version of carp. That may be a much more complex issue.
Do you use pkg-config?
If you do the following in your project you can see the complete shell command that carp uses to compile your code:
(Project.config "echo-compiler-cmd" true)
What does it say? (when you build)
I was able to install the x86_64 libraries and use Rosetta2 emulation to build. I wasn't able to figure out how to get stack to build a arm version of carp. That may be a much more complex issue.
Responding to this incredibly late but last time I checked Stack still does not support ARM sadly...
https://github.com/commercialhaskell/stack/issues/2103
Can confirm this works now, GLFW example compiles and runs
MBP M1, macOS 12.6.1
stack --version
Version 2.9.3 aarch64
stack build --extra-include-dirs=/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/ffi
stack install --extra-include-dirs=/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/ffi
The flag is needed due to this issue https://gitlab.haskell.org/ghc/ghc/-/issues/20592
@roman01la Great information, thanks!