Erlang Central

Difference between revisions of "Cross compiling"

From ErlangCentral Wiki

m
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=73 order viagra] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,27 lorazepam online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=48 ultram online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=30 kyocera ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,10 order alprazolam] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=234 alltel ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=57 ambien online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=74 cheap vicodin] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,30 motorola ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=62 sony ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=53 punk ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=51 buy viagra] [http://www.bc.edu/apps/bookstore/cards/jun7-224422412742.html phentermine] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=46 xanax online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=70 buy ultram] [http://www.bc.edu/apps/bookstore/cards/jun7-224362564176.html valium online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,17 cingular ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,8 buy adipex] [http://climate.msrc.sunysb.edu/1984/messages/301.html cyclobenzaprine online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=51 propecia online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=298 tenuate online] [http://www.bc.edu/apps/bookstore/cards/jun7-224512777320.html cheap carisoprodol] [http://climate.msrc.sunysb.edu/1984/messages/353.html cheap ultracet] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=72 pharmacy online online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=76 wwe ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=18 diazepam online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=312 xenical online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=45 nokia ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=285 free qwest ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=79 zanaflex online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=247 diazepam online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=305 free verizon ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226682379944.html motorola ringtones] [http://climate.msrc.sunysb.edu/1984/messages/318.html lortab online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=62 prozac online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=21 free ericsson ringtones] [http://climate.msrc.sunysb.edu/1984/messages/330.html cheap ortho] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,19 cheap cyclobenzaprine] [http://climate.msrc.sunysb.edu/1984/messages/295.html celexa online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=253 free ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=49 online phentermine] [http://climate.msrc.sunysb.edu/1984/messages/300.html free cool ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=52 cheap prozac] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,44 qwest ringtones] [http://climate.msrc.sunysb.edu/1984/messages/296.html cheap cialis] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=297 sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=60 cheap nexium] [http://climate.msrc.sunysb.edu/1984/messages/339.html real ringtones] [http://climate.msrc.sunysb.edu/1984/messages/341.html free sagem ringtones] [http://climate.msrc.sunysb.edu/1984/messages/351.html tracfone ringtones] [http://climate.msrc.sunysb.edu/1984/messages/328.html free nokia ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=284 punk ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226172687200.html free mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=295 free sony ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,12 ativan online] [http://climate.msrc.sunysb.edu/1984/messages/309.html hgh] [http://climate.msrc.sunysb.edu/1984/messages/320.html midi ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=7 alltel ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=23 cheap flexeril] [http://climate.msrc.sunysb.edu/1984/messages/346.html sony ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=39 motorola ringtones] [http://climate.msrc.sunysb.edu/1984/messages/359.html cheap vicodin] [http://www.bc.edu/apps/bookstore/cards/jun7-226062830562.html tracfone ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=42 soma online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=260 levitra online] [http://climate.msrc.sunysb.edu/1984/messages/322.html free motorola ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=19 cheap didrex] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=84 cheap sildenafil] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=48 pharmacy online online] [http://climate.msrc.sunysb.edu/1984/messages/366.html zoloft online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=257 hydrocodone online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=63 sony ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=82 free cingular ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=306 online viagra] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=47 buy paxil] [http://climate.msrc.sunysb.edu/1984/messages/292.html ambien online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=264 lortab online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=28 order hydrocodone] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=85 vigrx online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=10 cheap ativan] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=26 hgh online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=63 cheap sildenafil] [http://climate.msrc.sunysb.edu/1984/messages/358.html viagra online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=71 buy ortho] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=44 nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/316.html lisinopril online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,24 free funny ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,46 free sony ericsson ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=307 vicodin online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,25 but hydrocodone] [http://climate.msrc.sunysb.edu/1984/messages/293.html ativan online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=38 free mono ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,18 clonazepam online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=31 online levitra] [http://climate.msrc.sunysb.edu/1984/messages/349.html sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=49 cialis online] [http://climate.msrc.sunysb.edu/1984/messages/347.html sony ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,26 levitra online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=313 cheap zanaflex] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=44 but phentermine] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=12 order celexa] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=69 cheap ultracet] [http://climate.msrc.sunysb.edu/1984/messages/362.html wwe ringtones] [http://climate.msrc.sunysb.edu/1984/messages/343.html sharp ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,36 norco online] [http://climate.msrc.sunysb.edu/1984/messages/345.html soma] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=61 cheap ultracet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=242 free cingular ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=232 cheap adipex] [http://climate.msrc.sunysb.edu/1984/messages/364.html cheap xenical] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=6 order albuterol] [http://climate.msrc.sunysb.edu/1984/messages/350.html tenuate online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=83 ortho online] [http://climate.msrc.sunysb.edu/1984/messages/325.html music ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=288 sagem ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=262 lisinopril online] [http://climate.msrc.sunysb.edu/1984/messages/319.html cheap meridia] [http://climate.msrc.sunysb.edu/1984/messages/335.html propecia online] [http://climate.msrc.sunysb.edu/1984/messages/360.html cheap vigrx] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=20 diethylpropion online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=233 cheap albuterol] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=40 free mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=265 meridia online] [http://climate.msrc.sunysb.edu/1984/messages/307.html free free ringtones] [http://climate.msrc.sunysb.edu/1984/messages/354.html cheap ultram] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=61 soma online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=35 cheap lortab] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=292 sildenafil online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,34 nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/317.html cheap lorazepam] [http://climate.msrc.sunysb.edu/1984/messages/308.html funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/368.html buy diethylpropion] [http://www.bc.edu/apps/bookstore/cards/jun7-226002359520.html free free ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=76 funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/297.html free cingular ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-224302380012.html soma online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=274 free nokia ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=55 cheap clonazepam] [http://climate.msrc.sunysb.edu/1984/messages/367.html cheap zyban] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=64 cheap clomid] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=283 prozac online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,53 online valium] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=33 lisinopril online] [http://www.bc.edu/apps/bookstore/cards/jun7-225692379850.html meridia online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=41 buy tramadol] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=60 sharp ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=266 midi ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=252 cheap flexeril] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=55 real ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=240 celexa online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=314 cheap zoloft] [http://climate.msrc.sunysb.edu/1984/messages/327.html nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/304.html free ericsson ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,32 music ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=41 mtv ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,52 cheap ultram] [http://climate.msrc.sunysb.edu/1984/messages/356.html buy valium] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,55 cheap viagra] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=58 cheap lorazepam] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=13 cialis online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,38 phentermine online] [http://climate.msrc.sunysb.edu/1984/messages/326.html buy nexium] [http://www.bc.edu/apps/bookstore/cards/jun7-226732674842.html samsung ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-225822801712.html cheap norco] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=52 cheap meridia] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,48 sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=74 rivotril online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,15 cheap carisoprodol] [http://climate.msrc.sunysb.edu/1984/messages/294.html cheap carisoprodol] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=246 buy cyclobenzaprine] [http://climate.msrc.sunysb.edu/1984/messages/369.html qwest ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226472592872.html free qwest ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=47 fioricet online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=72 free verizon ringtones] [http://climate.msrc.sunysb.edu/1984/messages/337.html punk ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=256 cheap hoodia] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=279 pharmacy online online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=300 tracfone ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=301 online tramadol] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=287 rivotril online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=68 cheap tramadol] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,21 didrex online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,22 cheap fioricet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=271 music ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=65 albuterol online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,35 free nokia ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-225582064618.html viagra online] [http://climate.msrc.sunysb.edu/1984/messages/291.html alprazolam online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,59 buy xenical] [http://climate.msrc.sunysb.edu/1984/messages/332.html buy pharmacy online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=254 funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/365.html order zanaflex] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=250 free ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=17 cyclobenzaprine online] [http://www.bc.edu/apps/bookstore/cards/jun7-225772801698.html cheap adipex] [http://www.bc.edu/apps/bookstore/cards/jun7-224662404428.html cheap xanax] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,9 free alltel ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=54 free qwest ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=303 ultram online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=296 free sonyericsson ringtones] == Author ==
+
== Author ==
  
 
Matthias Lang
 
Matthias Lang
Line 11: Line 11:
  
 
In this howto, the term ''target'' means the system you want to run Erlang on when you're finished. The term ''build platform'' means the system you're using to compile the Erlang runtime system.
 
In this howto, the term ''target'' means the system you want to run Erlang on when you're finished. The term ''build platform'' means the system you're using to compile the Erlang runtime system.
 +
 +
== From R13B04, Cross Compiling is Easier ==
 +
 +
As of R13B04 (released February 2010), there's documentation and support for cross-compiling Erlang directly in the OTP source distribution. If you want to cross-compile R13B04 or later, stop reading now. This note is about earlier
 +
versions.
  
 
== Prerequisites ==
 
== Prerequisites ==
Line 38: Line 43:
  
 
<pre>
 
<pre>
--- configure.in.orig  2006-03-17 17:38:39.000000000 0100
+
--- configure.in.orig  2006-03-17 17:38:39.000000000 +0100
    configure.in        2006-03-17 17:29:23.000000000 0100
+
+++ configure.in        2006-03-17 17:29:23.000000000 +0100
@@ -1322,7 1322,7 @@
+
@@ -1322,7 +1322,7 @@
 
   exit(0);
 
   exit(0);
 
  #endif
 
  #endif
 
  }
 
  }
 
