-
Notifications
You must be signed in to change notification settings - Fork 19
Build MinGW with OSX
I'm using OracleBox on a Mac Mini but you could do in anything that has a VM capability. I'm not going to discuss how to set up the VM in any detail
a Ubuntu Xenial based distro. Install Guest Additions reboot
reboot
build-essential libgtk-3-dev libyaml-dev librsvg2-dev libjpeg-dev libgif-dev git
git clone or network mount Network Mount
- mkdir ~/Projects
- sudo apt-get install nfs-common
- sudo mount -t nfs 192.168.1.2:/Projects /home/ccoupe/Projects
- Test
- modify /etc/fstab
192.168.1.2:/Projects /home/ccoupe/Projects nfs auto,noatime,nolock,bg,intr ,tcp,actimeo=1800 0 0
- reboot and test
Download Missing libraries apt-get install libgdbm-dev, libssl-dev, libreadline-dev libcurl4-openssl-dev mkdir ~/src; cd ~/srv mv ../Downloads/ruby-2.3.7.tar.gz . tar xf ruby-2.3.7.tar.gz cd ruby-2.3.7 ./configure --enable-load-relative --disable-install-doc make sudo make install close terminal. open new terminal to get update to $PATH which ruby ruby -v
- Update gems 7 Get Shoes Git clone NFS mount
- Build Shoes and test rake custom-yaml
- Cross Compile Shoes for Windows
I picked Debian because the UI is simple, old school and we don't want to fight GUI's just to get a couple of command line terminals. I prefer apt to other package managers.
We'll start with getting a Debian netinst iso. Download The 7.8 64 bit..
Create a 64 bit VM and Mount the .iso in the VM manager so the new VM will boot from the iso. Go through the delightful old time installer. It even knows its in a VM! It does take some time to download but we the time to plan the next steps. We'll probably have to remove the dvd (iso) and reboot. Then we'll have login, find a terminal, find a webrowser and check that we are communicating. I'll want to change the VM screen size to be a bit larger. Sounds simple. It was. I chose to only allocated 128MB to the video system which isn't enough for the fancy gnome3 system to run so I got the fallback GUI. Yay!
We have gcc-4.7.2.5. We don't have sudo but we do have su
- enable sudo -- google for instruction
sudo apt-get install git
sudo apt-get install build-essentials
-
sudo apt-get install ruby
# this got me 1.9.3 -
sudo apt-get install curl
# because rvm says to - Install rvm Follow these instructions. You'll have to deal with .bashrc/.profile mess yourself
rvm install 2.1.5 -C --enable-load-relative --enable-shared
rvm use 2.1.5 --default
sudo apt-get install libgtk2.0-dev libungif4-dev libjpeg8-dev
git clone https://github.com/Shoes3/shoes3.git
cd shoes3
rake
-
test with
dist/shoes``
Now you have Loose Shoes. You can run from ~/shoes3/dist/shoes or you could install it into the menu with a 'rake install'. I had to log out and back in for Shoes to show in the Programming menu (debian)
Now we want to setup for Tight Shoes - a Shoes you can distribute. In this example we want to go more extreme we want to build for Windows, not Linux. We have several tasks ahead. We'll need to cross compile Ruby and before we do that we have to cross compile some libraries that Ruby wants. Then we have to get the Shoes dependent libs (gtk2, gif, jpeg) built for Windows and finally we can build Shoes for Windows. Don't despair. It's not that hard.
Let's get the gcc cross compiler.
sudo apt-get install gcc-mingw-w64-i686
That's gcc 4.6.3 - we might need to know that.
We need a directory that the mingw compiler and the Shoes rakefiles can use to find all the stuff that might be in Linux /usr. Places like /usr/bin and /usr/include and /usr/lib. Only we don't it to be /usr because that's what we are running on and is write protected from us stuffing mingw libs in a running Linux system.
mkdir -p /home/ccoupe/shoesdeps/mingw
I strongly suggest you use the gtk+-bundle_2.24.10-20120208_win32.zip from gnome or my copy.. Download it, move it into that shoesdeps/mingw directory and unzip
it. It should look like
ccoupe@d78:~/shoesdeps/mingw$ ls
bin gtk+-bundle_2.24.10-20120208_win32.README.txt include man share
etc gtk+-bundle_2.24.10-20120208_win32.zip lib manifest src
There's all the bin, lib, and soon. Windows style (.dll's are in bin/, for example).
We also need a directory to download all the source code libraries to and then when we build them, they'll get installed to the --/prefix. We are going to use that src directory.
mkdir -p /home/ccoupe/deps-src
cd /home/ccoupe/deps-src
What do we need? Ruby 2.1.5 - we want to compile it for Windows. The build process for Ruby will check for certain libraries and if they don't exist it will leave that feature out of the new Ruby. For example Tk wouldn't make sense for Shoes whereas yaml is important for Shoes. You can find the source on the web. For convenience, I've put up copies you can download. You should download the *cfg.sh files to see what is needed even if you decide to get your source code from somewhere else. If you value your time, you will want to get the gdbm-1.8.3.patched.bin.tgz. I recommend you just grab it all because we know it works.
You'll have to move the download files into the deps-src directory. Mine looks like:
ccoupe@d78:~/deps-src$ ls
cjc-ffi-cfg.sh cjc-yaml-cfg.sh openssl-1.0.2.tar.gz
cjc-gdbm-cfg.sh gdbm-1.8.3.patched.bin.tgz patch-gdbm-1.8.3
cjc-iconv-cfg.sh gdbm-1.8.3.tar.gz ruby-2.1.5.tar.gz
cjc-openssl-cfg.sh libffi-3.0.9.tar.gz yaml-0.1.4.tar.gz
cjc-ruby-2.1.4.sh libiconv-1.14.tar.gz
Now we have to unzip one, modify the cfg.sh , run it, and then make; make install. Ruby will be last. I'll show one example, ffi.
ccoupe@d78:~$ cd deps-src/
ccoupe@d78:~/deps-src$ tar zxf libffi-3.0.9.tar.gz
ccoupe@d78:~/deps-src$ cd libffi-3.0.9/
ccoupe@d78:~/deps-src/libffi-3.0.9$ vi ../cjc-ffi-cfg.sh
Of course you can use pico or any other text editor that you like (or tolerate). The script is pretty simple.
#! /bin/bash
# copy this to the ruby dir or soft link it.
# execute it instead of ./configure
export CC=i686-w64-mingw32-gcc
export CPPFLAGS="-I/srv/chroot/mingwgtk2/include"
export LDFLAGS="-L/srv/chroot/mingwgtk2/lib"
./configure \
--build=x86_64-linux-gnu \
--host=i686-w64-mingw32 \
--prefix="/srv/chroot/mingwgtk2"
We need to set CPPFLAGS and LDFLAGS and we need to change that --prefix line to point to where things are. Do not fool with the --build and --host unless you know enough that you're not even reading this. It's important to use absolute paths. no .. or ~.
I modified to look like
#! /bin/bash
# copy this to the ruby dir or soft link it.
# execute it instead of ./configure
export CC=i686-w64-mingw32-gcc
export CPPFLAGS="-I/home/ccoupe/shoesdeps/mingw/include"
export LDFLAGS="-L/home/ccoupe/shoesdeps/mingw/lib"
./configure \
--build=x86_64-linux-gnu \
--host=i686-w64-mingw32 \
--prefix="/home/ccoupe/shoesdeps/mingw"
Lets run the configure and see what happens.
ccoupe@d78:~/deps-src/libffi-3.0.9$ chmod +x ../cjc-ffi-cfg.sh
ccoupe@d78:~/deps-src/libffi-3.0.9$ ../cjc-ffi-cfg.sh
There will be an error message if it fails and a long list of checks. Look for
checking whether the C compiler works... yes
That means build and host are setup properly.
now its just a make
. If it seems OK, try make install
. Look for the line
Libraries have been installed in:
/home/ccoupe/shoesdeps/mingw/lib
NOTE: any tests will fail (because we aren't running the test in Windows). Carry on. Do a check if your are unsure.
ls -ld /home/ccoupe/shoesdeps/mingw/lib/libffi*
ls -ld /home/ccoupe/shoesdeps/mingw/bin/libffi-5.dll
Now, we just repeat the process for all the other Ruby dependencies. Except for Ruby. Make sure you use the gdbm-patched.tgz and you should make clean in it before configuring.
You might notice that a lot of the *-cfg.sh are almost identical and you could write a master shell script to do them all. You could. I've seen it. Here's a secret. I've only had to do twice in once in a year and the second time was only for this tutorial. You just won't be reconfiguring often enough to get all systematic about it.
open-ssl uses Configure not configure. A fine example of why you want individual configure scripts. If you get open-ssl to compile and install it gets easier from here.
It's similar. untar, cd into ruby-2.1.5, edit ../cjc-ruby-2.1.4.sh (yes its not named with 2.1.5). Notice it installs into
/home/ccoupe/shoesdeps/mingw/usr/local
- this gets sorted out in the Shoes rake files. Lets configure:
../cjc-ruby-2.1.4
and
make
It's going to take some time. Watch for the configure phase to see if it picks up fiddle, gdbm, openssl, and psych which are our dependent libs ffi, gdbm, openssl and yaml. I had trouble with ffi on Debian 7.8 but Ubuntu 14.04 is fine. Shoes doesn't use fiddle/ffi so I'm going to move on, for tutorial purposes.
make install
You can't test it on Linux - don't waste your time with Wine.
We need to build libgif, libjpeg and sqlite3 dlls and install them into ? /home/ccoupe/shoesdeps/ming/! Download them from my location or whatever place you like. You'll notice the pattern, a tgz to expand, a shell script to do the configure, make, make install. Sqlilte is different. So, download them and move them from ~/Downloads to ~/deps-src
tar -jxf giflib-4.2.3.tar.bz2
cd giflib-4.2.3/
vi ../cross-gif.sh # edit for your locations
../cross-gif.sh
make
make install
Repeat for jpeg.
Untar the sqlite3-min.tgz and cd into sqlite3. You'll notice there is no source to build. The zip inside is from the sqlite website - the latest binary download for Windows. I've already expanded it. We just just need to copy the .dll to bin an the *.h to include.
cp sqlite3.dll /home/ccoupe/shoesdeps/mingw/bin/
cp *.h /home/ccoupe/shoesdeps/mingw/include/
Now that we have all the dependencies in /home/ccoupe/shoesdeps/mingw we are ready to build Shoes. Let cd into that shoes3 directory.
rake -T
will list all we can do. We want
rake linux:setup:mingw32
That tells the Rakefile what we want build for and what set of subsidiary set of rake files with be used for build, clean, stub, and package tasks. We have to edit the make/xmingw32/env.rb to it where those dependencies are are. Find the line that sets CHROOT if it's for 'gtk2' (it is).
if ENV['GTK'] == "gtk+-2.0"
CHROOT = "/srv/chroot/mingwgtk2"
change that CHROOT to point to "/home/ccoupe/shoesdeps/mingw" or where ever you have them.
Just one more change. A few lines below we have
EXT_RUBY = "/srv/chroot/mingwgtk2/usr/local"
set that to "/home/ccoupe/shoesdeps/mingw/usr/local"
If there were no mistakes then a simple
rake
will build Shoes.
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