Author Topic: Compiling toolchain  (Read 15418 times)

Compizfox

  • New to the forum
  • *
  • Posts: 7
Compiling toolchain
« on: July 24, 2012, 03:41:22 PM »
Hi,

I'm trying to compile ML for my 550D. I followed this guide: http://magiclantern.wikia.com/wiki/Build_instructions/Unified
But everytime I run summon-arm it stops with Error 2, though it doesn't show what the error is.

Code: [Select]
make[8]: Entering directory `/usr/src/summon-arm/build/arm-elf/thumb2/libstdc++-v3'
true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CC_FOR_TARGET=/usr/src/summon-arm/build/./gcc/xgcc -B/usr/src/summon-arm/build/./gcc/" "CFLAGS=-g -O2  -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float" "CXXFLAGS=-g -O2  -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=-mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float" "LIBCFLAGS=-g -O2  -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo --split-size=5000000 --split-size=5000000       " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/bash" "RUNTESTFLAGS=" "exec_prefix=/root/arm-toolchain462" "infodir=/root/arm-toolchain462/share/info" "libdir=/root/arm-toolchain462/lib" "includedir=/root/arm-toolchain462/include" "prefix=/root/arm-toolchain462" "tooldir=/root/arm-toolchain462/arm-elf" "gxx_include_dir=/root/arm-toolchain462/arm-elf/include/c++/4.6.2" "AR=/root/arm-toolchain462/arm-elf/bin/ar" "AS=/usr/src/summon-arm/build/./gcc/as" "LD=/usr/src/summon-arm/build/./gcc/collect-ld" "RANLIB=/root/arm-toolchain462/arm-elf/bin/ranlib" "NM=/usr/src/summon-arm/build/./gcc/nm" "NM_FOR_BUILD=" "NM_FOR_TARGET=/root/arm-toolchain462/arm-elf/bin/nm" "DESTDIR=" "WERROR=" DO=install multi-do # make
make[8]: Nothing to be done for `install-data-am'.
make[8]: Leaving directory `/usr/src/summon-arm/build/arm-elf/thumb2/libstdc++-v3'
make[7]: Leaving directory `/usr/src/summon-arm/build/arm-elf/thumb2/libstdc++-v3'
make[6]: Leaving directory `/usr/src/summon-arm/build/arm-elf/thumb2/libstdc++-v3'
make[5]: Leaving directory `/usr/src/summon-arm/build/arm-elf/libstdc++-v3'
make[4]: Leaving directory `/usr/src/summon-arm/build/arm-elf/libstdc++-v3'
make[3]: Leaving directory `/usr/src/summon-arm/build/arm-elf/libstdc++-v3'
make[2]: Leaving directory `/usr/src/summon-arm/build/arm-elf/libstdc++-v3'
make[1]: Leaving directory `/usr/src/summon-arm/build'
make: *** [install] Error 2

I don't know what to do. Could someone help me?

Thanks,

Compizfox

rambler

  • New to the forum
  • *
  • Posts: 6
Re: Compiling toolchain
« Reply #1 on: July 24, 2012, 04:49:27 PM »
Quote
I don't know what to do. Could someone help me?
If you are running linux, then give up building and download a pre-built toolchain from https://launchpad.net/gcc-arm-embedded (specifically, download this: https://launchpad.net/gcc-arm-embedded/4.6/4.6-2012-q2-update/+download/gcc-arm-none-eabi-4_6-2012q2-20120614.tar.bz2 ). In makefile.inc say
  ARM_ABI=none-eabi
  ARM_PATH=<where_you_installed_toolchain>

It you're on Win, there's a pre-built toolchain there, too, but it's not enough to compile ML.

On Mac, I have no idea.

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling toolchain
« Reply #2 on: July 24, 2012, 06:28:29 PM »
On Mac, I have no idea.

Summon-arm patched for ML like in the source code.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Compizfox

  • New to the forum
  • *
  • Posts: 7