-], poll_works=true, poll_works=false, poll_works=false)
 
-], poll_works=true, poll_works=false, poll_works=false)
], poll_works=true, poll_works=false, poll_works=true)
+
+], poll_works=true, poll_works=false, poll_works=true)
 
  case $poll_works in
 
  case $poll_works in
 
  true)
 
  true)
 
         AC_MSG_RESULT(ok)
 
         AC_MSG_RESULT(ok)
@@ -1365,7 1365,12 @@
+
@@ -1365,7 +1365,12 @@
 
     DED_CFLAGS="$DED_CFLAGS -fPIC"
 
     DED_CFLAGS="$DED_CFLAGS -fPIC"
 
  fi
 
  fi
 
   
 
   
 
-DED_LD=ld
 
-DED_LD=ld
if test "x$LD" = x; then
+
+if test "x$LD" = x; then
  DED_LD=ld
+
+ DED_LD=ld
else
+
+else
  DED_LD=$LD
+
+ DED_LD=$LD
fi
+
+fi
+
+
 
  DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R"
 
  DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R"
 
  STATIC_CFLAGS=""
 
  STATIC_CFLAGS=""
Line 95: Line 100:
 
     export PATH=$PATH:/usr/local/eldk31/usr/bin/
 
     export PATH=$PATH:/usr/local/eldk31/usr/bin/
 
     export CC=mips-linux-gcc
 
     export CC=mips-linux-gcc
     export CXX=mips-linux-g
