View Single Post
Posts: 18 | Thanked: 38 times | Joined on Dec 2013 @ France
#7
Here is a rought guide to get the cross compiler :

Download ocaml-arm from the github project, you can get the zip here.

Get the patch and copy it inside mer.

Install and configure the native ocamlcompiler

Enter inside mer and unzip the archive :

Code:
unzip ocaml-arm-master.zip -d master
cd ~/master/ocaml-arm-master/

The compilerlibs does not exists (git does not like empty directory), you have to create it yourself

Code:
mkdir compilerlibs
./configure -prefix /usr
make world
make ocamlopt.opt
sudo make install
Install and configure the cross compiler

Good, you have ocaml in native mode. Now, we'll use this it for compiling the arm compiler :

Code:
unzip ocaml-arm-master.zip -d cross
cd ~/cross/ocaml-arm-master/
mkdir compilerlibs
patch -p1 < ~/patch.txt
./configure -prefix /usr -host armv7*-*-linux-gnueabi
mkdir ~/TEMP
TMPDIR=~/TEMP make cross
sb2 -t SailfishOS-armv7hl fakeroot make installcross
Call the commands inside scratchbox

OCaml has been compiled with reference to gcc as « sb2 -t SailfishOs gcc », and will try to compile with this command inside the scratchbox.

The solution I've found is to create a dummy script sb2 wich call the command given with arguments :

Code:
cat > sb2 <<
#!/bin/sh
shift
shift
COMMAND=$1
shift
${COMMAND} $*
EOF

chmod +x sb2
sb2 -t SailfishOS-armv7hl fakeroot cp sb2 /usr/local/bin
I would like to get a better solution, but didn't took time to look for that…

Now you can compile with Ocaml and run the program on your phone.
Attached Files
File Type: txt patch.txt (12.1 KB, 92 views)
 

The Following User Says Thank You to Chimrod For This Useful Post: