Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: marekk on November 01, 2013, 03:18:14 PM

Title: mlv_dump on Mac OSX
Post by: marekk on November 01, 2013, 03:18:14 PM
I'm trying to compile mlv_dump on Mac OSX. Make ends with this error:
mlv_dump.c:1456:34: error: no member named 'buffer' in 'struct raw_info'

I'm using this compiler: https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q1-update/+download/gcc-arm-none-eabi-4_7-2013q1-20130313-mac.tar.bz2

Maybe someone know how to compile it sucessfully on Mac ?
Title: Re: mlv_dump on Mac OSX
Post by: dmilligan on November 01, 2013, 04:05:53 PM
For starters, unless you are somehow running Mac OSX  on an ARM processor, you shouldn't be using the ARM compiler (the ARM compiler is for ML, b/c the camera's processor is ARM, but mlv_dump is a computer utility, you need to use the compiler for your computer's architecture).  If you have xcode installed with command line tools, you should have a standard version of gcc and also llvm (not sure which versions of those, don't have my mac with me right now). You probably need to modify the makefile to point at the correct compiler for your computer. You might also have to find and download an appropriate version.
Title: Re: mlv_dump on Mac OSX
Post by: marekk on November 01, 2013, 04:56:26 PM
I've got xcode 5.0.1 with command line tools.

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
Title: Re: mlv_dump on Mac OSX
Post by: dmilligan on November 01, 2013, 05:28:03 PM
perhaps you need to install and use the "real" gcc compiler rather than apple's llvm version:
http://superuser.com/questions/517218/how-do-i-install-gcc-4-7-2-on-os-x-10-8

those instructions are a little old, I'd go for 4.8 rather than 4.7, but you get the idea.
Title: Re: mlv_dump on Mac OSX
Post by: a1ex on November 01, 2013, 05:38:00 PM
Or maybe you need to look at the error message and propose a fix.
Title: Re: mlv_dump on Mac OSX
Post by: marekk on November 01, 2013, 06:48:34 PM
I installed gcc 4.7.3 and still the same error...

which gcc
/opt/local/bin/gcc

opt/local/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/opt/local/bin/gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.7.3/lto-wrapper
Target: x86_64-apple-darwin12
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/gcc47/work/gcc-4.7.3/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --with-pkgversion='MacPorts gcc47 4.7.3_3+universal'
Thread model: posix
gcc version 4.7.3 (MacPorts gcc47 4.7.3_3+universal)


Quote from: dmilligan on November 01, 2013, 05:28:03 PM
perhaps you need to install and use the "real" gcc compiler rather than apple's llvm version:
http://superuser.com/questions/517218/how-do-i-install-gcc-4-7-2-on-os-x-10-8

those instructions are a little old, I'd go for 4.8 rather than 4.7, but you get the idea.
Title: Re: mlv_dump on Mac OSX
Post by: marekk on November 01, 2013, 07:19:15 PM
raw.h

#if INTPTR_MAX == INT32_MAX     // only works on 32-bit systems
    void* buffer;                   // points to image data
    #else
    uint32_t do_not_use_this;       // this can't work on 64-bit systems
    #endif


I'm trying to compile it on x64 system so there is no buffer..
added -m32 at the end of this line:
LV_CFLAGS=-DMLV_USE_LZMA -Wpadded -mno-ms-bitfields -O2 -Wall $(LFS_FLAGS) -I$(SRC_DIR) -std=c99

and now it ends with:

Quoteld: warning: ignoring file lzma/lib7z.a, file was built for archive which is not the architecture being linked (i386): lzma/lib7z.a
Undefined symbols for architecture i386:
  "_LzmaCompress", referenced from:
      _main in cc8H2Vkr.o
  "_LzmaUncompress", referenced from:
      _main in cc8H2Vkr.o
ld: symbol(s) not found for architecture i386
collect2: error: ld returned 1 exit status
make: *** [mlv_dump] Error 1
Title: Re: mlv_dump on Mac OSX
Post by: marekk on November 01, 2013, 07:33:07 PM
ufffff finally it works..

