From 91cefaa3a0ddb6c2cc0119b4ac50be70c2e3fd03 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Tue, 21 Jun 2016 02:24:06 -0400 Subject: begin work on elm article --- posts/elm-everything-broken.md | 273 +++++++++++++++++++++++++++++++++++++++++ posts/first-post.md | 5 - posts/new-server-2016.md | 13 ++ 3 files changed, 286 insertions(+), 5 deletions(-) create mode 100644 posts/elm-everything-broken.md delete mode 100644 posts/first-post.md create mode 100644 posts/new-server-2016.md diff --git a/posts/elm-everything-broken.md b/posts/elm-everything-broken.md new file mode 100644 index 0000000..8fa9682 --- /dev/null +++ b/posts/elm-everything-broken.md @@ -0,0 +1,273 @@ +Title: Everything Is Broken (Elm Install Edition) +Author: bnewbold +Date: 2016-05-06 +Status: draft + +*This post is mostly a rant about my problems getting a fancy new programming +language to work on my laptop.* + +A few folks at the Recurse Center had nice things to say about the [Elm +programming language](https://elm-lang.org), and after watching Evan +Czaplicki's ["Let's Be Mainstream" talk](https://www.youtube.com/watch?v=oYk8CKH7OhE) +I got pretty excited also. + +So, I thought, Let's try elm! First place to head is the install page: + +[http://elm-lang.org/install]() + +Hrm, i've had painful experiences with `npm` in the past, so i'll try build from +source. + +[https://github.com/elm-lang/elm-platform]() + +Weird, build from source directions involve some curl-to-file thing. Why not +just clone the repo and have a makefile? If you don't know how to clone a repo, +are you really going to know how to get cabal set up, open a terminal and paste +a command, etc? Anyways, I clone repo and run the script from there instead. +I'm on debian stable (jessie), so installing Haskell (GHC) is easy, and there +is a good chance things will just work because this Debian stable is a +reasonably popular developer platform. I seem to have a recent version of +cabal: + +
+bnewbold@eschaton$ cabal --version
+cabal-install version 1.20.0.3
+using version 1.20.0.2 of the Cabal library 
+
+ +so I run the `BuildFromSource.hs` script: + +
+bnewbold@eschaton$ runhaskell ~/src/elm-platform/installers/BuildFromSource.hs 0.16
+
+GHCi runtime linker: fatal error: I found a duplicate definition for symbol
+_hs_bytestring_long_long_uint_hex
+whilst processing object file
+/home/bnewbold/.cabal/lib/x86_64-linux-ghc-7.6.3/bytestring-0.10.6.0/HSbytestring-0.10.6.0.o
+This could be caused by:
+* Loading two different object files which export the same symbol
+* Specifying the same object file twice on the GHCi command line
+* An incorrect `package.conf' entry, causing some object to be
+    loaded twice.
+GHCi cannot safely continue in this situation.  Exiting now.  Sorry.
+
+ +Uh-oh! Not sure what that means. A search returns this: + +[https://wiki.haskell.org/GHC/FAQ#Duplicate_Definitions]() + +Doesn't seem like *I* have done anything wrong. I'll update `cabal`: + +
+bnewbold@eschaton$ cabal update
+Downloading the latest package list from hackage.haskell.org
+cabal: Failed to download
+http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc "Error
+HTTP code: 502"
+
+ +I assumed I was doing something wrong, but it turns out that the Hackage +package repository [is down](https://status.haskell.org/): + + hackage.haskell.org down Full Service Disruption + [Investigating] The hackage server is in an out of memory condition. We're investigating. + +Hrm. Well, wasn't even sure if that would fix the problem. I'll give up and try +`npm`, which these days has been "partially" packaged in Debian. I'll just +uninstall `npm` when i'm done installing Elm. I install with apt (which pulls +in a huge list of nodejs packages), but then can finally run: + +
+bnewbold@eschaton$ npm install elm
+|
+> elm@0.16.0 install /home/bnewbold/bin/node_modules/elm
+> node install.js
+
+sh: 1: node: not found
+npm WARN This failure might be due to the use of legacy binary "node"
+npm WARN For further explanations, please read
+/usr/share/doc/nodejs/README.Debian
+
+npm ERR! elm@0.16.0 install: `node install.js`
+npm ERR! Exit status 127
+npm ERR! 
+npm ERR! Failed at the elm@0.16.0 install script.
+npm ERR! This is most likely a problem with the elm package,
+npm ERR! not with npm itself.
+npm ERR! Tell the author that this fails on your system:
+npm ERR!     node install.js
+npm ERR! You can get their info via:
+npm ERR!     npm owner ls elm
+npm ERR! There is likely additional logging output above.
+
+npm ERR! System Linux 3.16.0-4-amd64
+npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "elm"
+npm ERR! cwd /home/bnewbold/bin
+npm ERR! node -v v0.10.29
+npm ERR! npm -v 1.4.21
+npm ERR! code ELIFECYCLE
+npm ERR! 
+npm ERR! Additional logging details can be found in:
+npm ERR!     /home/bnewbold/bin/npm-debug.log
+npm ERR! not ok code 0
+
+ +Looks like Debian wants to call node.js `nodejs` while npm/Elm expects it to be +called `node`. Ok, I create this shim named `node` in my ~/bin directory (which +is on my $PATH), and make it executable[1]: + + #!/bin/sh + nodejs $* + +Now I can do things like: + +
+bnewbold@eschaton$ node --version
+v0.10.29
+
+ +Great! Now let's install elm: + +
+bnewbold@eschaton$ npm install elm
+
+> elm@0.16.0 install /home/bnewbold/bin/node_modules/elm
+> node install.js
+
+Downloading Elm Reactor assets from https://dl.bintray.com/elmlang/elm-platform/0.16.0/elm-reactor-assets.tar.gz
+Error communicating with URL https://dl.bintray.com/elmlang/elm-platform/0.16.0/linux-x64.tar.gz Error: CERT_UNTRUSTED
+npm WARN This failure might be due to the use of legacy binary "node"
+npm WARN For further explanations, please read
+/usr/share/doc/nodejs/README.Debian
+
+npm ERR! elm@0.16.0 install: `node install.js`
+npm ERR! Exit status 1
+npm ERR! 
+npm ERR! Failed at the elm@0.16.0 install script.
+npm ERR! This is most likely a problem with the elm package,
+npm ERR! not with npm itself.
+npm ERR! Tell the author that this fails on your system:
+npm ERR!     node install.js
+npm ERR! You can get their info via:
+npm ERR!     npm owner ls elm
+npm ERR! There is likely additional logging output above.
+
+npm ERR! System Linux 3.16.0-4-amd64
+npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "elm"
+npm ERR! cwd /home/bnewbold/bin
+npm ERR! node -v v0.10.29
+npm ERR! npm -v 1.4.21
+npm ERR! code ELIFECYCLE
+npm ERR! 
+npm ERR! Additional logging details can be found in:
+npm ERR!     /home/bnewbold/bin/npm-debug.log
+npm ERR! not ok code 0
+
+ +This github issue seems to have some tips: + + https://github.com/elm-lang/elm-platform/issues/100 + +The recommended solutions online are basically "upgrade node.js and npm" or +"disable SSL security". That doesn't sound great, but i'm feeling very +impatient at this point so I try disabling SSL checks with `npm config set ca +null`, but even with that I get the same certificate error. Enough of that +approach: + +
+sudo apt remove npm nodejs-legacy nodejs
+rm ~/bin/node
+
+ +Poking around a bit more, I find the `fubar.sh` script in the `elm-platform` +repo, which seems to nuke the local user's Haskell (cabal) stuff (not +system-wide package, eg apt managed GHC libraries). After running that the +`BuildFromSource.hs` seems to start working, though Hackage is still down (now, +an hour after I started this process, at 5 hours total downtime), so I can't +install dependencies. + +I search for a hackage mirror and find that [FPComplete runs +one](https://www.fpcomplete.com/blog/2015/03/hackage-mirror). In addition to +their directions I had to set `remote-repo-cache` in my `~/.cabal/config`, like +so: + + remote-repo: hackage.fpcomplete.com:http://hackage.fpcomplete.com/ + remote-repo-cache: /home/bnewbold/.cabal/packages-fpcomplete + +After that I `cabal update` and run the `BuildFromSource.hs` script again. It +fails to build the dependency `websockets-snap`, but I try installing that +regularly (`cabal install websockets-snap`) and that works, then all the +dependencies with BuildFromSource.hs build. Yay! + +I still get an error with compiling Elm itself though:: + + src/Elm/Package.hs:60:25: + Not in scope: `<$>' + Perhaps you meant `' (imported from System.FilePath) + +It [sounds like](https://github.com/elm-lang/elm-platform/issues/30) I am using +an out of date version of GHC (the Haskell compiler): I have 7.6.3 (the version +that comes with Debian), and Elm wants 7.10. Fair enough: unlike a package +manager, I can see how new features in the compiler would be helpful, and when +I go back and look this is in the README. Fortunately there is a new version of +GHC in the jessie-backports repo, so: + + sudo apt install -t jessie-backports ghc + +And now:: + +
+bnewbold@eschaton$ cabal --version
+cabal-install version 1.22.6.0
+using version 1.22.5.0 of the Cabal library 
+bnewbold@eschaton$ ghc --version
+The Glorious Glasgow Haskell Compilation System, version 7.10.3
+
+ +After that, i'm miraculously able to compile. Horray! I add +`~/bin/Elm-Platform/0.16/.cabal-sandbox/bin` to my `$PATH` and I can run: + +
+bnewbold@eschaton$ elm-repl 
+---- elm repl 0.16.0 -----------------------------------------------------------
+:help for help, :exit to exit, more at 
+--------------------------------------------------------------------------------
+> 
+
+ + +Also, through out this debugging experience i've had problems with my external +Lenovo Thinkpad USB keyboard glitching (workaround: unplug and replug) and with +WiFi here at the Recurse Center disconnecting (other have the same problem, +something to do with wireless regulatory zones, but we don't have a fix yet). + +It's not all hard though; installing the `elm.vim` syntax highlighting plugin +is very easy, just a single `git clone` into ~/.vim/bundle/`. + +[1]: later I learn that I could instead have installed the `nodejs-legacy` + package, which just installs a symlink `/usr/bin/node` which points to + `/usr/bin/nodejs`. + +================ + +- ironically, elm packaging seems to have some nice features to prevent + breakage +- also, rust packaing seems good (link to cargo post) + +================ + +**Follow up June 18th, 2016:** + +A new version of Elm (0.17) was +[released](http://elm-lang.org/blog/farewell-to-frp) +was released a few days after writing this post. The new version made some big +changes, like abandoning the Functional Reactive paradigm. I found that many of +the new tutorials weren't working with my 0.16 install, so I tried to upgrade. +After an hour or two of following the directions above, I gave up and installed +`npm` on a temporary Debian unstable ("sid") virtual machine. Once I added a +`node` symlink to `nodejs`, I was able to install `elm` with `npm` and develop +remotely using `screen` and `elm-react`. Frustrating! + +Also, `https://status.haskell.org` seems to be broken again today, though +hackage itself seems to work. + diff --git a/posts/first-post.md b/posts/first-post.md deleted file mode 100644 index 0062399..0000000 --- a/posts/first-post.md +++ /dev/null @@ -1,5 +0,0 @@ -Title: First Post! -Author: bnewbold -Date: 2016-05-01 - -This is a first post! Just a test of URL system. diff --git a/posts/new-server-2016.md b/posts/new-server-2016.md new file mode 100644 index 0000000..e599214 --- /dev/null +++ b/posts/new-server-2016.md @@ -0,0 +1,13 @@ +Title: New Web Server (2016) +Author: bnewbold +Date: 2016-05-01 + +This is a stub posting to note that i've transitioned this website +(`bnewbold.net`) from a custom dynamic Django setup that I wrote [back in 2007](http://git.bnewbold.net/bnewnet/commit/?id=5b31039d4c581048959dc51436f6918f29fbf9ea) +to a simple [Pelican](http://blog.getpelican.com/) based static site generator. + +This shift co-incides with my transition from hosting on `adelie` (last +upgraded to Ubuntu lucid 10.04!) to `adze` (Debian stable, currently jessie). +Some of this transition was made easier by using +[ansible scripts](http://git.bnewbold.net/infra/) to automate the common basics +of server configuration. -- cgit v1.2.3