Tehnix / MobileHaskellFun

Project set up for playing around with mobile haskell
https://codetalk.io/posts/2018-02-07-Mobile-Haskell.html
15 stars 4 forks source link

How to fix make iOS error? #2

Closed JulianZhang closed 6 years ago

JulianZhang commented 6 years ago

Dear

I'm following your blog try to run the app. But failed when make iOS

Can we set a lts version for this project.

./call make iOS
CABAL=x86_64-apple-ios-cabal make cabal-build
x86_64-apple-ios-cabal new-configure --disable-shared --enable-static --allow-newer --ghc-option=-fllvmng
Resolving dependencies...
Build profile: -w ghc-8.4.0.20180109 -O1
In order, the following would be built (use -v for more details):
 - natural-transformation-0.4 (lib) (requires build)
 - transformers-compat-0.6.0.6 (lib) (requires build)
 - transformers-base-0.4.4 (requires build)
 - freer-simple-1.1.0.0 (lib) (requires build)
 - freer-simple-1.1.0.0 (exe:freer-examples) (requires build)
 - MobileFun-0.1.0.0 (lib) (first run)
x86_64-apple-ios-cabal new-build --allow-newer --ghc-option=-fllvmng
Resolving dependencies...
Build profile: -w ghc-8.4.0.20180109 -O1
In order, the following will be built (use -v for more details):
 - transformers-compat-0.6.0.6 (lib) (requires build)
 - transformers-base-0.4.4 (lib:transformers-base) (requires build)
 - freer-simple-1.1.0.0 (lib) (requires build)
 - MobileFun-0.1.0.0 (lib) (first run)
Configuring transformers-compat-0.6.0.6 (lib)...
Building transformers-compat-0.6.0.6 (lib)...

Failed to build transformers-compat-0.6.0.6.
Build log (
/Users/zhangjun/.cabal/logs/ghc-8.4.0.20180109/trnsfrmrs-cmpt-0.6.0.6-7ce505e2.log
):
Configuring library for transformers-compat-0.6.0.6..
Preprocessing library for transformers-compat-0.6.0.6..
Building library for transformers-compat-0.6.0.6..
[1 of 4] Compiling Control.Monad.Trans.Instances ( src/Control/Monad/Trans/Instances.hs, dist/build/Control/Monad/Trans/Instances.o )

src/Control/Monad/Trans/Instances.hs:536:10: error:
    Duplicate instance declarations:
      instance forall k a (b :: k).
               Semigroup a =>
               Semigroup (Constant a b)
        -- Defined at src/Control/Monad/Trans/Instances.hs:536:10
      instance [safe] forall k a (b :: k).
                      Semigroup a =>
                      Semigroup (Constant a b)
        -- Defined in ‘Data.Functor.Constant’
    |
536 | instance (Semigroup.Semigroup a) => Semigroup.Semigroup (Constant a b) where
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build transformers-compat-0.6.0.6 (which is required by
MobileFun-0.1.0.0). See the build log above for details.

make[1]: *** [cabal-build] Error 1
make: *** [binaries/iOS/libHSMobileFun.a] Error 2
Tehnix commented 6 years ago

Hmm, I don't think it's possible to set an LTS when using cabal new-build? If there is, that would be neat :)

Alternatively, I should really have frozen the packages to specific versions, and also I forgot to remove the freer package, which is not needed at all in the Hello World example. To quickly move on, just remove this line https://github.com/Tehnix/MobileHaskellFun/blob/6842d3845d923eaf2907886c7776f25c76347a62/hs-src/MobileFun.cabal#L16.

I'll look into the package problem in the meantime (have to build it all from scratch on my work laptop...).

Tehnix commented 6 years ago

I've updated the .cabal file, added the blog post quick install instructions to the README, and also commented out the libffi install in the setup-tools.sh.

If you pull down the changes, the ./call make iOS should work now (only needed the cabal change for that one) :)

I'll close this, but we can reopen if there are other issues, of if you have any suggestions as to how we can get an LTS or something like that to work nicely with this.