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

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling Magic Lantern on a Macintosh
« Reply #200 on: February 28, 2019, 03:03:29 PM »
Installed on a virgin High sierra 10.13.6 today.

This what I did, just for reference.

from terminal
Code: [Select]
gccasked to install command line tools and so installed them

then went to recovery terminal:
Code: [Select]
csrutil disable
back to the os made the root owned /usr/local/ folder mine:
Code: [Select]
sudo chflags norestricted /usr/local && sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local

back in recovery terminal:
Code: [Select]
csrutil enable
Again to the Os installed Homebrew:
Code: [Select]
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then python wget and mercurial
Code: [Select]
brew install python wget mercurial
after those docutils (but seems not needed since they were already up to date)
Code: [Select]
pip install docutils
pip2 install docutils
pip3 install docutils
then skipped the homebrew compiler part and copied the arm toolchain, both
Code: [Select]
cd ~ && wget -c https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-mac.tar.bz2 &&  tar -jxf gcc-arm-none-eabi-5_4-2016q3-20160926-mac.tar.bz2 &&  rm gcc-arm-none-eabi-5_4-2016q3-20160926-mac.tar.bz2
cd ~ && wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2013-q4-major/+download/gcc-arm-none-eabi-4_8-2013q4-20131218-mac.tar.bz2 && tar -jxf gcc-arm-none-eabi-4_8-2013q4-20131218-mac.tar.bz2 && rm gcc-arm-none-eabi-4_8-2013q4-20131218-mac.tar.bz2
finally to check it out cloned MLrepo and try compile it
Code: [Select]
hg clone https://bitbucket.org/hudson/magic-lantern
cd magic-lantern
hg update unified
make 600D
and it worked!
tried another branch and than time for qemu:
Code: [Select]
hg update qemu -c
cd contrib/qemu/
./install.sh
after installing it and putting the ROM0.BIN and ROM1.BIN in 600D folder I got canon menu and ML working with:
Code: [Select]
make -C ../magic-lantern/platform/600D.102 install_qemu
./run_canon_fw.sh 600D,firmware="boot=1"

photo screen is all black comes up after a couple of I presses but don't stay on turn black after a little. with fn+CANC i simulate DEL and can open ML.
 
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-

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3721
Re: Compiling Magic Lantern on a Macintosh
« Reply #201 on: April 09, 2019, 05:38:43 AM »
...skipped the homebrew compiler part...

For the most part skipping the Homebrew gcc-5 installation isn't a problem, the Mac clang compiler works fine. However, there are a few utilities like cr2hdr and (I believe) io-decrypt that won't compile with clang.

The other day Apple pushed an update on the command line tools and it broke the Homebrew gcc-5 compiler. Going back through my notes this is the fix:

Code: [Select]
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
If you want to use the latest from Homebrew you can also:

Code: [Select]
brew update
brew upgrade
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling Magic Lantern on a Macintosh
« Reply #202 on: April 16, 2019, 08:48:10 PM »
For the most part skipping the Homebrew gcc-5 installation isn't a problem, the Mac clang compiler works fine. However, there are a few utilities like cr2hdr and (I believe) io-decrypt that won't compile with clang.


According to this comment seems that for MLV app David made some changes to make it compile on clang.

Maybe can those changes be included in unified?
Seems not, but I've just tried to compile cr2hdr and worked.
Then tried to make a brew formula for it but so far can't make it work (seems homebrew can't find my toolchains).

Code: [Select]
brew install cr2hdr
==> Downloading https://bitbucket.org/hudson/magic-lantern/get/7a3b5fa3f4c6.zip
Already downloaded: ~/Library/Caches/Homebrew/downloads/d3c1cf4d6a2a8d9314ef76c703162e322414dd166d057626813089071420a00d--hudson-magic-lantern-7a3b5fa3f4c6.zip
==> make cr2hdr
Last 15 lines from ~/Library/Logs/Homebrew/cr2hdr/01.make:
make cr2hdr


Please configure a valid ARM cross-compiler.
If arm-none-eabi-gcc is in your executable path, it will be used.

Preferred: gcc 5_4-2016q3 32-bit from https://launchpad.net/gcc-arm-embedded
Also fine: gcc-arm-embedded 6.x, Linaro arm-eabi 7.x, gcc-arm-none-eabi from Ubuntu,
gcc-arm-embedded from team-gcc-arm-embedded PPA on Ubuntu, others may work as well.

For GDB+QEMU, you *must* use a 32-bit version, e.g. gdb-arm-none-eabi:i386,
gcc-arm-embedded:i386 from PPA, 32-bit arm-none-eabi-gdb from gcc-arm-embedded.
Unfortunately, Linaro's arm-eabi-gdb does not work, whether 32 or 64 bit.

../../Makefile.setup.toolchain:42: *** .  Stop.

READ THIS: https://docs.brew.sh/Troubleshooting