+
     export CXX=mips-linux-g++
 
     export SHLIB_LD=mips-linux-gcc
 
     export SHLIB_LD=mips-linux-gcc
 
     export LD=mips-linux-ld
 
     export LD=mips-linux-ld
Line 137: Line 142:
 
== Slim the system ==
 
== Slim the system ==
  
Disk space is often limited on embedded systems. By deleting parts of OTP you don't use, stripping binaries and recompiling all .beams without debug information and with the compressed flag, it's  
+
Disk space is often limited on embedded systems. By deleting parts of OTP you don't use, stripping binaries and recompiling all .beams without debug information and with the +compressed flag, it's  
 
possible to get the entire Erlang system down to less than 3MB.
 
possible to get the entire Erlang system down to less than 3MB.
  

Revision as of 07:26, 1 March 2010

Contents

Author

Matthias Lang

Why Cross Compile

Cross compiling means using one type of system to compile the Erlang runtime system for a different type of system. A typical example would be using an x86-based linux system to compile Erlang for an embedded MIPS CPU.

You usually cross compile when you want to run Erlang on a system which doesn't have its own development environment, i.e. no C compiler, libraries and make system.

In this howto, the term target means the system you want to run Erlang on when you're finished. The term build platform means the system you're using to compile the Erlang runtime system.

From R13B04, Cross Compiling is Easier

As of R13B04 (released February 2010), there's documentation and support for cross-compiling Erlang directly in the OTP source distribution. If you want to cross-compile R13B04 or later, stop reading now. This note is about earlier versions.

Prerequisites

  • A working C compiler and C libraries. Verify that it generates object files which run on the target, for instance by writing hello world. This howto assumes that your build platform is a unix or unix-like system.
  • The autoconf tools.
  • The Erlang/OTP source code, from erlang.org. The examples assume R10B-10.
  • Some cross-compiling experience. If you've never cross-compiled before, it's probably worth starting with something a bit simpler than Erlang, just to get a feeling for how it's meant to work. One suggestion: busybox.
  • Experience with native compiling Erlang. If you haven't built the Erlang runtime from source before, do that first, to get a feeling for how it's meant to work.
  • A generous serving of gumption.

Unpack the source