1. I had to install gcc 4.7.3 (sudo port install gcc47 +universal; sudo port select --set gcc mp-gcc47; hash gcc)
2. Makefile:
QuoteMLV_CFLAGS=-DMLV_USE_LZMA -Wpadded -mno-ms-bitfields -O2 -Wall $(LFS_FLAGS) -I$(SRC_DIR) -std=c99 -m32
QuoteLZMA_CFLAGS=-c -O2 -Wall -c -m32
3. CpuArch.c from lzma lib has a bug as described at http://sourceforge.net/p/sevenzip/bugs/1338/
4. CpuArch.c replaced with http://sourceforge.net/p/sevenzip/bugs/_discuss/thread/ceab2abb/ab04/attachment/CpuArch.c
Title: Re: mlv_dump on Mac OSX
Post by: dubzeebass on November 04, 2013, 04:40:05 PM
Great Job Marek, can you please post the compiled version here?
Title: Re: mlv_dump on Mac OSX
Post by: marekk on November 04, 2013, 09:59:49 PM
https://www.dropbox.com/s/497bvdlcsd7p160/mlv_dump.zip
Title: Re: mlv_dump on Mac OSX
Post by: sebamax on November 05, 2013, 03:35:14 PM
Hi,
how to use mlv_dump on Mac OS X
Thanks
Title: Re: mlv_dump on Mac OSX
Post by: marekk on November 06, 2013, 11:16:50 AM
you should to record a raw video using mlv_rec module, then you can convert *.MLV files to DNG or RAW file.

Quote from: sebamax on November 05, 2013, 03:35:14 PM
Hi,
how to use mlv_dump on Mac OS X
Thanks
Title: Re: mlv_dump on Mac OSX
Post by: sebamax on November 06, 2013, 05:10:21 PM
Hi,
yes I Know it, but I wanted to know how to convert using mlv_dump.
Thanks
Title: Re: mlv_dump on Mac OSX
Post by: dmilligan on November 06, 2013, 07:05:31 PM
http://www.magiclantern.fm/forum/index.php?topic=7122.msg59525#msg59525
Title: Re: mlv_dump on Mac OSX
Post by: sebamax on November 06, 2013, 08:50:48 PM
Hi,
As I try using mlv_dump I write "./desktop/folder/mlv_dump filename.MLV " into Terminal window, it answers:

" Mode of operation:
   - Input MLV file: 'M05-1620.MLV'
   - Verify file structure
[E] Failed to open file 'M05-1620.MLV' "

Where am I wrong?
Please can someone explain me what to do?
Thanks
Title: Re: mlv_dump on Mac OSX
Post by: g3gg0 on November 07, 2013, 01:03:19 PM
tried passing the whole path to the file?
Title: Re: mlv_dump on Mac OSX
Post by: dmilligan on November 07, 2013, 01:18:05 PM
Quote from: g3gg0 on November 07, 2013, 01:03:19 PM
tried passing the whole path to the file?

Hint: you can drag and drop a file onto the termnial window to get the full path
Title: Re: mlv_dump on Mac OSX
Post by: sebamax on November 07, 2013, 09:15:46 PM
Hi,
I tried but the answer is always the same:

"- Verify file structure
[E] Failed to open file 'M05-1620.MLV' ""
Title: Re: mlv_dump on Mac OSX
Post by: g3gg0 on November 07, 2013, 10:00:03 PM
Quote from: sebamax on November 07, 2013, 09:15:46 PM
Hi,
I tried but the answer is always the same:

"- Verify file structure
[E] Failed to open file 'M05-1620.MLV' ""

screenshot please
Title: Re: mlv_dump on Mac OSX
Post by: LinuxGadget on November 10, 2013, 10:56:03 AM

Quote from: marekk on November 04, 2013, 09:59:49 PM
https://www.dropbox.com/s/497bvdlcsd7p160/mlv_dump.zip

Thanks  :)
Title: Re: mlv_dump on Mac OSX
Post by: Viktor Fenster on November 18, 2013, 07:01:13 PM
Quote from: marekk on November 01, 2013, 07:33:07 PM
ufffff finally it works..

1. I had to install gcc 4.7.3 (sudo port install gcc47 +universal; sudo port select --set gcc mp-gcc47; hash gcc)
2. Makefile:3. CpuArch.c from lzma lib has a bug as described at http://sourceforge.net/p/sevenzip/bugs/1338/
4. CpuArch.c replaced with http://sourceforge.net/p/sevenzip/bugs/_discuss/thread/ceab2abb/ab04/attachment/CpuArch.c

Marekk, I'm trying to compile on OSX 10.6.8, however, have you come across these errors?


mlv_dump.c: In function 'main':
mlv_dump.c:521: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
mlv_dump.c:1076: warning: format '%d' expects type 'int', but argument 2 has type 'size_t'
mlv_dump.c:1076: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
mlv_dump.c:1339: warning: format '%d' expects type 'int', but argument 2 has type 'size_t'
mlv_dump.c:1737: error: 'struct raw_info' has no member named 'active_area'
mlv_dump.c:1738: error: 'struct raw_info' has no member named 'active_area'
mlv_dump.c:1739: error: 'struct raw_info' has no member named 'active_area'
mlv_dump.c:1740: error: 'struct raw_info' has no member named 'active_area'
make: *** [mlv_dump] Error 1

Title: Re: mlv_dump on Mac OSX
Post by: g3gg0 on November 18, 2013, 10:02:37 PM
Quote from: Viktor Fenster on November 18, 2013, 07:01:13 PM
Marekk, I'm trying to compile on OSX 10.6.8, however, have you come across these errors?


mlv_dump.c: In function 'main':
mlv_dump.c:521: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
mlv_dump.c:1076: warning: format '%d' expects type 'int', but argument 2 has type 'size_t'
mlv_dump.c:1076: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
mlv_dump.c:1339: warning: format '%d' expects type 'int', but argument 2 has type 'size_t'
mlv_dump.c:1737: error: 'struct raw_info' has no member named 'active_area'
mlv_dump.c:1738: error: 'struct raw_info' has no member named 'active_area'
mlv_dump.c:1739: error: 'struct raw_info' has no member named 'active_area'
mlv_dump.c:1740: error: 'struct raw_info' has no member named 'active_area'
make: *** [mlv_dump] Error 1


tried this?
> 1. I had to install gcc 4.7.3 (sudo port install gcc47 +universal; sudo port select --set gcc mp-gcc47; hash gcc)
Title: Re: mlv_dump on Mac OSX
Post by: Viktor Fenster on November 19, 2013, 01:37:37 AM
Quote from: g3gg0 on November 18, 2013, 10:02:37 PM
tried this?
> 1. I had to install gcc 4.7.3 (sudo port install gcc47 +universal; sudo port select --set gcc mp-gcc47; hash gcc)

Compiling version 4.7.3 right now so I'll get back to the thread after I've played around with the new compiler.
Title: Re: mlv_dump on Mac OSX
Post by: lcemmanuel on January 05, 2014, 09:37:51 PM
Hi everyone and thanks for all what is being done !

I tried to convert .mlv on a mac running osx 10.9.1

I dropped mlv_dump followed by the .mlv onto terminal. Here is what I get :

MLV Dumper v1.0
-----------------

Mode of operation:
   - Input MLV file: '/Users/laurentemmanuel/Desktop/mlvfiles/M03-1804.MLV'
   - Verify file structure
File /Users/laurentemmanuel/Desktop/mlvfiles/M03-1804.MLV opened
File /Users/laurentemmanuel/Desktop/mlvfiles/M03-1804.M00 opened
File /Users/laurentemmanuel/Desktop/mlvfiles/M03-1804.M01 opened
File /Users/laurentemmanuel/Desktop/mlvfiles/M03-1804.M02 opened
Processing...
Reached end of chunk 1/4 after 3370 blocks
Reached end of chunk 2/4 after 3351 blocks
Reached end of chunk 3/4 after 3355 blocks
Reached end of chunk 4/4 after 337 blocks
Processed 5090 video frames
Done

So Terminal says it's done, but it doesn't seem anything happens.

I am not a developer and when I use Terminal, my knowledge is very limited.

Tanks for your insight !

Laurent
Title: Re: mlv_dump on Mac OSX
Post by: g3gg0 on January 05, 2014, 10:07:19 PM
you have to specify what to dump.
open a command line and type mlv_dump --help
or use the GUI (MLVBrowseSharp)
Title: Re: mlv_dump on Mac OSX
Post by: lcemmanuel on January 05, 2014, 10:39:36 PM
ok I'll try, many thanks for helping !
Title: Re: mlv_dump on Mac OSX
Post by: lcemmanuel on January 05, 2014, 11:36:13 PM
For the Mac users running Mavericks, converting .mlv to .dng finally worked this way :

http://www.youtube.com/watch?v=PFaiU7rv1pg

Here is a copy of what I wrote in Terminal. I had in the mlv folder on my desktop the following files :

M03_1804.M00
M03_1804.M01
M03_1804.M02
M03_1804.MLV
mlv_dump

mbp-de-laurent:~ laurentemmanuel$ cd desktop
mbp-de-laurent:desktop laurentemmanuel$ cd mlv
mbp-de-laurent:mlv laurentemmanuel$ ./mlv_dump --dng M03-1804.MLV

All dng files were extracted into the original mlv folder.

Thanks everyone for your help !

Laurent

Title: Re: mlv_dump on Mac OSX
Post by: Danne on January 06, 2014, 01:42:01 AM
On mac you can use MlvBrowseSharp from here http://www.magiclantern.fm/forum/index.php?topic=8447.0

Or if you simply want to batchconvert all files with a click (inckuding spanned files) you could use this command.script.
http://www.magiclantern.fm/forum/index.php?topic=9731.msg93586#msg93586
If you want the latest mlv_dump simply change the existing one from the link to the latest compiled from g3gg0 to stay current.
Title: Re: mlv_dump on Mac OSX
Post by: lcemmanuel on January 06, 2014, 12:13:38 PM
Thank you very much Danne for the advice.
Title: Re: mlv_dump on Mac OSX
Post by: jacktortuga on February 12, 2014, 09:23:42 PM
Quote from: marekk on November 04, 2013, 09:59:49 PM
https://www.dropbox.com/s/497bvdlcsd7p160/mlv_dump.zip

