-
Notifications
You must be signed in to change notification settings - Fork 19
Building Shoes on Pi2
This was almost too easy
My new Raspberry Pi 2, using Raspbian already has ruby 1.9.3 and git installed. Gcc is Debian 4.6.3-14+rpi1.
I mounted the Shoes directory with NFS but it you want to download it from git
git clone https://github.com/Shoes3/shoes3.git
cd shoes3
While 1.9.3 is usable with Shoes3.2, it doesn't have rake. Might as well install rvm and Ruby 2.1.5 and a recent Rubygems version.
Rvm
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
logout and log back in and make sure ~/.rvm is in your PATH. Then do
rvm install 2.1.5 -C --enable-load-relative
which will trundle off and download some ruby dependencies before starting the build.
Installing required packages: gawk, libreadline6-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, libffi-dev
Thank you RVM!
It will then proceed to downloading the ruby source, configure it (a slow process), compiling it (slower process). That was plenty of time to get another terminal open and install the Shoes dependencies at the same time.
sudo apt-get install libgtk2.0-dev libungif4-dev libjpeg8-dev
When they both finish I can build Loose Shoes. Just cd into the Shoes source directory
and 'rake'. That's it. ./dist/shoes
and it its running.
The above instruction builds a Loose Shoes which you can't distribute. Building a Tight Shoes is a little more work. For Shoes 3.3.0 I chose to stop cross compiling (a pi2 is about the same speed as as the qemu arm chroot but uses an older debian wheezy with a pretty old gcc cross compiler)
Two (long) steps. Build ruby and gems. Build Shoes.
Note: the package names vary between distribution and versions so you have to figure that. Add libcroco3-dev and librsvg2-dev (which drags in libxml2-dev)
This particular sd card has raspbian 4.1.7-v7+ (debian jessie) and doesn't have rvm but it does have ruby 2.1.5p273 in /usr/bin. You'll need it to build Ruby from source. I want the 2.1.8 ruby in /usr/local/bin and /usr/local/bin and I want to set some options so I download ruby-2.1.8.tar.gz, expanded it, cd into ruby-2.1.8 and run this script
#! /bin/bash
# copy this to the ruby dir or soft link it.
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
--enable-shared \
--enable-load-relative \
--disable-install-doc \
--without-tk --without-tcllib --without-tcltk \
--prefix="${dest}"
then make
and sudo make install
if everything is configured properly in the ruby build. It will take you one or two times and each make can take quite some time - I'm using a class 10 SDHC chip for the raspbian and an external usb to hold the files. Still takes a long time.
We don't have to update bash files to include /usr/local/bin in the $PATH but it's in my PATH.
$ /usr/local/bin/ruby -v
ruby 2.1.8p440 (2015-12-16 revision 53160) [armv7l-linux-eabihf]
Not the most complete test but it's good enough for now. Now we need to update /usr/local/bin/gem which is horribly out of date. Before we do that, lets make sure we don't build gem doc (they'll end up bloating Shoes with stuff the user can't get to). Since gems are user local in this case, we can create ~/.gemrc and add this line:
gem: --no-document # skip installation of all documentation.
Update the gems and hope for the best with no-doc since it's a sudo operation.
sudo gem update --system
Well that didn't work as well a I wanted. It installed gem docs for working with gems. Rubygems ersion 2.5.1 - we'll just have to proceed on.
We need to install the Shoes gems with that new ruby. Nokogiri is the most annoying, so we will do that first. Note that will may play sneaky games with gems after we build them.
sudo gem install nokogiri
Version 1.6.7.1. It takes a lot of time to build from source on any system and even longer on a pi2 - unfortunately it's tied to the libxml2 version it was built with and it install the damn docs.
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com :benchmark: false :update_sources: true :bulk_threshold: 1000 :backtrace: false :verbose: true gem: --no-document
So we need to undo some things. Uninstall nokogiri and any other gem we installed by hand. Then we blow away /usr/local/lib/ruby and /usr/local/bin/ruby. repeat the `sudo make install` in ruby and the `gem update --system`
Now repeat the nokogiri install.
`sudo gem install byebug ` (8.2.1) which is way past the 5.0.0 version so expect some trouble.
`sudo gem install sqlite3`
Note that byebug didn't bring in columnize.
We might want sudo `gem install rb-readline` (0.5.3 at this time)
### Build Tight Shoes
Create rakefile target 'pi2' and env.rb and task.rb and pi2-custom.yaml. I'm going to clone the x86_64 and the new rake command will be `rake linux:setup:pi2`
We have an old, old, old problem: libgif and libungif and I failed to apg-get install libjpeg8-dev and libgif-dev. Eventually you'll get Shoes to link and then fail trying to copy prebuilt gems. Because we haven't built chipmunk, ftsearch, hpricot and sqlite3. `rake shoesgems` does that and puts them where ever the Gemloc: and ExtLoc: paths you set in pi2-custom.yaml. **Note** It is assumed you have the source for those gems in that directory. I'm going to use the NSF mount because you only have to build the damn things once.
Now we have to get those other gems out of the Ruby we built and into the Gemloc: location and we copy them without the tests and doc and other fluff that might be in the gem. There is a gemutils/extract1gem script included with Shoes. The first arg is the path to the gemspec file in the Ruby you want to copy from. The second command line arg is where to put it. Sqlite is just weird and we don't have to copy it. In fact we want to gem uninstall it from the Ruby. `sudo gem uninstall sqlite3`
Lets do the bad boy, nokogiri.
./gemutils/extract1gem.rb /usr/local/lib/ruby/gems/2.1.0/specifications/nokogiri-1.6.7.1.gemspec ../gems/shoes/built/pi2/
Make sure the names in the Inclgem: section match what you copied. Repeat for mini_portile byebug, and rb-readline. And any other gem you want in your Shoes copy. And then `rake` and hopefully you'll get a shoes in
Menu
In This Section:
- Shoes Rakefiles
- Rake files
- App.yaml secrets
- Custom.yaml
- Gems for Shoes
- Build with Vagrant
- Building Shoes on Linux
- Building Shoes on Pi2
- Mingw Dependencies
- Building Shoes on Windows
- Cross compile mingw
- OSX 10.10 Dependencies
- OSX 10.9 Dependencies
- OSX 10.6 Dependencies
- Caution Using brew 10.6
- Build-MinGW-with-OSX
- NSIS Installer for Windows
- MSYS2 cross compiling
- Cross-compile-for-arm-(raspberry)
- MXE-Dependencies
- FreeBSD and Shoes