ghc-ios / ghc-ios-scripts

Scripts for building GHC and Haskell programs for iOS
166 stars 27 forks source link

Difficulties with the Install File #22

Open hmc-cs-mdrissi opened 7 years ago

hmc-cs-mdrissi commented 7 years ago

I've tried running installGHCiOS.sh on three different computers and gotten different failures for each. The first computer was a mac and ended up having an error when going through various cabal installs. The second computer was an ubuntu computer and also had cabal install errors. I can recreate the first two computers errors if needed. Since I was having cabal errors I thought maybe it was because of a dependency mess (since I don't actually use sandbox with cabal normally).

So I've started trying to install it on an amazon webservice ubuntu instance because it acts as a very blank state. Instead of running the entire script, I also decided to run the file line be line so I could more carefully analyze the bugs. I've noticed a couple bugs.

First, I think the first line should be #!/bin/bash instead of #!/bin/sh. It makes a difference because the [[ syntax in the if arises from bash and not sh. So running sh can lead to the if condition being ignored and the if being skipped.

Second, the "curl -O http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz" ends up giving me an html file instead of a zipped file. More specifically when I do that line and then follow it with "file clang+llvm-3.0-x86_64-apple-darwin11.tar.gz" I get as output,

clang+llvm-3.0-x86_64-apple-darwin11.tar.gz: HTML document, ASCII text

Then when you try to decompress with tar I get an error of it not being a compressed file. I worked around this by downloading the file online directly, decompressing it, and then using scp to copy the folder's contents to the amazon instance. Looking into the failure, the html file you get says the release has been moved to a new url. So to update the script that url needs to be updated.

find . -type f -not -name .DS_Store -not -name "*.a" -print0 | xargs -0 sed -i '' 's|/Users/lukexi/Code/ghc-ios-scripts/||g' fails with the error of

sed: can't read s|/Users/lukexi/Code/ghc-ios-scripts/||g: No such file or directory

I'm not sure what the motivation of this line is or what the purpose of these lines are,

LC_CTYPE=C LANG=C LC_ALL=C

As I wasn't sure what the purpose of the find line is fixing the error I don't know and would like to know if those lines need to be in the script? If they do matter then what needs to be changed to prevent an error? I did try modifying the file path so that it actually pointed to my location of ghc-ios-scripts. So my modified version of the command was,

sudo find . -type f -not -name .DS_Store -not -name "*.a" -print0 | sudo xargs -0 sed -i '' 's|/home/ubuntu/bin/ghc-ios-scripts/||g'

The sudo's are just an artifact of me not running the entire script with sudo. I'm guessing if this line is important than the filepath needs to actually depend on where the user placed ghc-ios-scripts as it is unlikely to be in a directory named lukexi for most people.

I still got an error even modifying it to use my file path which was,

sed: can't read s|/home/ubuntu/bin/ghc-ios-scripts/||g: No such file or directory

Not sure how to deal with this error, mainly being unfamiliar with sed. While I did get an error with ./configure I think this is long enough an issue. I'd like to first know how to deal with the sed error and after I'll describe the ./configure error and will probably continue going through the script until I get a working installation.

All of this issue also makes the assumption that the stuff relevant to mac OS is xcode and that it is actually possible to install ghc-iOS on a linux computer. If that's impossible I can try these steps with an mac OS computer, but I know the second bug of using an old url is not mac os specific. The first bug I'd also expect to occur on mac os for using a bash feature when the script says to use sh. The third bug considering it involves an explicit file path most people are unlikely to have should also not be os specific.