Downloaded that from dropbox and used the "drag to termiinal method" worked on some files on my first batch, some didnt, i was able to convert 2 out of 5 MLVs.

Now I always get the error "missing header files"  and cant convert anymore.

Any advice?  Using mavericks and a 60D if that helps
Title: Re: mlv_dump on Mac OSX
Post by: marekk on February 13, 2014, 11:07:26 AM
mlv_dump for mac, 15.02.2014

https://www.dropbox.com/s/497bvdlcsd7p160/mlv_dump.zip
Title: Re: mlv_dump on Mac OSX
Post by: Yfripp on April 09, 2014, 05:43:10 PM
Quote from: marekk on November 01, 2013, 07:33:07 PM
ufffff finally it works..

1. I had to install gcc 4.7.3 (sudo port install gcc47 +universal; sudo port select --set gcc mp-gcc47; hash gcc)
2. Makefile:3. CpuArch.c from lzma lib has a bug as described at http://sourceforge.net/p/sevenzip/bugs/1338/
4. CpuArch.c replaced with http://sourceforge.net/p/sevenzip/bugs/_discuss/thread/ceab2abb/ab04/attachment/CpuArch.c

just incase anyone else is running into this issue on x86_x64 linux (im ruinning centos 6.5) adding -m32 to:
MLV_LFLAGS = -m32

solved the issue, it was already included on the MLV_CFLAGS command
Title: Re: mlv_dump on Mac OSX
Post by: g3gg0 on April 24, 2014, 09:13:43 PM
http://ml.g3gg0.de/modules/mlv_dump.zip/mlv_dump.zip
Title: Re: mlv_dump on Mac OSX
Post by: marekk on April 26, 2014, 01:09:08 PM
Quote from: Yfripp on April 09, 2014, 05:43:10 PM
just incase anyone else is running into this issue on x86_x64 linux (im ruinning centos 6.5) adding -m32 to:
MLV_LFLAGS = -m32

solved the issue, it was already included on the MLV_CFLAGS command



MLV_CFLAGS = -I$(SRC_DIR) -D MLV_USE_LZMA -m32 -Wpadded -mno-ms-bitfields -D _7ZIP_ST -D MLV2DNG
MLV_LFLAGS = -m32
MLV_LIBS = -lm
MLV_LIBS_MINGW = -lm


after adding -m32 to MLV_LFLAGS it works also on my system:
/opt/local/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/opt/local/bin/gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.2/lto-wrapper
Target: x86_64-apple-darwin12
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc48/gcc48/work/gcc-4.8.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.8 --with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc48 4.8.2_0+universal'
Thread model: posix
gcc version 4.8.2 (MacPorts gcc48 4.8.2_0+universal)
Title: Re: mlv_dump on Mac OSX
Post by: dfort on June 27, 2015, 10:44:17 PM
I was able to compile mlv_dump on a Mac. For others who are having trouble I posted the instructions here:

http://www.magiclantern.fm/forum/index.php?topic=7645.msg150386#msg150386

This should help with raw2dng and cr2hdr as well.
Title: Re: mlv_dump on Mac OSX
Post by: dfort on March 18, 2016, 08:53:24 PM
Fast forward nine months and a new problem is born.

I recently rebuilt my Macintosh development system (http://www.magiclantern.fm/forum/index.php?topic=16012) using Homebrew and it seems that there is an issue that has come up since I first posted that tutorial. Everything works fine except when it comes to building mlv_dump.

[ HOST_CC  ]   lzma/XzCrc64.host.o
[ HOST_AR  ]   lzma/lib7z.a
gcc-ar-5: Cannot find plugin 'liblto_plugin.so'
make: *** [lzma/lib7z.a] Error 1


Searching for a solution I came across this: https://github.com/Homebrew/homebrew-versions/issues/139

So it looks like there is something wrong with the current gcc in Homebrew:

$ gcc-ar-5
gcc-ar-5: Cannot find plugin 'liblto_plugin.so'


I tried Apple's compiler but it doesn't work either:

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


However, I can successfully cross-compile a Windows binary with the i686-w64-mingw32-gcc compiler.

Any clues how to get this working again?

[EDIT:] Fixed it!

Turns out that Homebrew plays nicely with Apple's default compiler suite so there's no need to use gcc-ar.

Makefile.user
#
# Host compiler settings
#
HOST_CC=gcc-5
HOST_LD=gcc-5
HOST_AR=$(shell which ar)