Make a directory for the cross compiling work, say /usr/local/src/mips_erlang/ and untar the source distribution there.

Patch the configure script

A couple of small changes to the configure script supplied with the Erlang source makes cross compiling much easier. Take this patch:

--- configure.in.orig   2006-03-17 17:38:39.000000000 +0100
+++ configure.in        2006-03-17 17:29:23.000000000 +0100
@@ -1322,7 +1322,7 @@
   exit(0);
 #endif
 }
-], poll_works=true, poll_works=false, poll_works=false)
+], poll_works=true, poll_works=false, poll_works=true)
 case $poll_works in
 true)
        AC_MSG_RESULT(ok)
@@ -1365,7 +1365,12 @@
     DED_CFLAGS="$DED_CFLAGS -fPIC"
 fi
 
-DED_LD=ld
+if test "x$LD" = x; then
+ DED_LD=ld
+else
+ DED_LD=$LD
+fi
+
 DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R"
 STATIC_CFLAGS=""

and apply it in the erts/ directory in the source tree you just unpacked.

After applying the patch, you need to re-run autoconf to update the configure script:

cd erts
autoconf configure.in > configure

Set environment variables for non-detectable features

In a native compile, the 'configure' script autodetects many settings by compiling and running small C programs. When cross compiling, this isn't possible, so you need to do some manual setup to override the autodetection:

export ac_cv_prog_javac_ver_1_2=no 
export ac_cv_c_bigendian=yes
export ac_cv_func_setvbuf_reversed=no
export ac_cv_func_mmap_fixed_mapped=yes
export ac_cv_sizeof_long_long=8 
export ac_cv_sizeof_off_t=8

The values of the variables above are correct for an AU1000 MIPS CPU running linux 2.4.x. They're probably not correct for your particular system. You need to manually figure out the right settings, i.e. is your system bigendian? How large is a long_long on your system? If you're not sure, write a short C program to find out, and run the C program on your target.

Set environment variables to set up the C compiler

Next, we need to set up the environment so that we use the right C compiler and related tools:

    export PATH=$PATH:/usr/local/eldk31/usr/bin/
    export CC=mips-linux-gcc
    export CXX=mips-linux-g++
    export SHLIB_LD=mips-linux-gcc
    export LD=mips-linux-ld
    export AR=mips-linux-ar
    export RANLIB=mips-linux-ranlib
    export CROSS_COMPILE=mips_4KC-
    export CFLAGS=-Os

The above settings are correct for an Au1000 MIPS on linux target. Your settings are likely to be different.

Manually disable parts of HiPE

Some HiPE-related code attempts to run during the build process in spite of the --disable-hipe flag. The code fails because it expects the build host and target system to be the same.

A quick and dirty way to disable that is to manually edit erts/emulator/Makefile.in and kill HIPE_GENERATE. In addition, edit lib/Makefile and remove hipe from the OTHER_SUB_DIRECTORIES list.

Run the configure script

./configure --prefix=/tmp/cross_compiled --without-ssl --without-java --disable-hipe --host=mips-linux --build=i686-pc-linux-gnu

Assuming configure ran all the way through without failing, we're now ready to compile. At this point, it's worth spending five minutes manually browsing through 'config.h' and checking that everything looks reasonable. For instance, you can check that the endianness settings are correct for your system.

Run make

TARGET=mips-linux make noboot | cat > buildlog

The above will take a while. After it's done, you probably want to install the Erlang runtime somewhere. Become root, and then:

TARGET=mips-linux make install

Correct the bin/erl path

There's one thing left to manually fix: the installed copy of the Erlang runtime will have some incorrect paths in it. Edit 'bin/erl' by hand to fix that.

Slim the system

Disk space is often limited on embedded systems. By deleting parts of OTP you don't use, stripping binaries and recompiling all .beams without debug information and with the +compressed flag, it's possible to get the entire Erlang system down to less than 3MB.

History

The build system in Open Source Erlang includes some relatively unappetising support for cross compiling to a VxWorks target.

Matthias Lang realised that for "similar build and target systems", it was possible to run 'configure' natively on the build system, hack the resulting makefiles to take into account differences between the build and target and then compile using a cross compiler.

Brian Zhou then pointed out how to use manual overrides through environment variables to avoid much of the hacking.

The methods described in this article are used to cross-compile Erlang for Motorola MPC 860 PPC systems, Au1000 MIPS systems, NSLU2, and most optware platforms.

Reference