Re: Compiling toolchain
« Reply #3 on: July 24, 2012, 08:28:42 PM »
If you are running linux, then give up building and download a pre-built toolchain from https://launchpad.net/gcc-arm-embedded (specifically, download this: https://launchpad.net/gcc-arm-embedded/4.6/4.6-2012-q2-update/+download/gcc-arm-none-eabi-4_6-2012q2-20120614.tar.bz2 ). In makefile.inc say
  ARM_ABI=none-eabi
  ARM_PATH=<where_you_installed_toolchain>

It you're on Win, there's a pre-built toolchain there, too, but it's not enough to compile ML.

On Mac, I have no idea.
Yes I'm running Linux. Thank for the tip, I'll try the precompiled one! Maybe a good thing to put into that wiki article? Should save you a bunch of minutes compiling (and those errors, of course) ;)

Compizfox

  • New to the forum
  • *
  • Posts: 7
Re: Compiling toolchain
« Reply #4 on: July 24, 2012, 10:35:57 PM »
I installed the toolchain and modified the Makefile.inc like you said.

First I came across an error:
Code: [Select]
/bin/sh: line 2: readelf: command not found
make[1]: *** [autoexec] Error 1
But when I googled it, I found http://chdk.setepontos.com/index.php?topic=5971.msg74918#msg74918. It said to modify Makefile.inc at line 337 from readelf -l magiclantern | grep -C 2 MemSiz to $(ARM_BINPATH)/arm-none-eabi-readelf -l magiclantern | grep -C 2 MemSiz.
So I did that and when I build ML with make 550D it produces a autoexec.bin at ./platform/550D.109.