This is what I'm using
Code: [Select]
class Cr2hdr < Formula
  depends_on "dcraw"
  depends_on "exiftool"
  desc "Dual ISO file coverter"
  homepage "https://www.magiclantern.fm"
  head "https://bitbucket.org/hudson/magic-lantern",
    :branch => "unified"
  url "https://bitbucket.org/hudson/magic-lantern/get/7a3b5fa3f4c6.zip"
  version "2.3"
  sha256 "7d5f10df15e243af51543ef6ad26989ab015d2d35a84228f099143587dfebc11"

  def install
    cd "modules/dual_iso" do
      system "make cr2hdr"
      bin.install "cr2hdr"
    end
  end

  def caveats
    <<-EOS.undent
      Before you can use cr2hdr you must install Adobe DNG Converter
      $ brew install caskroom/cask/brew-cask
      $ brew cask install adobe-dng-converter
    EOS
  end

  test do
    system "#{bin}/cr2hdr"
  end
end

And here an older formula found today looking for how to make a homebrew package, I like the idea to maybe (in the end) have a "brew install magiclantern" formula that will work without installling things one by one...
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-

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3721
Re: Compiling Magic Lantern on a Macintosh
« Reply #203 on: April 17, 2019, 01:03:10 AM »
Hum--interesting:

Code: [Select]
brew install --HEAD cr2hdr
brew install --HEAD raw2dng

Though it is a bit outdated. Last commit was 5 years ago.

The install script I wrote a while back and is now in Danne's Magic Lantern development compiler.app (Mac OS) should still work for most users who want to set up a development environment. It will download all the pieces and even set up QEMU for you.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling Magic Lantern on a Macintosh
« Reply #204 on: April 17, 2019, 01:12:25 AM »
I'm getting closer... but still having problem.

If I try download using repo url (https://bitbucket.org/hudson/magic-lantern) homebrew fail because magic-lantern folder is saved as a file and then cant cd to modules/dual_iso
If I download the repo zip (https://bitbucket.org/hudson/magic-lantern/get/7a3b5fa3f4c6.zip) I got right the magic-lantern folder but then:

Code: [Select]
abort: no repository found in '/private/tmp/cr2hdr-20190417-3613-cq0pzx/hudson-magic-lantern-7a3b5fa3f4c6/modules/dual_iso' (.hg not found)!

(<type 'exceptions.SystemExit'>, SystemExit(1,), <traceback object at 0x10b3765f0>)
[ gcc      ]   cr2hdr
cr2hdr.c:58:10: fatal error: 'module_strings.h' file not found
#include "module_strings.h"
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-

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling Magic Lantern on a Macintosh
« Reply #205 on: April 17, 2019, 01:14:18 AM »
Hum--interesting:

Code: [Select]
brew install --HEAD cr2hdr
brew install --HEAD raw2dng

Though it is a bit outdated. Last commit was 5 years ago.

last commit is nov 2017, but was just updated added the checksum.

But wait a sec.
did it work for you?
 ???

I got this:
Code: [Select]
brew tap ebeigarts/homebrew-magic-lantern
==> Tapping ebeigarts/magic-lantern
Cloning into '/usr/local/Homebrew/Library/Taps/ebeigarts/homebrew-magic-lantern'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (8/8), done.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/ebeigarts/homebrew-magic-lantern/magic_lantern_formula.rb
formulae require at least a URL
Error: Cannot tap ebeigarts/magic-lantern: invalid syntax in tap!

Note:To setup some ML useful stuff (not only for devs) there iswas MLTools too (supposed to support linux also).
I've tried it some week ago and needs to be updated for hugin stuff that changed something (attached the patch to fix)
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-

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3721
Re: Compiling Magic Lantern on a Macintosh
« Reply #206 on: April 17, 2019, 02:38:14 AM »
I didn't try it. Looked at the scripts and it needs a lot of work. cr2hdr requires dcraw and exiftool but these Homebrew scripts use Adobe DNG Converter. Not sure how it is supposed to work. I never had any luck writing my own Homebrew taps.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Compiling Magic Lantern on a Macintosh
« Reply #207 on: April 17, 2019, 03:06:35 AM »
I didn't try it. Looked at the scripts and it needs a lot of work. cr2hdr requires dcraw and exiftool but these Homebrew scripts use Adobe DNG Converter. Not sure how it is supposed to work. I never had any luck writing my own Homebrew taps.

It has exiftool and dcraw as dependencies so it will intall also them like usual in homebrew, somewhere here in the forum I think had found something about Adobe DNG converter not mandatory but will help getting right WB (related to the camera-lens model corrections) needed for DNG compression (from cr2hdr help):
Quote
DNG compression (requires Adobe DNG Converter):
--compress      : Lossless DNG compression
--compress-lossy: Lossy DNG compression (be careful, may destroy shadow detail)
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-