Open sternenseemann opened 3 years ago
Hi, I have to admit that I don't know much about Mac OS and Objective C.
Ill look around the documentation and see if I can figure out the issue. Is it somehow possible for me to reproduce this issue without owning a MacOS machine?
The code for Mac OS was contributed by @codebje in https://github.com/TomSmeets/FractalArt/pull/1. @codebje if you have some free time, maybe you could take a quick look?
Tom
I'm not able to help with nix issues to any substantial degree - it needs more disk space than I have available to install and use, and more head space than I have available to understand and debug.
You can still build FractalArt on OS X using stack --no-nix build
though, if that's useful as a work-around.
Thanks for the feedback codebje. Good to hear that it does compile normally without nix.
It seems that the code has problems finding the AppKit module. After looking a bit into Objective-C if found that the @import
is a newer version of #import
. It could be that this causes issues for some reason. I also found one instance of this inside nixpkgs. The commit did not state the reason for why the sed
was used, but they might have had the same issue.
I would suggest @sternenseemann that you try the following commit https://github.com/TomSmeets/FractalArt/commit/5170bad46a2ffbdbc6da15760bdbc8a65d108940 which is available in the nix-macos-fix branch.
diff --git a/cbits/wallpaper.m b/cbits/wallpaper.m
index ee744f9..d580f36 100644
--- a/cbits/wallpaper.m
+++ b/cbits/wallpaper.m
@@ -1,6 +1,6 @@
#include <stdlib.h>
-@import AppKit;
+#import <AppKit/AppKit.h>
NSSize getRootWindowSize() {
@autoreleasepool {
If that doesn't work, then try adding the following to the nix override:
NIX_LDFLAGS = "-framework AppKit";
That does work, but now we have a new linker error:
Linking dist/build/FractalArt/FractalArt ...
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_NSString", referenced from:
objc-class-ref in wallpaper.o
"_OBJC_CLASS_$_NSWorkspace", referenced from:
objc-class-ref in wallpaper.o
"_OBJC_CLASS_$_NSScreen", referenced from:
objc-class-ref in wallpaper.o
ld: symbol(s) not found for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
darwin.libobjc
is in librarySystemDepends
already (removing it doesn't change the error though), so not sure what we should do here. Maybe ghc is not passing a flag or something.
I've tried to get
FractalArt
to compile on darwin with nix using the following override:Which results in the following build log: