Author Topic: Compiling Magic Lantern with Cygwin/MinGW-64  (Read 34532 times)

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 2937
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #75 on: July 30, 2017, 02:01:33 AM »
Just ran into an issue where if the user name has a space in it the cmd script won't work. The fix was to quote the %UserProfile%:

Code: [Select]
"%UserProfile%"
Go figure. Fixed it in the tutorial.

[EDIT] Sorry, there are also issues with the build scripts so even though you can setup a Cygwin development environment on a Windows system that has spaces in the user name, ML won't build.

Code: [Select]
make[1]: Leaving directory '/home/new user/magic-lantern/tcc'
...
cp: target 'gcc-libgcc.a' is not a directory
make: *** [../../src/Makefile.src:320: gcc-libgcc.a] Error 1

Best advice for now is not to put spaces in your Windows user name.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 500D.112

chris_overseas

  • Member
  • ***
  • Posts: 206
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #76 on: October 01, 2017, 09:42:30 AM »
It looks like Visual Studio now has support for building using MinGW-64 and Cygwin:

https://blogs.msdn.microsoft.com/vcblog/2017/07/19/using-mingw-and-cygwin-with-visual-cpp-and-open-folder/
5D Mark IV 1.0.4 | 5D Mark III v1.2.3 | 16-35mm f4.0L | 24-105mm f4L | 70-200mm f2.8L IS II | 100-400mm f4.5-5.6L II | 800mm f5.6L | 100mm f2.8L macro | Samyang 14mm f/2.8 | 2 x Yongnuo YN500EX

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 2937
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #77 on: October 02, 2017, 07:21:45 PM »
Looks like Microsoft is opening up to open source. On Windows 10 it is possible to install Ubuntu.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 500D.112

theBilalFakhouri

  • Freshman
  • **
  • Posts: 84
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #78 on: February 10, 2018, 03:07:06 PM »
Hey @dfort
I have followed all the steps, but when I am trying to compile a module this what happening in ML Menu:
VRAM1" border="0
What should I do or update to get API 7?
700D 1.1.5 | no more ISOless LV err 8

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 2937
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #79 on: February 10, 2018, 06:38:01 PM »
You compiled only the module? Some modules are sensitive to which branch and/or changeset you're using.

Compile ML then go back and compile the module -- though it looks like you want to compile the dual_iso module which is already in the Makefile.modules.default list so it will automatically get built when you compile ML. If you want a module that isn't on the default list you can also add it in a file named Makefile.modules.user like this:

magic-lantern/modules/Makefile.modules.user
Code: [Select]
ML_MODULES_DYNAMIC += adtg_gui

BTW--the adtg_gui needs some other options turned on so you should check the link to that quote if you're interested in that one.

[EDIT] After posting this I saw another problem:

Code: [Select]
dual_i~1.mo
That shouldn't happen. You must have already had a previous version of the dual_iso module on your card. Delete everything on your card before copying over the new build.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 500D.112

theBilalFakhouri

  • Freshman
  • **
  • Posts: 84
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #80 on: February 10, 2018, 07:01:08 PM »
[EDIT] After posting this I saw another problem:
Code: [Select]
dual_i~1.mo
No, I renamed the original dual_iso so I don't miss it.
but sorry, how can I compile ML build?
and how I can know from which branch I am compiling ML?
If you can give some useful links and tips I will be appreciate it so much!
700D 1.1.5 | no more ISOless LV err 8

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 2937
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #81 on: February 10, 2018, 07:46:47 PM »
Assuming you have the repository in your home directory and it is named magic-lantern:

Code: [Select]
# Change into your home directory
cd
# Now go to the platform you want to compile
cd magic-lantern/platform/700D.115
# Which branch do you want?
hg branches
# Lots of branches to choose from!
# You'll probably see a ":" at the bottom, press the spacebar to keep scrolling or "q" to get out of that.
q
# Let's say you want to see which branch you are on:
hg branch
# How about switching to the crop_rec_4k branch
hg update crop_rec_4k
# Let's make sure you've got the latest changes
hg pull
hg update
# Check that it builds cleanly
make
# All good? Let's zip up a "Nightly" build
make zip
# copy it someplace that is easy to find like your home directory
cp *.zip ~/.
# clean up the mess
make clean

Of course there is a lot more but that should get you started.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 500D.112

theBilalFakhouri

  • Freshman
  • **
  • Posts: 84
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #82 on: February 10, 2018, 08:43:00 PM »
Thanks, it was really helpful!
Code: [Select]
$ make
Using ~/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gcc (preferred).
[ VERSION  ]   ../../platform/700D.115/version.bin
[ CPP      ]   magiclantern.lds
[ AS       ]   entry.o
[ AS       ]   ../../platform/700D.115/stubs.o
[ VERSION  ]   ../../platform/700D.115/version.c
[ CC       ]   version.o
[ CC       ]   backtrace.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:374: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:379:44: 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       ]   af_patterns.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: In function 'get_current_shutter_reciprocal_x1000':
../../src/fps-engio.c:533:6: warning: #warning FIXME: consider defining FRAME_SHUTTER_BLANKING_READ [-Wcpp]
     #warning FIXME: consider defining FRAME_SHUTTER_BLANKING_READ
      ^
../../src/fps-engio.c: At top level:
../../src/fps-engio.c:316: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
../../src/tskmon.c: In function 'null_pointer_check':
../../src/tskmon.c:242:66: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             int id = tskmon_last_task ? tskmon_last_task->taskId : -1;
                                                                  ^
[ 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       ]   powersave.o
[ CC       ]   ml-cbr.o
[ CC       ]   raw.o
[ CC       ]   chdk-dng.o
../../src/chdk-dng.c:209:16: warning: 'cam_apex_shutter' defined but not used [-Wunused-variable]
 static int32_t cam_apex_shutter[2]          = { 0, 96 };            // Shutter speed in APEX units
                ^
../../src/chdk-dng.c:210:16: warning: 'cam_apex_aperture' defined but not used [-Wunused-variable]
 static int32_t cam_apex_aperture[2]         = { 0, 96 };            // Aperture in APEX units
                ^
[ CC       ]   edmac-memcpy.o
../../src/edmac-memcpy.c: In function 'edmac_memcpy_init':
../../src/edmac-memcpy.c:91:57: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
     static int AbortEDmac_check __attribute__((used)) = &AbortEDmac;
                                                         ^
[ CC       ]   patch.o
[ CC       ]   console.o
[ CC       ]   tcc-glue.o
make -C ../../tcc
make[1]: Entering directory '/home/Bilal Fakhouri/magic-lantern/tcc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/Bilal Fakhouri/magic-lantern/tcc'
[ CC       ]   module.o
[ AR       ]   strrchr.o
[ AR       ]   dietlibc.a
[ AR       ]   lib_a-setjmp.o
[ AR       ]   newlib-libc.a
[ CP       ]   newlib-libm.a
make: *** No rule to make target 'fakhouri/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/libgcc.a', needed by 'gcc-libgcc.a'.  Stop.

Bilal [email protected] ~/magic-lantern/platform/700D.115
$ make zip
Using ~/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gcc (preferred).
../../Makefile.inc:81: removing ../../platform/*/magiclantern.sym
[ RM dir   ]   /home/Bilal Fakhouri/magic-lantern/platform/700D.115/zip/
[ RM       ]   ../../platform/*/magiclantern.sym
mkdir -p /home/Bilal Fakhouri/magic-lantern/platform/700D.115/zip
[ MKDIR    ]   ML directory structure...
[ VERSION  ]   ../../platform/700D.115/version.c
[ CC       ]   version.o
make -C ../../tcc
make[1]: Entering directory '/home/Bilal Fakhouri/magic-lantern/tcc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/Bilal Fakhouri/magic-lantern/tcc'
make: *** No rule to make target 'fakhouri/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/libgcc.a', needed by 'gcc-libgcc.a'.  Stop.

Bilal [email protected] ~/magic-lantern/platform/700D.115
$
Is that correct? or it didn't compile?
If yes, I lost here "cp *.zip ~/." Should I change  something here like the name instaed of "*" or add directory(Example please).
700D 1.1.5 | no more ISOless LV err 8

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 2937
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #83 on: February 11, 2018, 12:46:14 AM »
It didn't compile properly.

Code: [Select]
# Go back to your magic-lantern directory
# ~ is a shortcut for your home directory
cd ~/magic-lantern
# Clean it up
make clean

Now try it again. You might have switched branches without running "make clean" or maybe you made changes without committing them and switched branches. You can discard your changes when switching branches like this:

Code: [Select]
hg up -C unified
Note that up is a shortcut for "update" there are lots of shortcuts.

If you find yourself in a big mess just delete your local repository and re-clone it.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 500D.112

theBilalFakhouri

  • Freshman
  • **
  • Posts: 84
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #84 on: February 11, 2018, 01:28:45 AM »
I tried, it didn't work. I can compile the modules separately  or the mlv_dump with no problem.
Any Idea why & how to fix it?
Can give me what should I get in the terminal please?
700D 1.1.5 | no more ISOless LV err 8

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 2937
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #85 on: February 11, 2018, 07:11:44 AM »
I think I found the problem:

Code: [Select]
Bilal [email protected] ~/magic-lantern/platform/700D.115
There's a space in your username. That will throw it off:

Code: [Select]
make: *** No rule to make target 'fakhouri/...
Easiest "fix" is to make another user without spaces in the username and reinstall Cygwin for that user. You might be able to get away with just renaming the Cygwin directory but that probably won't work. According to the FAQ you need to use the mkpasswd command.

https://cygwin.com/faq.html#faq.setup.name-with-space

Odd that everything else works. Maybe the tcc makefile could be modified so it will work like the others?
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 500D.112

theBilalFakhouri

  • Freshman
  • **
  • Posts: 84
Re: Compiling Magic Lantern with Cygwin/MinGW-64
« Reply #86 on: February 11, 2018, 09:38:41 AM »
[email protected]! it worked.
I thought the username's space issue was solved.
700D 1.1.5 | no more ISOless LV err 8