Is this really the only thing I need? My ML 2.2 installation has got a couple of other files like fonts.dat, retilin.lut and the folders doc and cropmks.
I tried to build with make zip but then I get this error:
Code: [Select]
debug.o: In function `run_test':
debug.c:(.text+0x26c): undefined reference to `dumpf'
collect2: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1
make[1]: Leaving directory `/usr/src/magic-lantern/platform/60D.111'
make: *** [60D] Error 2
I can't find anything about that with Google.

When I place the autoexec.bin from ./platform/550D.109 at the root of my SD-card, and I boot my 550D, it shows nothing but a black screen.
Did I do something wrong?

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling toolchain
« Reply #5 on: July 24, 2012, 10:40:49 PM »
So I did that and when I build ML with make 550D it produces a autoexec.bin at ./platform/550D.109.


try to comment out the line with dumpf in debug.c
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: Compiling toolchain
« Reply #6 on: July 24, 2012, 10:44:20 PM »
Btw, if you are on Mac or Windows (!) you can use the Yagarto toolchain just fine
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Compizfox

  • New to the forum
  • *
  • Posts: 7
Re: Compiling toolchain
« Reply #7 on: July 24, 2012, 11:04:12 PM »
try to comment out the line with dumpf in debug.c
Thanks, I found two lines in ./src/debug.c with dumpf and I commented them out both.
But now I get another error:
Code: [Select]
autoexec.bin: 1683460 bytes
make[1]: Leaving directory `/usr/src/magic-lantern/platform/all'
make -C /usr/src/magic-lantern/plugins
make[1]: Entering directory `/usr/src/magic-lantern/plugins'
make -C lua/; make -C testplug/;
make[2]: Entering directory `/usr/src/magic-lantern/plugins/lua'
[ CPP      ]   /usr/src/magic-lantern/plugins/lua/../plugin.lds
/bin/sh: /home/lars/arm-toolchain462/bin/arm-elf-gcc-4.6.2: not found
make[2]: *** [/usr/src/magic-lantern/plugins/lua/../plugin.lds] Error 1
make[2]: Leaving directory `/usr/src/magic-lantern/plugins/lua'
make[2]: Entering directory `/usr/src/magic-lantern/plugins/testplug'
[ AS       ]   /usr/src/magic-lantern/plugins/testplug/../entry.o
/bin/sh: /home/lars/arm-toolchain462/bin/arm-elf-gcc-4.6.2: not found
make[2]: *** [/usr/src/magic-lantern/plugins/testplug/../entry.o] Error 127
make[2]: Leaving directory `/usr/src/magic-lantern/plugins/testplug'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/magic-lantern/plugins'
make: *** [all] Error 2
Looks like it's looking for the compiler at /bin/sh: /home/lars/arm-toolchain462/bin/arm-elf-gcc-4.6.2 although I set the right path in Makefile.inc. Do I have to set it somewhere else or something?

EDIT:
Ah I found it, the path at ./plugins/Makefile.top was wrong. Second attempt...

EDIT:
Found a second wrong path at ./platform/7D.123/Makefile. Corrected it, but still get the following errors:

Code: [Select]
sh: rst2latex.py: not found
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
sh: rst2latex.py: not found
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
cd ../../doc && python mkdoc-cam.py
[[Focus distance]]
[[Cropmarks]]
[[External Recorders]]
sh: rst2latex.py: not found
This is LuaTeX, Version beta-0.70.1-2011052008
mkdir: cannot create directory `cam': File exists
Could not open menuindex.txt
mkdir: cannot create directory `cam': File exists
pdf to png...
Error: Couldn't open file 'UserGuide-cam.pdf': No such file or directory.
[[254 234   0   0 163  31   0   1 234   0 184  27 200   0 200 208]
 [232 216   0 231 232 232 232 232 232 232 232 232 232 232 232 232]
 [232 232 232 232 232 231   9  18  27  36  41  46  50  55  59  64]
 [ 69  73  82  92 101 109 117 119 124 129 133 138 142 147 152 156]
 [161 165 170 175 179 184 188 193 198 202 207 211 216 221 225 230]
 [220 206 193 177 162 160 156 150 140 132 125 119 105  92  76  62]
 [ 49  35  22 108 101  95  89  81  72  65  56  49  42  39 233 200]
 [192 147 102  57  16   8   6   6   6   6   4   6   3   6   4   4]
 [  2   2   1  51  48  42  40  36  31  27  26  23  18  16  13  11]
 [221 207 196 185 173 172 163 156 146 140 133 121 108  93  80  72]
 [ 60  44  30 113 108 102  94  87  78  67  57  46  37  27 233 230]
 [222 211 199 188 175 174 168 164 152 141 130 121 109  93  80  71]
 [ 62  46  28 115 106  97  83  73  62  52  45  37  24  12 232 231]
 [192 149 102  54   9   1   0  23  24  24  24  90  72   0  24   0]
 [  0   1   0  26  23  21  19  18  17  13  10   7   4   2   1   1]
 [ 25  29  29  33  35  37  40  42  43  43  45  45  54  65  79  90]]
[[255 235   0   0  56 187 153 172   0  66 186  35   0   0   0 192]
 [  0  94  62 109   0   0   0   0   0   0   0   0   0   0   0   0]
 [  0   0   0   0   0   0   9  18  27  36  41  46  50  55  59  64]
 [ 69  73  82  92 101 110 117 119 124 129 133 138 142 147 152 156]
 [161 165 170 175 179 184 188 193 198 202 206 210 216 221 225 230]
 [193 148 101  53   7   0   0   0   0   0   0   0   0   1   0   0]
 [  0   0   0  35  33  30  29  26  25  21  17  17  13  12   0   0]
 [212 187 164 139 117 111 107 102 101  93  87  81  74  66  60  52]
 [ 40  30  20  97  90  82  74  67  60  52  47  42  36  32 220 179]
 [214 193 172 151 128 127 119 115 108 103  99  90  79  69  60  55]
 [ 45  33  24  94  90  86  80  72  64  56  47  40  32  24 230 184]
 [207 175 141 108  78  73  71  69  64  61  55  51  47  39  34  30]
 [ 26  20  11  72  65  60  50  46  39  33  28  22  15  10 140 109]
 [210 190 165 140 118 113 110 104  25  25  24  25  67  32  24  25]
 [ 37  29  24  76  70  66  61  51  46  39  31  24  15   4 222 179]
 [ 29  33  35  39  43  45  49  51  52  56  57  57  67  80  95 110]]
[[255 235   0   0   0 216   0   1   0 211 140 125   0 168 154   0]
 [231  76  75   0 232 231 232 232 232 232 232 232 232 232 232 232]
 [232 232 232 232 232 232   9  18  27  36  41  46  50  55  59  64]
 [ 69  73  82  92 101 110 117 119 124 129 133 138 142 147 152 156]
 [161 165 170 174 178 184 188 193 198 202 207 211 216 221 225 230]
 [195 150 102  55  10   0   1   2   1   0   1   1   0   0   2   1]
 [  1   0   2  39  35  32  29  27  25  22  18  18  15  14   1   0]
 [227 220 213 208 202 201 189 186 181 167 155 145 133 121 107  93]
 [ 74  54  38 136 125 115 106  95  84  74  63  57  52  46 232 231]
 [193 148 100  52   6   2   0   1   1   0   1   0   1   1   0   0]
 [  1   1   2  37  37  35  33  31  27  24  20  18  13  10   0   0]
 [194 149 100  53   7   1   0   1   0   0   0   0   0   0   1   0]
 [  0   1   0  40  35  33  28  27  23  18  15  14  10   5   0   0]
 [192 149 102  53   8   1   0   0 151 152 152 150  84  92 152 151]
 [  1   0   0  27  24  23  21  19  16  12  10   9   7   3   1   1]
 [ 38  44  46  51  56  58  64  66  69  72  73  73  86 106 126 143]]
done?
make[1]: Leaving directory `/usr/src/magic-lantern/platform/all'
cd /usr/src/magic-lantern/platform/all; make zip
make[1]: Entering directory `/usr/src/magic-lantern/platform/all'
rm -r zip || echo "ok"
rm: cannot remove `zip': No such file or directory
ok
mkdir zip
mkdir zip/ML || echo "ok"
cp ../../src/zip.txt zip
cp ../../README zip/ML/
cp ../../doc/INSTALL.pdf zip/
cp: cannot stat `../../doc/INSTALL.pdf': No such file or directory
make[1]: *** [prepare_zip] Error 1
make[1]: Leaving directory `/usr/src/magic-lantern/platform/all'
make: *** [zip] Error 2

