Author Topic: Compiling Magic Lantern on a Macintosh  (Read 22897 times)

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #50 on: November 02, 2015, 08:17:31 PM »
That is one of the most common issues--
Code: [Select]
rst2html: command not found.Are you sure you followed all of my instructions?
Try this:
Code: [Select]
which rst2htmlIf you get nothing -- Did you install docutils? That's where we get rst2html.
Code: [Select]
pip install docutilsand then make soft links to all the python scripts that end in .py with:
Code: [Select]
for f in /usr/local/bin/*.py; do ln -s $f "${f/.py/}"; done
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 2899
  • 5D3 / M1 / 7D / 70D / SL1
Re: Compiling Magic Lantern on a Macintosh
« Reply #51 on: November 02, 2015, 10:10:17 PM »
That's weird because I actually went back to the OP of this thread AFTER I successfully got the 2nd gcc installed into the root user.

Here's what I did...

Code: [Select]
Last login: Mon Nov  2 08:25:57 on ttys000
Apples-Macintosh-10:~ DeafEyeJedi$ which rst2html
Apples-Macintosh-10:~ DeafEyeJedi$ pip install docutils
Requirement already satisfied (use --upgrade to upgrade): docutils in /usr/local/lib/python2.7/site-packages
Apples-Macintosh-10:~ DeafEyeJedi$ pip install docutils --upgrade
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(54, 'Connection reset by peer'))': /simple/docutils/
Requirement already up-to-date: docutils in /usr/local/lib/python2.7/site-packages
Apples-Macintosh-10:~ DeafEyeJedi$

Is this common to you at all? I haven't seen this one before myself...

Anyway after all is said and done... Went ahead and tried to compile again from your fork which still shows "Error, Module did not Build -- Deleted" for each and every Module... I find this strange. I wonder if it had anything to do with the Firewall through Wifi that I am using at work.

Will give it a 2nd try using my Hotspot from iPhone to see if I can bypass those so called errors...

*edit#1*

Doesn't seem to matter which Network I am using (as expected) and now even tho I did install "pip install docutils" which claims I already have them installed. However, May I just go-ahead & deleted those and reinstall them if that would to help?

Code: [Select]
Apples-Macintosh-10:~ DeafEyeJedi$ cd magic-lantern/platform/EOSM.202/
Apples-Macintosh-10:EOSM.202 DeafEyeJedi$ make clean && make zip
[ RM ]  *.o *.d autoexec autoexec.bin magiclantern magiclantern.bin
[ RM ]  EOSM_202.sym magiclantern.sym
[ RM ]  magiclantern.bin autoexec autoexec.map location.map
[ RM ]  autoexec-fir autoexec-fir.bin
[ RM ]  magiclantern.lds
[ RM ]  dietlibc.a newlib-libc.a newlib-libm.a gcc-libgcc.a
[ RM ]  version.c version.bin
[ RM ]  ../../build_tools/xor_chk ../../build_tools/xor_chk.exe
[ RM dir ]  zip
[ RM ]  *.zip
../../Makefile.inc:79: remove /Users/appleuser/magic-lantern/platform/EOSM.202/zip
[ RM dir ]  /Users/appleuser/magic-lantern/platform/EOSM.202/zip/
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip
[ CPP      ]   magiclantern.lds
[ AS       ]   entry.o
[ AS       ]   ../../platform/EOSM.202/stubs.o
[ VERSION  ]   ../../platform/EOSM.202/version.c
[ CC       ]   version.o
[ CC       ]   boot-hack.o
[ CC       ]   fio-ml.o
[ CC       ]   mem.o
[ CC       ]   ico.o
[ CC       ]   edmac.o
[ CC       ]   menu.o
[ CC       ]   debug.o
[ CC       ]   rand.o
[ CC       ]   posix.o
[ CC       ]   util.o
[ CC       ]   imath.o
[ CC       ]   electronic_level.o
[ CC       ]   cfn.o
[ CC       ]   gui.o
[ CC       ]   picstyle.o
[ CC       ]   exmem.o
[ CC       ]   bmp.o
[ CC       ]   rbf_font.o
[ CC       ]   config.o
[ CC       ]   stdio.o
[ CC       ]   bitrate.o
In file included from ../../src/bitrate.c:5:0:
../../src/bitrate.c: In function 'time_indicator_show':
../../src/bitrate.c:400:81: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         int fnts = FONT(FONT_SMALL, COLOR_WHITE, mvr_config.actual_qscale_maybe == -16 ? COLOR_RED : COLOR_BLACK);
                                                                                 ^
../../src/bmp.h:174:13: note: in definition of macro 'FONT'
         | ((bg) & 0xFF) << 8 \
             ^
../../src/bitrate.c:405:23: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
             mvr_config.actual_qscale_maybe < 0 ? "-" : "+",
                       ^
[ CC       ]   lcdsensor.o
[ CC       ]   tweaks.o
[ CC       ]   tweaks-eyefi.o
[ CC       ]   lens.o
[ CC       ]   property.o
[ CC       ]   propvalues.o
[ CC       ]   gui-common.o
[ CC       ]   chdk-gui_draw.o
[ CC       ]   movtweaks.o
[ CC       ]   menuhelp.o
[ CC       ]   menuindex.o
[ CC       ]   focus.o
[ CC       ]   notify_box.o
[ CC       ]   bootflags.o
[ CC       ]   dialog_test.o
[ CC       ]   vram.o
[ CC       ]   greenscreen.o
[ CC       ]   fps-engio.o
../../src/fps-engio.c:294:12: warning: 'fps_timer_b_method' defined but not used [-Wunused-variable]
 static int fps_timer_b_method = 0;
            ^
[ CC       ]   shoot.o
[ CC       ]   hdr.o
[ CC       ]   lv-img-engio.o
[ CC       ]   state-object.o
[ CC       ]   tasks.o
[ CC       ]   vsync-lite.o
[ CC       ]   tskmon.o
[ CC       ]   battery.o
[ CC       ]   imgconv.o
[ CC       ]   histogram.o
[ CC       ]   falsecolor.o
[ CC       ]   audio-ak.o
[ CC       ]   zebra.o
../../src/zebra.c:173:12: warning: 'transparent_overlay_hidden' defined but not used [-Wunused-variable]
 static int transparent_overlay_hidden = 0;
            ^
[ CC       ]   vectorscope.o
[ CC       ]   beep.o
[ CC       ]   crop-mode-hack.o
[ CC       ]   ph_info_disp.o
[ CC       ]   flexinfo.o
[ CC       ]   screenshot.o
[ CC       ]   fileprefix.o
[ CC       ]   lvinfo.o
[ CC       ]   builtin-enforcing.o
[ CC       ]   ml-cbr.o
[ CC       ]   raw.o
../../src/raw.c: In function 'raw_update_params_work':
../../src/raw.c:539:10: warning: #warning FIXME: are these values correct for 720p and crop modes? [-Wcpp]
         #warning FIXME: are these values correct for 720p and crop modes?
          ^
[ CC       ]   chdk-dng.o
[ CC       ]   edmac-memcpy.o
[ CC       ]   console.o
[ CC       ]   tcc-glue.o
make -C ../../tcc
make[1]: Nothing to be done for `all'.
[ CC       ]   module.o
[ AR       ]   strrchr.o
[ AR       ]   dietlibc.a
[ AR       ]   lib_a-setjmp.o
[ AR       ]   newlib-libc.a
[ CP       ]   newlib-libm.a
[ CP       ]   gcc-libgcc.a
[ LD       ]   magiclantern
[ SYMBOLS  ]   magiclantern.sym
[ CP       ]   EOSM_202.sym
[ MKDIR    ]   install
[ CP       ]   install
[ VERSION  ]   ../../platform/EOSM.202/version.bin
[ OBJCOPY  ]   magiclantern.bin
[ STAT     ]   magiclantern.bin
magiclantern.bin: 441336 bytes
[ CC       ]   reboot.o
[ CC       ]   disp_direct.o
[ CC       ]   font_direct.o
[ CC       ]   footer.o
[ LD       ]   autoexec

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x06bcd0 0x00109dd0 0x00109dd0 0x00008 0x00008 R   0x4
  LOAD           0x0000e0 0x0009e1e0 0x0009e1e0 0x6bbf8 0x7f20c RWE 0x100
[ XOR_CHK  ]   ../../build_tools/xor_chk
[ OBJCOPY  ]   autoexec.bin
[ OBJCOPY  ]   autoexec.bin
[ XOR_CHK  ]   autoexec.bin
cp autoexec.bin /Users/appleuser/magic-lantern/platform/EOSM.202/zip/
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/fonts
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/settings
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/data
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/cropmks
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/scripts
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/logs
mkdir -p /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/doc
cp ../../data/fonts/*.rbf /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/fonts/
cp ../../data/vram/*.lut /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/data/
cp ../../data/cropmks/*.bmp /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/cropmks/
cp ../../scripts/*.lua /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/scripts/
cp ../../scripts/*.c /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/scripts/
cp ../../scripts/*.py /Users/appleuser/magic-lantern/platform/EOSM.202/zip/ML/scripts/
make -C ../../modules

Building module raw_rec...
Updated HGVERSION
[ README   ]   module_strings.h
$//"README.rst | grep -v -E "^:([^:])+:.+$" | rst2html --no-xml-declaration | python ../html2text.py -b 700 | sed "s/



/bin/sh: rst2html: command not found

(<type 'exceptions.SystemExit'>, SystemExit(1,), <traceback object at 0x100c72cf8>)
make[4]: *** [module_strings.h] Error 1

********************************************************
WARNING: module raw_rec failed to build, deleting
********************************************************

[ RM ]  raw_rec.o raw_rec.mo raw_rec.sym raw_rec.dep module_strings.h *.o *.d *.dep *.sym hgstamp
[ RM ]  raw2dng raw2dng.exe dng2raw dng2raw.exe
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #52 on: November 02, 2015, 11:52:34 PM »
It looks like docutils is installed, those error messages had to do with the "--upgrade" option that you didn't really have to do. As far as your development environment not working yet---

Code: [Select]
/bin/sh: rst2html: command not foundSame problem. Did you do as I told you?
Code: [Select]
which rst2htmlIf that comes up empty try:
Code: [Select]
which rst2html.pyIf you get:
Code: [Select]
/usr/local/bin/rst2html.pyThat means you skipped one of my steps:
Code: [Select]
for f in /usr/local/bin/*.py; do ln -s $f "${f/.py/}"; done
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5449
Re: Compiling Magic Lantern on a Macintosh
« Reply #53 on: November 08, 2015, 07:09:10 PM »
I have to thank you, dfort! Installation on Hackintosh following your clear and detailed instructions worked like a charm. Was able to compile a1ex' latest branch (see here).

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #54 on: November 09, 2015, 06:52:09 PM »
You're welcome--and thank you WalterSchulz for doing what you do.

It worked on a Hacintosh? Great! I've got some other tutorials for Windows users too.

I wanted to give something back to the ML community and since there were several requests for special builds I felt there was a need to demystify compiling. Now if someone could demystify reverse engineering....
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

Danne

  • Hero Member
  • *****
  • Posts: 2864
Re: Compiling Magic Lantern on a Macintosh
« Reply #55 on: December 17, 2015, 05:28:23 PM »
Hey guys! I upgraded to El Capitan on my main computer and installed your fine compilation through script. Unfortunately I get the "clang" related error. I can,t really remember how I fixed it on my other computer, hmm

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #56 on: December 17, 2015, 08:35:40 PM »
Maybe the compiler didn't install properly. Try running this:

Code: [Select]
brew tap homebrew/dupes; brew install gcc --use-llvm && for f in /usr/local/bin/*-5; do mv -n "$f" "${f/-5/}"; done
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

Danne

  • Hero Member
  • *****
  • Posts: 2864
Re: Compiling Magic Lantern on a Macintosh
« Reply #57 on: December 17, 2015, 08:37:35 PM »
Tried that a few times. Too new build? Check it.

Code: [Select]
Warning: Tap homebrew/dupes already tapped.
Warning: gcc-5.3.0 already installed
mv: rename /usr/local/bin/*-5 to /usr/local/bin/*: No such file or directory

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #58 on: December 18, 2015, 04:03:59 AM »
What are you trying to compile that is giving you the clang errors? Also, what exactly are those error messages trying to tell you?

Are you getting this when you enter "gcc --version"?

Code: [Select]
$ gcc --version
gcc (Homebrew gcc 5.2.0) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Oops--looks like I didn't update my system for a while, you're on gcc-5.3.0.
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 2899
  • 5D3 / M1 / 7D / 70D / SL1
Re: Compiling Magic Lantern on a Macintosh
« Reply #59 on: December 18, 2015, 10:04:30 AM »
Should I not update the gcc then after all?
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101

Danne

  • Hero Member
  • *****
  • Posts: 2864
Re: Compiling Magic Lantern on a Macintosh
« Reply #60 on: December 18, 2015, 11:13:38 AM »
There,s that clang thingy again. I should dive in a little here.

Code: [Select]
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

So when trying make on mlv_dump

Code: [Select]
make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
clang: error: unknown argument: '-mno-ms-bitfields'
make: *** [mlv_dump.host.o] Error 1

Had the exact same error on mavericks before. Suppose my upgrade to El Capitan kept my problems. Solution here? Uninstall and reinstall something?

Make cr2hdr gives following

Code: [Select]
make cr2hdr
Updated HGVERSION
[ README   ]   module_strings.h
cat README.rst | grep -v -E "^:([^:])+:.+$" | rst2html --no-xml-declaration | py$//" ../html2text.py -b 700 | sed "s/



Traceback (most recent call last):
  File "/opt/local/bin/rst2html", line 17, in <module>
    from docutils.core import publish_cmdline, default_description
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docutils/core.py", line 20, in <module>
    from docutils import frontend, io, utils, readers, writers
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docutils/frontend.py", line 41, in <module>
    import docutils.utils
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
    import docutils.io
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docutils/io.py", line 18, in <module>
    from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
    locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale
    return _parse_localename(localename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

(<type 'exceptions.SystemExit'>, SystemExit(1,), <traceback object at 0x10e4cd320>)
make: *** [module_strings.h] Error 1


make raw2dng

Code: [Select]
make raw2dng
Makefile:27: warning: overriding commands for target `raw2dng.exe'
Makefile:22: warning: ignoring old commands for target `raw2dng.exe'
[ HOST_CC  ]   raw2dng
[ HOST_CC  ]   raw2dng
clang: error: unknown argument: '-mno-ms-bitfields'
make: *** [raw2dng] Error 1





dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3164
  • 60Da / 1100D / EOSM
Re: Compiling Magic Lantern on a Macintosh
« Reply #61 on: December 18, 2015, 12:52:21 PM »
I prefer not to replace the clang gcc with gnu gcc. By default I think homebrew actually installs gnu gcc to something like gcc5 or maybe gcc-5 (just type gcc then hit tab twice to find out) and leaves clang gcc alone. This is a good idea. All you need to do is change your makefile.user thusly:
Code: [Select]
HOST_CC = gcc5

Danne

  • Hero Member
  • *****
  • Posts: 2864
Re: Compiling Magic Lantern on a Macintosh
« Reply #62 on: December 18, 2015, 01:24:02 PM »
After hitting tab twice I get this
Code: [Select]
gcc         gcc-ar      gcc-nm      gcc-ranlib

Tried changing in the Makefile.user.default first to as suggested to
Code: [Select]
HOST_CC = gcc5
and then to any of the other gcc names that entered in terminal.

Code: [Select]
make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
/bin/sh: gcc5: command not found
make: *** [mlv_dump.host.o] Error 127
Daniels-MacBook-Pro:mlv_rec Daniel$ make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
gcc-ar: Cannot find plugin 'liblto_plugin.so'
make: *** [mlv_dump.host.o] Error 1
Daniels-MacBook-Pro:mlv_rec Daniel$ make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
clang: error: unknown argument: '-mno-ms-bitfields'
make: *** [mlv_dump.host.o] Error 1
Daniels-MacBook-Pro:mlv_rec Daniel$ make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
gcc-nm: Cannot find plugin 'liblto_plugin.so'
make: *** [mlv_dump.host.o] Error 1
Daniels-MacBook-Pro:mlv_rec Daniel$ make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
gcc-ranlib: Cannot find plugin 'liblto_plugin.so'
make: *** [mlv_dump.host.o] Error 1
Daniels-MacBook-Pro:mlv_rec Daniel$


dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3164
  • 60Da / 1100D / EOSM
Re: Compiling Magic Lantern on a Macintosh
« Reply #63 on: December 18, 2015, 02:09:30 PM »
This:
Code: [Select]
for f in /usr/local/bin/*-5; do mv -n "$f" "${f/-5/}";
is probably not a good idea. I'm guessing the purpose of this command is to rename the homebrew gcc from gcc-5 to just gcc. It's really not a good idea to try and outsmart your package manager, things will only get screwed up worse (plus this command could potentially touch other stuff unrelated to gcc, that you didn't really wanted moved around).

My guess for what is going on here, Danne, is that you have multiple gccs on your path since homebrew is reporting it has already installed gcc. You have the clang gcc from apple, and you have the gnu gcc from homebrew, renamed from gcc-5 to just gcc. Because of your specific path order, the clang gcc is being found first. Try this:
Code: [Select]
/usr/local/bin/gcc --version

I would suggest moving the gcc executables in /usr/local/bin/ back to gcc-5, and change your Makefile.user (not Makefile.user.default) to this
Code: [Select]
HOST_CC = gcc-5

If you do this, you won't have to try and outsmart homebrew and run into these kinds of issues.

Basically you want this:
Code: [Select]
$gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

$gcc-5 --version
gcc (Homebrew gcc 5.3.0) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

On a clean system it should be as simple as installing gcc via homebrew the normal way, and updating Makefile.user to use gcc-5.

Danne

  • Hero Member
  • *****
  • Posts: 2864
Re: Compiling Magic Lantern on a Macintosh
« Reply #64 on: December 18, 2015, 07:23:31 PM »
I got it to compile a couple of hours ago. I will put up a thorough description later. Thanks again for your help dmilligan and dfort.

Danne

  • Hero Member
  • *****
  • Posts: 2864
Re: Compiling Magic Lantern on a Macintosh
« Reply #65 on: December 18, 2015, 07:50:11 PM »
First I unistalled and reinstalled gcc using brew
Code: [Select]
brew uninstall gcc
Code: [Select]
brew install gcc
Checking my /usr/local/bin and /usr/local/Cellar/gcc/5.3.0/bin/ directory it seemed ok.





Looking for gcc versions I found only
Code: [Select]
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

When looking for below version it found nothing
Code: [Select]
gcc-5 --version


Had to create a makefile.user since I only have makefile.user.default. Changed to
Code: [Select]
HOST=gcc-5Tried running
Code: [Select]
make mlv_dump still it couldn,t find the correct gcc-5.

I asked dfort and another idea from him about my path not being correct and some commands I could try so here is what made it finally work with the new makefile.user document.

Solution

Tip from dfort. I checked my paths
Code: [Select]
echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Then I wrote
Code: [Select]
cat ~/.profile
Which gave me this
Code: [Select]
# MacPorts Installer addition on 2015-10-02_at_10:36:46: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

Then I decided to fool around with a path command I use in MLP
Code: [Select]
mlv_rec Daniel$ export PATH="/usr/local/bin:$PATH" make mlv_dump
Daniels-MacBook-Pro:mlv_rec Daniel$ make mlv_dump

And finally tried this and all worked. After this it compiles and it finds the gcc-5 --version fine in terminal
Code: [Select]
Daniels-MacBook-Pro:mlv_rec Daniel$ export PATH="/usr/local/bin:$PATH" make mlv_dump
Daniels-MacBook-Pro:mlv_rec Daniel$ make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
mlv_dump.c: In function 'chroma_smooth':
mlv_dump.c:946:31: warning: passing argument 1 of 'chroma_smooth_2x2' from incompatible pointer type [-Wincompatible-pointer-types]
             chroma_smooth_2x2(aux, aux2, raw2ev, ev2raw);


Conclusion. Not finding the path to gcc-5 but somehow a path fiddling got the paths straight. This seems to have been my issue also in mavericks.
Not sure if it was the
Code: [Select]
cat ~/.profile command or the
Code: [Select]
export PATH="/usr/local/bin:$PATH" that fixed the issue.
Glad that I finally got it right. Thanks again guys!





dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #66 on: December 18, 2015, 09:24:23 PM »
Glad you got it working Danne. I've got to take another look into that hack that I've got in my setup instructions. (I'll admit it is a hack, as in an inelegant solution.) The reason I did that is because I've had too many issues with the Apple compiler and setting it up this way would also allow me compile ML without touching one line of code. I don't have much coding experience so that appealed to me. The default path for a new Mac has /usr/local/bin ahead of /usr/bin but Danne's system has that reversed and that's why the hack didn't work.

dmilligan is right when he said that it isn't a good idea. This actually bit me last night when I updated Homebrew and though it updated gcc to 5.3.0 my gcc was still pointing to 5.2.0. That's not really a big deal for someone who just wants to compile ML. Once you got a system that can compile ML there shouldn't be any need to update the development environment unless the source code is changed to require newer development tools. There is work underway that will update the ARM compiler to gcc-arm-none-eabi-4_9-2015q3, we're still using the one from 2013q4 but that hasn't been merged into the unified branch yet so don't update the ARM compiler just yet.

In any case, I'll change the setup instructions with some gcc caveats and options after I chew on it a while.

EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 2899
  • 5D3 / M1 / 7D / 70D / SL1
Re: Compiling Magic Lantern on a Macintosh
« Reply #67 on: December 19, 2015, 03:04:31 AM »
Am glad you got it working on your end as well ... However I decided to give it another go on my MBP and now I am back to square one with errors looking like this... Here's a portion of it.

Code: [Select]
Apples-Macintosh-10:~ DeafEyeJedi$ cd magic-lantern/platform/5D3.113/
Apples-Macintosh-10:5D3.113 DeafEyeJedi$ make clean && make zip
[ RM ]  *.o *.d autoexec autoexec.bin magiclantern magiclantern.bin
[ RM ]  5D3_113.sym magiclantern.sym
[ RM ]  magiclantern.bin autoexec autoexec.map location.map
[ RM ]  autoexec-fir autoexec-fir.bin
[ RM ]  magiclantern.lds
[ RM ]  dietlibc.a newlib-libc.a newlib-libm.a gcc-libgcc.a
[ RM ]  version.c version.bin
[ RM ]  ../../build_tools/xor_chk ../../build_tools/xor_chk.exe
[ RM dir ]  zip
[ RM ]  *.zip
../../Makefile.inc:80: remove /Users/appleuser/magic-lantern/platform/5D3.113/zip
[ RM dir ]  /Users/appleuser/magic-lantern/platform/5D3.113/zip/
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip
[ CPP      ]   magiclantern.lds
[ AS       ]   entry.o
[ AS       ]   ../../platform/5D3.113/stubs.o
[ VERSION  ]   ../../platform/5D3.113/version.c
[ CC       ]   version.o
[ CC       ]   boot-hack.o
[ CC       ]   fio-ml.o
[ CC       ]   mem.o
[ CC       ]   ico.o
[ CC       ]   edmac.o
[ CC       ]   menu.o
[ CC       ]   debug.o
[ CC       ]   rand.o
[ CC       ]   posix.o
[ CC       ]   util.o
[ CC       ]   imath.o
[ CC       ]   electronic_level.o
[ CC       ]   cfn.o
[ CC       ]   gui.o
[ CC       ]   picstyle.o
[ CC       ]   exmem.o
[ CC       ]   bmp.o
[ CC       ]   rbf_font.o
[ CC       ]   config.o
[ CC       ]   stdio.o
[ CC       ]   bitrate-5d3.o
[ CC       ]   lcdsensor.o
[ CC       ]   tweaks.o
[ CC       ]   tweaks-eyefi.o
[ CC       ]   lens.o
[ CC       ]   property.o
[ CC       ]   propvalues.o
[ CC       ]   gui-common.o
[ CC       ]   chdk-gui_draw.o
[ CC       ]   movtweaks.o
[ CC       ]   menuhelp.o
[ CC       ]   menuindex.o
[ CC       ]   focus.o
[ CC       ]   notify_box.o
[ CC       ]   bootflags.o
[ CC       ]   dialog_test.o
[ CC       ]   vram.o
[ CC       ]   greenscreen.o
[ CC       ]   fps-engio.o
[ CC       ]   shoot.o
[ CC       ]   hdr.o
[ CC       ]   lv-img-engio.o
[ CC       ]   state-object.o
[ CC       ]   tasks.o
[ CC       ]   vsync-lite.o
[ CC       ]   tskmon.o
[ CC       ]   battery.o
[ CC       ]   imgconv.o
[ CC       ]   histogram.o
[ CC       ]   falsecolor.o
[ CC       ]   audio-ak.o
[ CC       ]   zebra.o
[ CC       ]   vectorscope.o
[ CC       ]   beep.o
[ CC       ]   crop-mode-hack.o
[ CC       ]   ph_info_disp.o
[ CC       ]   flexinfo.o
[ CC       ]   screenshot.o
[ CC       ]   fileprefix.o
[ CC       ]   lvinfo.o
[ CC       ]   builtin-enforcing.o
[ CC       ]   ml-cbr.o
[ CC       ]   raw.o
[ CC       ]   chdk-dng.o
[ CC       ]   edmac-memcpy.o
[ CC       ]   console.o
[ CC       ]   tcc-glue.o
make -C ../../tcc
make[1]: Nothing to be done for `all'.
[ CC       ]   module.o
[ CC       ]   video_hacks.o
[ CC       ]   afma.o
[ CC       ]   asm.o
[ AR       ]   strrchr.o
[ AR       ]   dietlibc.a
[ AR       ]   lib_a-setjmp.o
[ AR       ]   newlib-libc.a
[ CP       ]   newlib-libm.a
[ CP       ]   gcc-libgcc.a
[ LD       ]   magiclantern
[ SYMBOLS  ]   magiclantern.sym
[ CP       ]   5D3_113.sym
[ MKDIR    ]   install
[ CP       ]   install
[ VERSION  ]   ../../platform/5D3.113/version.bin
[ OBJCOPY  ]   magiclantern.bin
[ STAT     ]   magiclantern.bin
magiclantern.bin: 484288 bytes
[ CC       ]   reboot.o
[ CC       ]   disp_direct.o
[ CC       ]   font_direct.o
[ CC       ]   footer.o
[ LD       ]   autoexec

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x0764b8 0x000df8b8 0x000df8b8 0x00008 0x00008 R   0x4
  LOAD           0x000100 0x00069500 0x00069500 0x763c0 0x8a0f4 RWE 0x100
[ XOR_CHK  ]   ../../build_tools/xor_chk
[ OBJCOPY  ]   autoexec.bin
[ OBJCOPY  ]   autoexec.bin
[ XOR_CHK  ]   autoexec.bin
cp autoexec.bin /Users/appleuser/magic-lantern/platform/5D3.113/zip/
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/fonts
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/settings
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/data
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/cropmks
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/scripts
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/scripts/lib
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/logs
mkdir -p /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/doc
cp ../../data/fonts/*.rbf /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/fonts/
cp ../../data/vram/*.lut /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/data/
cp ../../data/cropmks/*.bmp /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/cropmks/
cp ../../scripts/*.lua /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/scripts/
cp ../../scripts/lib/*.lua /Users/appleuser/magic-lantern/platform/5D3.113/zip/ML/scripts/lib/
make -C ../../modules

Building module raw_rec...
Updated HGVERSION
[ README   ]   module_strings.h
cat README.rst | grep -v -E "^:([^:])+:.+$" | rst2html --no-xml-declaration | py$//" ../html2text.py -b 700 | sed "s/



/bin/sh: rst2html: command not found

(<type 'exceptions.SystemExit'>, SystemExit(1,), <traceback object at 0x10f30fcf8>)
make[4]: *** [module_strings.h] Error 1

********************************************************
WARNING: module raw_rec failed to build, deleting
********************************************************

[ RM ]  raw_rec.o raw_rec.mo raw_rec.sym raw_rec.dep module_strings.h *.o *.d *.dep *.sym hgstamp
[ RM ]  raw2dng raw2dng.exe dng2raw dng2raw.exe

Building module file_man...
Updated HGVERSION
[ README   ]   module_strings.h
cat README.rst | grep -v -E "^:([^:])+:.+$" | rst2html --no-xml-declaration | py$//" ../html2text.py -b 700 | sed "s/



/bin/sh: rst2html: command not found

(<type 'exceptions.SystemExit'>, SystemExit(1,), <traceback object at 0x103a85cf8>)
make[4]: *** [module_strings.h] Error 1

********************************************************
WARNING: module file_man failed to build, deleting
********************************************************

[ RM ]  file_man.o file_man.mo file_man.sym file_man.dep module_strings.h *.o *.d *.dep *.sym hgstamp

Building module pic_view...
Updated HGVERSION
[ README   ]   module_strings.h
cat README.rst | grep -v -E "^:([^:])+:.+$" | rst2html --no-xml-declaration | py$//" ../html2text.py -b 700 | sed "s/



/bin/sh: rst2html: command not found

Yes I know it's because you're probably thinking I 'skipped' the directions on your OP but no it isn't it ... I just haven't compiled ever since I last had it working on this same MBP about a month or two ago ... so I doubt it has anything to do with me needing to update the gcc?

Sorry for being a pain in the ass, guys!
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #68 on: December 19, 2015, 05:37:30 PM »
Code: [Select]
/bin/sh: rst2html: command not found

Roll back to Reply #50 on: November 02, 2015:

Quote
That is one of the most common issues--
Code: [Select]
rst2html: command not found.Are you sure you followed all of my instructions?
Try this:
Code: [Select]
which rst2htmlIf you get nothing -- Did you install docutils? That's where we get rst2html.
Code: [Select]
pip install docutilsand then make soft links to all the python scripts that end in .py with:
Code: [Select]
for f in /usr/local/bin/*.py; do ln -s $f "${f/.py/}"; done

You sure you didn't mess around with the system that caused this to break?

Unlike the gcc hack, making a link from rst2html.py to rst2html is something that dmilligan recommends so I take it that this is a good idea.
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #69 on: March 17, 2016, 08:49:53 PM »
I made a few changes to the Homebrew installation instructions. The biggest change is that I got rid of my ugly gcc hack. The downside is that you need to make a small modification in the Magic Lantern code.

Go into the magic-lantern directory, find the file named Makefile.user.default and make a copy named Makefile.user next open up Makefile.user with your preferred text editor and find this block of code:

Code: [Select]
#
# Host compiler settings
#
HOST_CC=$(shell which gcc)
HOST_LD=$(shell which ld)
HOST_AR=$(shell which ar)

Simply change the lines to this:

Code: [Select]
#
# Host compiler settings
#
HOST_CC=gcc-5
HOST_LD=$(shell which ld)
HOST_AR=$(shell which ar)

What if you liked the hack because you didn't have to make any changes to the ML code? There's a better way to handle it provided your system is setup so that /usr/local/bin is listed before /usr/bin in your path. To find out what's in your path do this:

Code: [Select]
echo $PATH
Mine looks like this:

Code: [Select]
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
Here's the hack, make symbolic links to the gcc-5 binaries in /usr/local/bin. If you look closely you'll see that they are already symbolic links so we're making symbolic links to symbolic links. Let's say we just want to have the system default to the Homebrew gcc installation instead of the Apple Clang compiler:

Code: [Select]
ln -s /usr/local/bin/gcc-5 /usr/local/bin/gcc

Now when you enter "which gcc" in the terminal it will point to /usr/local/bin/gcc. Want to switch to the Apple Clang compiler? "brew uninstall gcc" will do it. The symbolic link no longer works and "which gcc" now points to /usr/bin/gcc. Switch back to Homebrew again? "brew install gcc" since it has already been downloaded it is a fairly quick install.

There was another slight change, the quick install script now checks to see if you already have Xcode command line tools and deals with it properly.
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #70 on: October 08, 2016, 02:08:36 AM »
I recently updated from El Capitan to Sierra and came up with some errors when trying to compile Magic Lantern. The fix was simply to re-install the X-code command line tools:

Code: [Select]
xcode-select --install
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #71 on: October 14, 2016, 04:46:35 PM »
Another issue with the Sierra update. Seems like some of the symlinks disappeared. I got them back by re-running this from the install script:

Code: [Select]
for f in /usr/local/bin/*.py; do ln -s $f "${f/.py/}"; done
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #72 on: October 17, 2016, 05:49:50 PM »
I just realized that I haven't tested Windows in a while and found out that my cross compiler is broken. Darn it--another Sierra issue?
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #73 on: October 19, 2016, 07:02:56 AM »
Ok--seems that the issues with Sierra are pretty simple to fix. Simply rerun the installation steps on the first post. When you invoke Homebrew it will see that you've already got it installed but it will also recognize that you've got Sierra and move files to a new location and change permissions. After that things seem to be working as they should. If you installed the cross compiler, rerun those installation steps too. Don't mind the messages that you've already got something installed, just go through the steps.
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1587
Re: Compiling Magic Lantern on a Macintosh
« Reply #74 on: October 25, 2016, 05:52:34 PM »
I've been playing around with some of the development branches of Magic Lantern. The focus branch is going to allow lua scripts to have more control over the lens.

You might these warnings when compiling the newer lua development branches:

Code: [Select]
[ LUAC     ]   syntax_check.log
/bin/sh: luac: command not found

luac will compile lua scripts into binaries. Will we be using compiled lua for faster in-camera performance? Cool. That means the lua scripts will probably have to be compiled using the ARM cross compiler but for now I thought I'd get rid of the warnings by installing luac. Simple enough, it is a part of the homebrew lua package:

Code: [Select]
brew install lua
So is someone working on compiling lua scripts?  :)
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*