From 6e2df7fc732e3322eb304c0212294657f80af98e Mon Sep 17 00:00:00 2001 From: NanoTech Date: Fri, 24 Feb 2017 05:57:50 +0000 Subject: [PATCH] Add troubleshooting section --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index 497f672..781cea7 100644 --- a/README.md +++ b/README.md @@ -818,3 +818,49 @@ class Multiplier { } } ``` + +## Troubleshooting + +### `stack build` fails with `ld: framework not found SwiftHaskellLibrary` + +Build the SwiftHaskellLibrary framework in Xcode before running +`stack build`. + +![Select the SwiftAppLibrary target](tutorial/xcode-select-framework-target.png) + +See the discussion about circular dependencies in the *Linking +to the Executable* section. If this still fails, ensure that +`link-deps.sh` is being run before the framework is built as +described at the end of *Linking to the Executable*. Also check +that the `build/` directory contains all three symlinks: + +- `SwiftAppLibrary.framework` `-> ~/Library/Developer/Xcode/DerivedData/SwiftHaskell-{hash}/Build/Products/{Debug,Release}/SwiftAppLibrary.framework` +- `SwiftHaskell` `-> ../.stack-work/dist/{arch}/Cabal-{version}/build/SwiftHaskell/SwiftHaskell` +- `ghc` + - `include` `-> ~/.stack/programs/{arch}/ghc-{version}/bin/../lib/ghc-{version}/include` + +### Building in Xcode fails with `PBXCp ...build/SwiftHaskell/SwiftHaskell: No such file or directory` + +Build the Haskell executable with `stack build`. + +### Some Target Membership checkboxes are disabled in Xcode + +Add a Compile Sources or Copy Bundle Resources phase, as +appropriate for the file you're modifying, to the target with +the disabled checkbox. + +### Building in Xcode fails with `Unable to run command ... - this target might include its own product.` + +Ensure that the Copy Files phase for the executable is copying +the executable, and not the app bundle (the product). See the +*App Bundle Configuration* section. + +![Copy into Executables](tutorial/xcode-copy-files-swifthaskell-executable.png) + +### Running the app fails with `dyld: Library not loaded: @rpath/libswiftAppKit.dylib` + +Ensure that **Always Embed Swift Standard Libraries** is set +to **Yes** on the app target, as described in *App Bundle +Configuration*. + +![Always Embed Swift Standard Libraries: Yes](tutorial/xcode-embed-swift-standard-libs.png)