coutts

  • Developer
  • Senior
  • *****
  • Posts: 401
Re: Compiling toolchain
« Reply #8 on: July 25, 2012, 12:10:16 AM »
Btw, if you are on Mac or Windows (!) you can use the Yagarto toolchain just fine
+1 for yagarto, makes compiling on mac super easy. No waiting for summon-arm, everything is pre-built. Just extract the files somewhere and you're set.

Compizfox

  • New to the forum
  • *
  • Posts: 7
Re: Compiling toolchain
« Reply #9 on: July 25, 2012, 12:19:38 AM »
Yes!

make zip still doesn't work (I can't get to compile the docs or something). But when I tried make all, I just got one easy error (I needed to repair the readelf path (yes, again) in symtblgen.rb. After that I got a working autoexec.bin in ./platform/all/.
Copied that to my SD-card and now my 550D was actually booting. I just needed to place fonts.dat from ./src and cropmks to ML/DATA and now it's working.

But still haven't any clue on the documentation...

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Compiling toolchain
« Reply #10 on: July 25, 2012, 05:16:16 AM »
make 550D

Why are you making ml for all the other cameras.

rambler

  • New to the forum
  • *
  • Posts: 6
Re: Compiling toolchain
« Reply #11 on: July 25, 2012, 07:16:32 AM »
I can't get to compile the docs
Compiling docs needs a bunch of other stuff installed (latex & pandoc + dependencies, to name the obvious).

Compizfox

  • New to the forum
  • *
  • Posts: 7
Re: Compiling toolchain
« Reply #12 on: July 25, 2012, 02:58:55 PM »
make 550D

Why are you making ml for all the other cameras.
I tried making for only the 550D, but with that autoexec.bin on my SD-card my camera won't boot.

Compiling docs needs a bunch of other stuff installed (latex & pandoc + dependencies, to name the obvious).
I installed these:
Code: [Select]
sudo apt-get install python-matplotlib python-matplotlib-data python-matplotlib-doc python-matplotlib-dbg texlive-luatex python-docutils texlive-latex-base texlive-latex-recommended texlive-fonts-extra dvi2ps texlive-math-extra pandoc texlive-latex-extra ruby-fullOr isn't that enough? That is what the wiki said.

nierymek

  • Just arrived
  • *
  • Posts: 1
Re: Compiling toolchain
« Reply #13 on: July 25, 2012, 03:06:20 PM »
Compizfox: I had the same problem in Ubuntu 12.04 - you have to find rst2latex (in my case: /usr/share/docutils/scripts/python2/rst2latex)
and symlink it to eg. /usr/sbin/rst2latex.py

Compizfox

  • New to the forum
  • *
  • Posts: 7
Re: Compiling toolchain
« Reply #14 on: July 25, 2012, 03:08:27 PM »
Thank you very much! I'm gonna try it now! :D

And indeed, I'm running Linux Mint KDE Lisa.

EDIT:
Symlinked /usr/bin/rst2latex to /usr/sbin/rst2latex.py. Docs compiled without problems now. Thank you!

xblitz

  • New to the forum
  • *
  • Posts: 3
Re: Compiling toolchain
« Reply #15 on: July 27, 2012, 05:34:58 PM »
I installed 2 different toolchains: Sourcery and Launhpad.net  arm toolchains .. but the 2 of them make the same copiling error:

Code: [Select]
.....
[ CC       ]   vram.o
[ CC       ]   morse.o
[ CC       ]   aj_port.o
[ CC       ]   fps-engio.o
[ CC       ]   hdr.o
[ CC       ]   lv-img-engio.o
[ CC       ]   state-object.o
[ CC       ]   tasks.o
[ AR       ]   lib_a-setjmp.o
[ AR       ]   libstdio.a
[ LD       ]   magiclantern
boot-hack.o: In function `my_task_dispatch_hook':
boot-hack.c:(.text+0x60): undefined reference to `_task_overrides_start'
boot-hack.c:(.text+0x64): undefined reference to `_task_overrides_end'
boot-hack.o: In function `my_big_init_task':
boot-hack.c:(.text+0x3c4): undefined reference to `_init_funcs_start'
boot-hack.c:(.text+0x3c8): undefined reference to `_init_funcs_end'
boot-hack.c:(.text+0x3d4): undefined reference to `_tasks_start'
boot-hack.c:(.text+0x3d8): undefined reference to `_tasks_end'
boot-hack.o: In function `copy_and_restart':
boot-hack.c:(.text+0x4e4): undefined reference to `_bss_start'
boot-hack.c:(.text+0x4e8): undefined reference to `_bss_end'
config.o: In function `config_save_file':
config.c:(.text+0x244): undefined reference to `_config_vars_start'
config.c:(.text+0x250): undefined reference to `_config_vars_end'
config.o: In function `config_parse':
config.c:(.text+0x520): undefined reference to `_config_vars_start'
config.c:(.text+0x538): undefined reference to `_config_vars_end'
config.o: In function `get_config_vars_start':
config.c:(.text+0x5c0): undefined reference to `_config_vars_start'
config.o: In function `get_config_vars_end':
config.c:(.text+0x5cc): undefined reference to `_config_vars_end'
property.o: In function `prop_init':
property.c:(.text+0xc8): undefined reference to `_prop_handlers_start'
property.c:(.text+0xd0): undefined reference to `_prop_handlers_end'
property.o: In function `global_property_handler':
property.c:(.text+0x160): undefined reference to `_prop_handlers_start'
property.c:(.text+0x168): undefined reference to `_prop_handlers_end'
collect2: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1
make[1]: Leaving directory `/root/magic-lantern/platform/50D.109'
make: *** [50D] Error 2

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compiling toolchain
« Reply #16 on: July 27, 2012, 05:51:02 PM »
Not sure what's the cause, but when I get that I run make clean, then make, and works. Probably something in the linker script.

xblitz

  • New to the forum
  • *
  • Posts: 3
Re: Compiling toolchain
« Reply #17 on: July 27, 2012, 06:33:42 PM »
Not sure what's the cause, but when I get that I run make clean, then make, and works. Probably something in the linker script.

wow that's strange!  This was a completely new checkout of the code.. unchanged but Makefile.inc to point to my toolchain ... but your make clean and then remake did the trick! 

mkrjf

  • Freshman
  • **
  • Posts: 53
Re: Compiling toolchain
« Reply #18 on: June 30, 2013, 04:11:14 AM »
can you provide info on compiling on mac (and yagarto link does not help)