[pHash-support] [Phash-support] Phash on Mac OS X

Sebastian Gallese sebastiangallese at gmail.com
Mon Jan 18 16:32:45 PST 2010


Hi Evan,

Sorry, forgot to CC the support list on the last e-mail or two.  Our
past convo is below.

Looks like MacPorts GCC installed a bunch of stuff to
/opt/local/include/gcc44/c++ (including a complex.h file)

I ran this command:
sudo ./configure CPPFLAGS=-I/opt/local/include/gcc44/c++
CC=i386-apple-darwin9-gcc-4.4.2 && sudo make
CC=i386-apple-darwin9-gcc-4.4.2

And I get this output @ http://gist.github.com/280525

Do you know why it would call both /usr/include/c++/ AND
/opt/local/include/gcc44/c++/ ?

Should I try to temporarily link everything from
/opt/local/include/gcc44/c++/ into /usr/include/c++/ ?

Thanks,
Seb

Relevant error below:
In file included from /usr/include/c++/4.0.0/backward/complex.h:31,
                 from /opt/local/include/gcc44/c++/complex.h:35,
                 from ph_fft.h:32,
                 from audiophash.h:38,
                 from audiophash.cpp:25:
/usr/include/c++/4.0.0/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the <X>
header for the <X.h> header for C++ includes, or <iostream> instead of
the deprecated header <iostream.h>. To disable this warning use
-Wno-deprecated.
/opt/local/include/gcc44/c++/cstddef:49: error: expected constructor,
destructor, or type conversion before '(' token
/opt/local/include/gcc44/c++/cstddef:54: error:
'_GLIBCXX_END_NAMESPACE' does not name a type


On Mon, Jan 18, 2010 at 6:05 PM, Evan Klinger <eklinger at phash.org> wrote:
> It looks like it is using the newer gcc to build but it seems like
> it's still finding the old complex.h header from 4.0. That file should
> not be deprecated.
> Try using CPPFLAGS or CXXFLAGS on the ./configure line and point it to
> the headers from the new gcc install and see if that works.
>
> On Mon, Jan 18, 2010 at 2:47 PM, Sebastian Gallese
> <sebastiangallese at gmail.com> wrote:
>> Having another go at compiling pHash on the Mac.
>>
>> Under pHash-0.7.2
>> When using CImg 1.3.2
>> Git checkout of ffmpeg on January 18th, 2009 (built with ./configure
>> --enable-shared )
>>
>> Apple 10.5 comes with GCC 4.0 and 4.2, so I set the GCC to 4.2
>> sudo ./configure CC=gcc-4.2 CXX=g++-4.2 && sudo make CC=gcc-4.2 CXX=g++-4.2
>> Output at http://gist.github.com/280285
>>
>> And then I installed GCC 4.4.2 from MacPorts (it installs to
>> /opt/local/bin/i386-apple-darwin9-gcc-4.4.2 which is set on my PATH)
>> and used the following command
>> sudo ./configure CC=i386-apple-darwin9-gcc-4.4.2 && sudo make
>> CC=i386-apple-darwin9-gcc-4.4.2
>> Output at http://gist.github.com/280319
>>
>> Both builds seem to go wrong with the code posted below.
>> Does it look like my system is building pHash with the newer GCC compilers?
>>
>> Thanks,
>> Seb
>>
>> make  all-recursive
>> Making all in src
>> /bin/sh ../libtool --tag=CXX   --mode=compile g++-4.2 -DHAVE_CONFIG_H
>> -I. -I..   -I/usr/local/include -DHAVE_IMAGE_HASH=1
>> -DHAVE_VIDEO_HASH=1 -DHAVE_AUDIO_HASH=1 -Dcimg_use_jpeg  -O2
>> -ffast-math -O3 -MT audiophash.lo -MD -MP -MF .deps/audiophash.Tpo -c
>> -o audiophash.lo audiophash.cpp
>> libtool: compile:  g++-4.2 -DHAVE_CONFIG_H -I. -I..
>> -I/usr/local/include -DHAVE_IMAGE_HASH=1 -DHAVE_VIDEO_HASH=1
>> -DHAVE_AUDIO_HASH=1 -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT
>> audiophash.lo -MD -MP -MF .deps/audiophash.Tpo -c audiophash.cpp
>> -fno-common -DPIC -o .libs/audiophash.o
>> In file included from /usr/include/c++/4.0.0/backward/complex.h:31,
>>                 from ph_fft.h:32,
>>                 from audiophash.h:38,
>>                 from audiophash.cpp:25:
>> /usr/include/c++/4.0.0/backward/backward_warning.h:32:2: warning:
>> #warning This file includes at least one deprecated or antiquated
>> header. Please consider using one of the 32 headers found in section
>> 17.4.1.2 of the C++ standard. Examples include substituting the <X>
>> header for the <X.h> header for C++ includes, or <iostream> instead of
>> the deprecated header <iostream.h>. To disable this warning use
>> -Wno-deprecated.
>> In file included from /usr/include/c++/4.0.0/complex:49,
>>                 from /usr/include/c++/4.0.0/backward/complex.h:32,
>>                 from ph_fft.h:32,
>>                 from audiophash.h:38,
>>                 from audiophash.cpp:25:
>> /usr/include/c++/4.0.0/cmath:85: error: template with C linkage
>> /usr/include/c++/4.0.0/cmath: In function 'float std::abs(float)':
>>
>> On Wed, Dec 23, 2009 at 8:33 PM, Evan Klinger <eklinger at phash.org> wrote:
>>> Sebastian,
>>> There is a problem in older gcc releases with complex types. It looks
>>> like you are using gcc 4.0?
>>> Your feedback is very important to us as we'd like to make sure pHash
>>> builds successfully on Mac OS X, as we do not have Macs of our own to
>>> test with.
>>>
>>>
>>> On Wed, Dec 23, 2009 at 4:55 PM, Sebastian Gallese
>>> <sebastiangallese at gmail.com> wrote:
>>>> It sounds like building for the Mac is just causing more and more problems.
>>>> I need a new OS :(  I'll definitely look to install a GNU system to play
>>>> around with this.  I'll get that installed in the next few days and then
>>>> install PHash do I don't spam the email list serv with Mac stuff.
>>>>
>>>> If you have the desire to waste the hours away on a Mac box, I can give you
>>>> SSH access to an old Mac.  Just direct e-mail me.
>>>>
>>>> Right now, I'm only putting CImg.h in the pHash build folder.
>>>>
>>>> Under pHash-0.7.2
>>>> When using CImg 1.3.2
>>>>
>>>> This is the tail of the output for make ( full output here:
>>>> http://gist.github.com/262925 ):
>>>> audiophash.cpp: In function 'uint32_t* ph_audiohash(float*, int, int,
>>>> int&)':
>>>> audiophash.cpp:242: error: missing template arguments before 'double'
>>>> audiophash.cpp:242: error: expected `;' before 'double'
>>>> audiophash.cpp:305: error: 'pF' was not declared in this scope
>>>> audiophash.cpp:310: error: 'pF' was not declared in this scope
>>>> audiophash.cpp:310: error: 'cabs' was not declared in this scope
>>>> audiophash.cpp:347: error: 'pF' was not declared in this scope
>>>> make[2]: *** [audiophash.lo] Error 1
>>>> make[1]: *** [all-recursive] Error 1
>>>> make: *** [all] Error 2
>>>>
>>>>
>>>> Under pHash-0.7.1
>>>>
>>>> When using CImg 1.3.1, I'd get almost the same exact errors Harald got (
>>>> http://gist.github.com/262914 )
>>>>
>>>> When using CImg 1.3.2, I'd only get the last error from Harald's output
>>>> Making all in src
>>>> /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..
>>>> -I/usr/local/include -DHAVE_IMAGE_HASH=1 -DHAVE_VIDEO_HASH=1
>>>> -DHAVE_AUDIO_HASH=1 -Dcimg_use_jpeg  -O2 -ffast-math -O3 -MT pHash.lo -MD
>>>> -MP -MF .deps/pHash.Tpo -c -o pHash.lo pHash.cpp
>>>> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include
>>>> -DHAVE_IMAGE_HASH=1 -DHAVE_VIDEO_HASH=1 -DHAVE_AUDIO_HASH=1 -Dcimg_use_jpeg
>>>> -O2 -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp
>>>> -fno-common -DPIC -o .libs/pHash.o
>>>> pHash.cpp: In function 'MVPRetCode ph_query_mvptree(MVPFile*, DP*, int,
>>>> float, DP**, int*)':
>>>> pHash.cpp:1224: error: 'struct ph_mvp_file' has no member named 'int_pgsize'
>>>> make[2]: *** [pHash.lo] Error 1
>>>> make[1]: *** [all-recursive] Error 1
>>>> make: *** [all] Error 2
>>>>
>>>>
>>>> On Wed, Dec 23, 2009 at 4:18 PM, Evan Klinger <eklinger at phash.org> wrote:
>>>>>
>>>>> Great news, I'm glad that is working now.
>>>>>
>>>>> In regards to the Java bindings, you should pass --enable-java to the
>>>>> pHash configure script to build java support. You will need a Java SDK
>>>>> present on the system, mainly the jni.h file.
>>>>> You shouldn't try to build the Java bindings by directly running make
>>>>> in its directory, only from the top level make.
>>>>>
>>>>> On Wed, Dec 23, 2009 at 12:50 PM, Sebastian Gallese
>>>>> <sebastiangallese at gmail.com> wrote:
>>>>> > Wow, that was almost... too easy.  Thanks!
>>>>> >
>>>>> > Just built FFMpeg with the "--enable-shared" option and things fell into
>>>>> > place.
>>>>> >
>>>>> > One final question (sorry for bugging y'all so much).  My Java
>>>>> > experience
>>>>> > heavily outweighs the almost nothing I know about C, and I see that you
>>>>> > have
>>>>> > recently added "Java bindings" in the Java folder of PHash.
>>>>> >
>>>>> > Is there anything special I need to do to get this to work?
>>>>> >
>>>>> > I tried to run "sudo make" in that directory, but I received this error
>>>>> >
>>>>> > pHash-jni.cpp:578: error: 'JNIEXPORT' does not name a type
>>>>> > make: *** [pHash-jni.lo] Error
>>>>> >
>>>>> > ( Full output @ http://gist.github.com/262764 )
>>>>> >
>>>>> > I then just added the pHash.java file to my Eclipse Java project along
>>>>> > with
>>>>> > the other files in that java folder.
>>>>> >
>>>>> > I went ahead and tried to run the following Java code "pHash mypHash =
>>>>> > new
>>>>> > pHash();" and I received this error:
>>>>> >
>>>>> > java.lang.UnsatisfiedLinkError: no pHash-jni in java.library.path
>>>>> >
>>>>> > I have a feeling this part might be over my head, and it might require
>>>>> > too
>>>>> > much explanation to get this to work, so no worries if this is beyond my
>>>>> > current skill level.  I'll take a read at
>>>>> > http://developer.apple.com/java/jniuniversal.html and see where that
>>>>> > gets
>>>>> > me.
>>>>> >
>>>>> > If you have any pointers or tips, that would be incredible.  Sorry for
>>>>> > fumbling around in the dark.
>>>>> >
>>>>> > Thanks again,
>>>>> >
>>>>> > Seb
>>>>> >
>>>>> > On Wed, Dec 23, 2009 at 2:26 PM, Evan Klinger <eklinger at phash.org>
>>>>> > wrote:
>>>>> >>
>>>>> >> Sebastian,
>>>>> >> I believe FFmpeg needs to be built specifically with shared libraries
>>>>> >> enabled (as part of the ./configure). That is probably why you are
>>>>> >> missing the .so files but you do have the static archives (.a) files.
>>>>> >> Can you see if the package you installed contains the shared
>>>>> >> libraries?
>>>>> >>
>>>>> >>
>>>>> >> On Wed, Dec 23, 2009 at 11:14 AM, Sebastian Gallese
>>>>> >> <sebastiangallese at gmail.com> wrote:
>>>>> >> > Thank you for your response!
>>>>> >> >
>>>>> >> > Let me pretext the following by saying that I am OK with running
>>>>> >> > PHash
>>>>> >> > without video support (I'd like to play around with images).
>>>>> >> >
>>>>> >> > I'm also open to using a Windows or Linux system if this is a problem
>>>>> >> > with
>>>>> >> > FFMpeg on the Mac.  If you know of a specific version of Windows or a
>>>>> >> > distribution of Linux that works well with this, I can install that.
>>>>> >> >
>>>>> >> > Lastly, let me know if you compile FFMpeg with any special options (I
>>>>> >> > just
>>>>> >> > did the default install).
>>>>> >> >
>>>>> >> > And now onto my snooping around....
>>>>> >> >
>>>>> >> > On Macs, I found out we have .dylibs instead of .so files.
>>>>> >> >
>>>>> >> > I found a libavcodec.dylib which points to libavcodec.52.20.0.dylib
>>>>> >> > This is from the FFMpeg files I installed from MacPorts, located in
>>>>> >> > /opt/local/var/macports/software/ffmpeg/0.5_5/opt/local/lib
>>>>> >> >
>>>>> >> > Nothing shows up when I run "strings libavcodec.dylib | grep
>>>>> >> > avcodec_alloc_frame"
>>>>> >> >
>>>>> >> > When I run "strings libavcodec.dylib | grep avcodec", I get the
>>>>> >> > following:
>>>>> >> >
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ strings libavcodec.dylib |
>>>>> >> > grep
>>>>> >> > avcodec
>>>>> >> > Compiler did not align stack variables. Libavcodec has been
>>>>> >> > miscompiled
>>>>> >> > and may be very slow or crash. This is not a bug in libavcodec,
>>>>> >> > pic->data[0]!=NULL in avcodec_default_get_buffer
>>>>> >> > insufficient thread locking around avcodec_open/close()
>>>>> >> > libavcodec/motion_est.c
>>>>> >> > libavcodec/motion_est_template.c
>>>>> >> > libavcodec/ratecontrol.c
>>>>> >> > libavcodec/dvdsubenc.c
>>>>> >> > libavcodec/flacdec.c
>>>>> >> > FFmpeg v%d.%d.%d / libavcodec build: %d
>>>>> >> > libavcodec/mpegvideo_xvmc.c
>>>>> >> > libavcodec/qcelpdec.c
>>>>> >> > libavcodec/snow.c
>>>>> >> > libavcodec/svq1enc.c
>>>>> >> > libavcodec/vc1.c
>>>>> >> > libavcodec/vorbis_dec.c
>>>>> >> > libavcodec/vorbis_enc.c
>>>>> >> > libavcodec/wmaenc.c
>>>>> >> > libavcodec/libdiracenc.c
>>>>> >> >
>>>>> >> > I found nothing similar to libavcodec in /usr/lib
>>>>> >> >
>>>>> >> > In the directory /usr/local/lib, I found libavcodec.a, which outputs
>>>>> >> > the
>>>>> >> > following:
>>>>> >> >
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ strings libavcodec.a | grep
>>>>> >> > avcodec_alloc_frame
>>>>> >> > _avcodec_alloc_frame
>>>>> >> > avcodec_alloc_frame
>>>>> >> > avcodec_alloc_frame
>>>>> >> >
>>>>> >> > These are the other files I found in /usr/local/lib:
>>>>> >> >
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ pwd
>>>>> >> > /usr/local/lib
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ ls -l
>>>>> >> > total 60920
>>>>> >> > drwxr-xr-x  84 root  wheel      2856 Nov 17 03:20 codecs
>>>>> >> > -rw-r--r--   1 root  wheel  22336032 Dec 23 10:32 libavcodec.a
>>>>> >> > -rw-r--r--   1 root  wheel     31424 Dec 23 10:32 libavdevice.a
>>>>> >> > -rw-r--r--   1 root  wheel   6686464 Dec 23 10:32 libavformat.a
>>>>> >> > -rw-r--r--   1 root  wheel    226080 Dec 23 10:32 libavutil.a
>>>>> >> > -rwxr-xr-x   1 root  wheel    254036 Dec 22 20:05 libjpeg.7.dylib
>>>>> >> > -rw-r--r--   1 root  wheel   1160680 Dec 22 20:05 libjpeg.a
>>>>> >> > lrwxr-xr-x   1 root  wheel        15 Dec 22 20:05 libjpeg.dylib ->
>>>>> >> > libjpeg.7.dylib
>>>>> >> > -rwxr-xr-x   1 root  wheel       912 Dec 22 20:05 libjpeg.la
>>>>> >> > -rw-r--r--   1 root  wheel    469592 Dec 23 10:32 libswscale.a
>>>>> >> > drwxr-xr-x   8 root  wheel       272 Dec 23 10:32 pkgconfig
>>>>> >> >
>>>>> >> > I also found the shared library in a folder for MPlayer on my
>>>>> >> > computer,
>>>>> >> > but
>>>>> >> > I received an odd response (perhaps that is the response I should
>>>>> >> > get?):
>>>>> >> >
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ pwd
>>>>> >> > /Applications/MPlayer OSX
>>>>> >> >
>>>>> >> >
>>>>> >> > Extended.app/Contents/Resources/External_Binaries/mplayer.app/Contents/MacOS/lib
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ strings libavcodec.dylib |
>>>>> >> > grep
>>>>> >> > avcodec_alloc_frame
>>>>> >> > strings: for architecture x86_64 object: libavcodec.dylib malformed
>>>>> >> > object
>>>>> >> > (unknown load command 5)
>>>>> >> >
>>>>> >> > After searching for all of these libavcodec, I figured it couldn't
>>>>> >> > hurt
>>>>> >> > to
>>>>> >> > try to place a couple of them in the /usr/lib path and try to
>>>>> >> > ./configure
>>>>> >> > pHash again.  So I placed each of the libavcodec's, one at a time, in
>>>>> >> > /usr/lib using the following type of commands:
>>>>> >> >
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ cd
>>>>> >> > /opt/local/var/macports/software/ffmpeg/0.5_5/opt/local/lib
>>>>> >> > macbook-de-sebastian-gallese:lib kdge$ sudo ln -s libavcodec.dylib
>>>>> >> > /usr/lib/libavcodec.so && sudo ln -s libavcodec.dylib
>>>>> >> > /usr/lib/libavcodec.dylib
>>>>> >> >
>>>>> >> > and for each different libavcodec, I still received this in the pHash
>>>>> >> > ./configure
>>>>> >> >
>>>>> >> > checking whether FFmpeg is present... checking for
>>>>> >> > avcodec_alloc_frame
>>>>> >> > in
>>>>> >> > -lavcodec... no
>>>>> >> > configure: error:
>>>>> >> >
>>>>> >> > *** libavcodec not found.
>>>>> >> >
>>>>> >> > Thanks,
>>>>> >> > -Seb
>>>>> >> >
>>>>> >> > On Wed, Dec 23, 2009 at 12:13 PM, Evan Klinger <eklinger at phash.org>
>>>>> >> > wrote:
>>>>> >> >>
>>>>> >> >> Sebastian,
>>>>> >> >> Can you please locate the libavcodec.so library on your system and
>>>>> >> >> run:
>>>>> >> >>
>>>>> >> >> strings libavcodec.so|grep avcodec_alloc_frame
>>>>> >> >>
>>>>> >> >> If that string is present, please also make sure the library is in a
>>>>> >> >> standard system path where the linker can find it. In Linux this is
>>>>> >> >> usually /usr/lib or /usr/local/lib, although the latter requires a
>>>>> >> >> change to /etc/ld.so.conf to recognize libraries in /usr/local/lib.
>>>>> >> >>
>>>>> >> >> Thanks
>>>>> >> >> Evan
>>>>> >> >>
>>>>> >> >> On Wed, Dec 23, 2009 at 8:14 AM, Sebastian Gallese
>>>>> >> >> <sebastiangallese at gmail.com> wrote:
>>>>> >> >> > Hello,
>>>>> >> >> >
>>>>> >> >> > I'm having trouble compiling Phase 0.7.1 on Mac OS X 10.5.8
>>>>> >> >> >
>>>>> >> >> > Please excuse me if I'm missing something obvious.
>>>>> >> >> >
>>>>> >> >> > I first installed FFMpeg from MacPorts.  I then downloaded CImg
>>>>> >> >> > 1.3.2
>>>>> >> >> > and
>>>>> >> >> > placed CImg.h and the plugins and resources folders inside the
>>>>> >> >> > Phase
>>>>> >> >> > 0.7.1
>>>>> >> >> > folder.
>>>>> >> >> >
>>>>> >> >> > Upon compiling, I was then prompted to install FFMpeg.  I figured
>>>>> >> >> > the
>>>>> >> >> > path
>>>>> >> >> > that MacPort installs to can be funky, so I just downloaded the
>>>>> >> >> > FFMpeg
>>>>> >> >> > source and installed it from the GIT code.  While compiling, the
>>>>> >> >> > program
>>>>> >> >> > returned the output below.
>>>>> >> >> >
>>>>> >> >> > If you need any more information about where things are installed
>>>>> >> >> > or
>>>>> >> >> > output,
>>>>> >> >> > I'll post it to the list-serv.
>>>>> >> >> >
>>>>> >> >> > It looks like people have had problems compiling with Mac OS X in
>>>>> >> >> > the
>>>>> >> >> > past.
>>>>> >> >> > I'd be happy to try to resolve this issue, but I can also move to
>>>>> >> >> > a
>>>>> >> >> > Windows
>>>>> >> >> > machine or install a flavor of Linux if you think that might be
>>>>> >> >> > easier
>>>>> >> >> > to
>>>>> >> >> > get this to work.
>>>>> >> >> >
>>>>> >> >> > Any help is great!
>>>>> >> >> >
>>>>> >> >> > Thanks,
>>>>> >> >> >
>>>>> >> >> > Seb
>>>>> >> >> >
>>>>> >> >> > I received the following error:
>>>>> >> >> >
>>>>> >> >> > [...]
>>>>> >> >> >
>>>>> >> >> > checking whether the gcj linker
>>>>> >> >> > (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) supports shared
>>>>> >> >> > libraries...
>>>>> >> >> > yes
>>>>> >> >> > checking how to hardcode library paths into programs... immediate
>>>>> >> >> >
>>>>> >> >> > *** Configuring image hash ***
>>>>> >> >> >
>>>>> >> >> > checking CImg.h usability... no
>>>>> >> >> > checking CImg.h presence... no
>>>>> >> >> > checking for CImg.h... no
>>>>> >> >> > checking whether CImg.h is in the current or src directory.... yes
>>>>> >> >> >
>>>>> >> >> > *** Configuring video Hash ***
>>>>> >> >> >
>>>>> >> >> > checking whether FFmpeg is present... checking for
>>>>> >> >> > avcodec_alloc_frame
>>>>> >> >> > in
>>>>> >> >> > -lavcodec... no
>>>>> >> >> > configure: error:
>>>>> >> >> >
>>>>> >> >> > *** libavcodec not found.
>>>>> >> >> > You need FFmpeg. Get it at <http://ffmpeg.org/>
>>>>> >> >> >
>>>>> >> >> >
>>>>> >> >> > _______________________________________________
>>>>> >> >> > pHash-support mailing list
>>>>> >> >> > pHash-support at lists.phash.org
>>>>> >> >> > http://lists.phash.org/listinfo.cgi/phash-support-phash.org
>>>>> >> >> >
>>>>> >> >> >
>>>>> >> >> _______________________________________________
>>>>> >> >> pHash-support mailing list
>>>>> >> >> pHash-support at lists.phash.org
>>>>> >> >> http://lists.phash.org/listinfo.cgi/phash-support-phash.org
>>>>> >> >
>>>>> >> >
>>>>> >
>>>>> >
>>>>
>>>>
>>>
>>
>



More information about the pHash-support mailing list