#21014 closed defect (fixed)
OpenCV 1.0.0 does not build on snow leopard
Reported by: | grundmann.matthias@… | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.8.0 |
Keywords: | LP64 | Cc: | stante@…, grundmann.matthias@…, njbutko@…, macports.b@…, n.a.hawes@…, shane.ramey@…, cronuxs@…, yakoh@…, xmitchx@…, takashi@…, bgrupe27, mail@…, chbrosso@…, j.a.0770@…, mf2k (Frank Schima), nerdling (Jeremy Lavergne), malaperle@…, ryanlei750328@… |
Port: | opencv |
Description
Currently, OpenCV does not compile on SnowLeopard for architecture x86_64.
First it returns errors for dummy.cpp of the form: dummy.cpp:1: error: CPU you selected does not support x86-64 instruction set
These errors are caused by the -march=prescott setting. I can get around those errors by adding
-march=nocona -mtune=generic
to the configure.cxxflags-append section of the Portfile.
However, I get a lot of errors in the
window_carbon.cpp file, like
Command output: window_carbon.cpp:296: error: 'SetWindowBounds' was not declared in this scope
:296: error: 'SetWindowBounds' was not declared in this scope
I think this problem will be much harder to solve, when I understand it correctly there is no 64bit carbon, only 64 bit cocoa.
Any input would be appreciated.
Attachments (4)
Change History (57)
comment:1 Changed 15 years ago by nerdling (Jeremy Lavergne)
Keywords: | LP64 added |
---|---|
Owner: | changed from macports-tickets@… to stante@… |
Port: | opencv added |
Priority: | High → Normal |
Changed 15 years ago by grundmann.matthias@…
Attachment: | Portfile.variant.diff added |
---|
Changed 15 years ago by grundmann.matthias@…
Attachment: | Portfile.implicit.diff added |
---|
Patched port file with implicit darwin10 target. There is no distinction between 32bit and 64bit though. platform darwin x86_64 didn't work for me.
comment:2 follow-up: 3 Changed 15 years ago by grundmann.matthias@…
Replying to grundmann.matthias@…:
Currently, OpenCV does not compile on SnowLeopard for architecture x86_64.
First it returns errors for dummy.cpp of the form: dummy.cpp:1: error: CPU you selected does not support x86-64 instruction set
These errors are caused by the -march=prescott setting. I can get around those errors by adding
-march=nocona -mtune=generic
to the configure.cxxflags-append section of the Portfile.
However, I get a lot of errors in the
window_carbon.cpp file, like
Command output: window_carbon.cpp:296: error: 'SetWindowBounds' was not declared in this scope
:296: error: 'SetWindowBounds' was not declared in this scope
I think this problem will be much harder to solve, when I understand it correctly there is no 64bit carbon, only 64 bit cocoa.
Any input would be appreciated.
Added some patched portfiles, that remove quicktime and carbon support. Compiles and Installs in 64bit on snowleopard.
comment:3 follow-up: 6 Changed 15 years ago by njbutko@…
Replying to grundmann.matthias@…:
Added some patched portfiles, that remove quicktime and carbon support. Compiles and Installs in 64bit on snowleopard.
Does this break key features of OpenCV? As I understand it, Quicktime is necessary for accessing the webcam and for processing video. Carbon is probably used for graphical display. For my purposes, For me, a cross-platform mechanism for reading videos, accessing the webcam, and displaying images to screen are the reason OpenCV is indispensable, and all the other facilities are just convenient libraries.
In this case, if a user (such as myself) types "port install opencv" the default behavior shouldn't be "build in 64 bit mode and break only those key features necessary to still compile," the default behavior should be "Build as many dependent ports as possible in universal 32- and 64- bit mode, build opencv in 32 bit mode, and warn the user in big flashy letters that 64-bit opencv is not currently supported, all linking programs will need to be compiled with the -arch i386 flag".
comment:6 Changed 15 years ago by grundmann.matthias@…
Replying to njbutko@…:
Replying to grundmann.matthias@…:
Added some patched portfiles, that remove quicktime and carbon support. Compiles and Installs in 64bit on snowleopard.
Does this break key features of OpenCV? As I understand it, Quicktime is necessary for accessing the webcam and for processing video. Carbon is probably used for graphical display. For my purposes, For me, a cross-platform mechanism for reading videos, accessing the webcam, and displaying images to screen are the reason OpenCV is indispensable, and all the other facilities are just convenient libraries.
In this case, if a user (such as myself) types "port install opencv" the default behavior shouldn't be "build in 64 bit mode and break only those key features necessary to still compile," the default behavior should be "Build as many dependent ports as possible in universal 32- and 64- bit mode, build opencv in 32 bit mode, and warn the user in big flashy letters that 64-bit opencv is not currently supported, all linking programs will need to be compiled with the -arch i386 flag".
Agreed, this should not be default behavior on snow leopard. Without wanting to argue about the different ways OpenCV is used by developers, there are users ( like me ;) ) that would sacrifice webcam support for 64 bit compilation at this time. This should of course not be a permanent solution, but rather a workaround until somebody ports the OpenCV source to play nice with qtkit under mac instead of the current quicktime API that is used (qtkit runs the old 32bit quicktime in a separate process and allows 64bit applications to access it).
Regarding the graphical UI, the posted version uses gtk instead of carbon which is fully 64bit capable. I only found it to be a little bit slower, i.e. I had to increase the delay in cvWaitKey from 1 to something like 20 and create a delay of around 200ms after window creation (takes a little while until x11 is up and running).
I attached a new patch for the portfile, that replaces the previous darwin10 behavior with the variant sl_64bit_21014 and is labeled clearly as a workaround solution that removes quicktime support.
Changed 15 years ago by grundmann.matthias@…
Attachment: | Portfile-sl_64bit_21014.diff added |
---|
Workaround that allows opencv to be compiled in 64 bit mode. Removes quicktime support.
comment:7 follow-up: 8 Changed 15 years ago by njbutko@…
Is there a way to have MacPorts build OpenCv in 32 bit mode? e.g. a variant sl_32bit? I guess this variant would need to install OpenCV's dependencies as universal variants.
I've never fooled around with port files beyond "port install foo", which has never been a problem before all this Snow Leopard madness.
comment:8 follow-ups: 9 13 Changed 15 years ago by grundmann.matthias@…
Replying to njbutko@…:
Is there a way to have MacPorts build OpenCv in 32 bit mode? e.g. a variant sl_32bit? I guess this variant would need to install OpenCV's dependencies as universal variants.
I've never fooled around with port files beyond "port install foo", which has never been a problem before all this Snow Leopard madness.
You can force macports to build everything in 32 bit mode on snow leopard and shouldn't (= I expect, but I haven't tested) have any problems. Macports inherits the build architecture from gcc, which depending on your machine (e.g. Core 2 vs. Core Duo) is set to i386 or x86_64 on snow leopard. You can set it explicitly to i386 (=32 bit mode) by editing the macports.conf file.
For example:
vim /opt/local/etc/macports/macports.conf
Search for build_arch and uncomment the line.
comment:9 Changed 15 years ago by shane.ramey@…
Replying to grundmann.matthias@…:
For example:
vim /opt/local/etc/macports/macports.conf
Search for build_arch and uncomment the line.
I did this, but I get this odd error:
---> Computing dependencies for opencv ---> Building opencv Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_opencv/work/opencv-1.0.0" && /usr/bin/make -j2 all " returned error 2 Command output: {standard input}:16148:non-relocatable subtraction expression, "LC4" minus "L00000000029$pb" {standard input}:16148:symbol: "L00000000029$pb" can't be undefined in a subtraction expression
and several more errors just like the two lines directly above. I'm running a mac mini with snow leopard in 32 bit mode. I've tried compiling from source and I get the same issue. I don't even know what this means for me to begin trying to fix it. Any help would be greatly appreciated.
comment:13 Changed 15 years ago by njbutko@…
You can force macports to build everything in 32 bit mode on snow leopard and shouldn't (= I expect, but I haven't tested) have any problems. Macports inherits the build architecture from gcc, which depending on your machine (e.g. Core 2 vs. Core Duo) is set to i386 or x86_64 on snow leopard. You can set it explicitly to i386 (=32 bit mode) by editing the macports.conf file.
I tried this and didn't even get to the opencv stage -- build failed in fontconfig.
comment:18 follow-up: 19 Changed 15 years ago by njbutko@…
According to Ticket #21215 build_arch is really unreliable and should be avoided when possible.
Would it be possible to have OpenCV's default install script compile all of its dependencies in universal mode, and then compile OpenCV in 32 bit mode?
comment:19 follow-up: 22 Changed 15 years ago by grundmann.matthias@…
Replying to njbutko@…:
According to Ticket #21215 build_arch is really unreliable and should be avoided when possible.
Would it be possible to have OpenCV's default install script compile all of its dependencies in universal mode, and then compile OpenCV in 32 bit mode?
So my assumption about the 32bit mode being easy was wrong ;). As I see it you could try this, could someone check whether all of opencv's dependencies build with +universal?
comment:20 Changed 15 years ago by grundmann.matthias@…
Because I get some requests about how to apply the patch ...
Check where you installed macports, that is usually /opt/local/ Locate the Portfile for OpenCV, for me that is at
/opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/opencv
now apply the third patch (Portfile-sl_64bit_21014.diff) by executing
sudo patch Portfile -i ~/Downloads/Portfile-sl_64bit_21014.diff
in the above directory (adjust the last path accordingly to your download location)
When you execute port variants opencv you should see the sl_64bit_21014 variant. Now install opencv with
sudo install opencv +sl_64bit_21014
Hope that helps.
comment:21 Changed 15 years ago by grundmann.matthias@…
The last command should be
sudo port install opencv +sl_64bit_21014
comment:22 follow-up: 23 Changed 15 years ago by njbutko@…
So my assumption about the 32bit mode being easy was wrong ;). As I see it you could try this, could someone check whether all of opencv's dependencies build with +universal?
All of them have universal variants. I am checking now whether they all build.
$ port deps opencv Full Name: opencv @1.0.0 Library Dependencies: gtk2, zlib, jpeg, libpng, tiff $ port variants gtk2 zlib jpeg libpng tiff gtk2 has the variants: darwin_7: Platform variant, selected automatically darwin_8: Platform variant, selected automatically no_x11: Disable support for X11 quartz: Enable Quartz rendering * conflicts with x11 * requires no_x11 universal: Build for multiple architectures [+]x11: Enable rendering in X11 (default) * conflicts with quartz zlib has the variants: universal: Build for multiple architectures jpeg has the variants: universal: Build for multiple architectures libpng has the variants: universal: Build for multiple architectures tiff has the variants: macosx: Platform variant, selected automatically universal: Build for multiple architectures
comment:23 Changed 15 years ago by njbutko@…
All of them have universal variants. I am checking now whether they all build.
Building OpenCV's dependencies as universal variants succeeds.
When "build_arch" is commented out in macports.conf, the one command "port install gtk2 +universal" succeeds, and installs all of OpenCV's dependencies.
comment:24 Changed 15 years ago by njbutko@…
Does anyone know how to force MacPorts to build in 32 bit mode in a portfile? I tried making a variant that added "-arch i386" to cxxflags, and now make is calling "-arch i386 -arch x86_64" and is complaining about multiple architectures being set.
All combinations of configure.*-delete "-arch x86_64" don't remove the second -arch flag.
comment:29 follow-up: 31 Changed 15 years ago by mail@…
1.2.0 is out, see http://sourceforge.net/projects/opencvlibrary/files/. Probably we should switch directly to it.
comment:31 follow-up: 32 Changed 15 years ago by njbutko@…
Replying to mail@…:
1.2.0 is out, see http://sourceforge.net/projects/opencvlibrary/files/. Probably we should switch directly to it.
This seems to be lacking the necessary "configure.in" scripts to properly build?
The "INSTALL" says "Requires quicktime and carbon" which suggests that they may not have addressed any of the important issues in this thread.
comment:32 Changed 15 years ago by mail@…
Replying to njbutko@…:
Replying to mail@…:
1.2.0 is out, see http://sourceforge.net/projects/opencvlibrary/files/. Probably we should switch directly to it.
This seems to be lacking the necessary "configure.in" scripts to properly build?
The prefered build method is now cmake, i think the port should also switch to cmake.
The "INSTALL" says "Requires quicktime and carbon" which suggests that they may not have addressed any of the important issues in this thread.
We can switch off QT and HighGui, see http://tech.groups.yahoo.com/group/OpenCV/message/66266. The other Option for HighGui is using the gtk variant. I will give this a try in the next days...
comment:33 Changed 15 years ago by mail@…
Here we are. I have built manually, not with MacPorts to create the patches...
- Unpack OpenCV-1.2.0.tar.gz and step into the dir.
- Patch CMakeList.txt
--- CMakeLists.txt 2009-09-14 23:29:55.000000000 +0200 +++ CMakeLists.txt.patched 2009-09-17 15:23:52.000000000 +0200 @@ -273,7 +273,7 @@ endmacro() if(UNIX) - if(NOT APPLE) + #if(NOT APPLE) if(WITH_GTK) CHECK_MODULE(gtk+-2.0 HAVE_GTK) CHECK_MODULE(gthread-2.0 HAVE_GTHREAD) @@ -286,7 +286,7 @@ else() set(HAVE_GSTREAMER FALSE) endif() - endif() + #endif() if(WITH_UNICAP) CHECK_MODULE(libunicap HAVE_UNICAP_) @@ -836,7 +836,7 @@ endif() if(UNIX) -if(NOT APPLE) +#if(NOT APPLE) message(STATUS "") message(STATUS " GUI: ") message(STATUS " GTK+ 2.x: ${HAVE_GTK}") @@ -855,7 +855,7 @@ message(STATUS " TIFF: build") message(STATUS " JASPER: build") endif() -endif() +#endif() message(STATUS "") message(STATUS " Video I/O: ") message(STATUS " DC1394 1.x: ${HAVE_DC1394}")
and src/highgui/CMakeLists.txt
--- src/highgui/CMakeLists.txt 2009-09-14 23:29:54.000000000 +0200 +++ src/highgui/CMakeLists.txt.patched 2009-09-17 15:25:36.000000000 +0200 @@ -112,8 +112,8 @@ endif() if(APPLE) - add_definitions(-DHAVE_QUICKTIME=1 -DHAVE_CARBON=1 -DHAVE_IMAGEIO=1) - set(highgui_srcs ${highgui_srcs} window_carbon.cpp cvcap_qt.cpp) + #add_definitions(-DHAVE_QUICKTIME=1 -DHAVE_CARBON=1 -DHAVE_IMAGEIO=1) + #set(highgui_srcs ${highgui_srcs} window_carbon.cpp cvcap_qt.cpp) endif(APPLE) source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs}) @@ -198,7 +198,7 @@ endif() if(APPLE) - target_link_libraries(${the_target} "-framework Carbon -framework CoreFoundation -framework QuickTime -framework QuartzCore") + target_link_libraries(${the_target} "-framework CoreFoundation -framework QuartzCore") endif() install(TARGETS ${the_target}
- create a build dir and step into it
mkdir build cd build
- Run cmake and make
cmake .. make make test
This builds OpenCV without Quicktime and highgui as gtk-version.
What is missing:
- I have never used cmake together with MacPorts. Is there an example for doing that? For example setting the prefix...
- I don't have tested the gtk-highgui, because i don't have a real testprogram for highgui.
comment:34 Changed 15 years ago by njbutko@…
Here is a simple test program for gui+capture, call it TestCapture.cpp. The usage is "TestCapture [optional-path-to-video-file" -- it will either open a webcam and show you the video from that, or if you provide it with a video file, it will play back that video file for you.
/* * TestCapture.cpp * OpenCV * */ #include <cv.h> #include <cxcore.h> #include <highgui.h> #include <iostream> using namespace std; const char * WINDOW_NAME = "Playback" ; int usingCamera; int main (int argc, char * const argv[]) { int key=0; CvCapture* camera = NULL; if (argc < 2) { cout << "Getting Camera " << CV_CAP_ANY << endl; camera = cvCreateCameraCapture (CV_CAP_ANY); usingCamera = 1; } else { if (argv[1][0] == '-') { cout << "An simple program to display a video or camera output." << endl << endl << "Usage: " << endl << " >> TestCapture [optional-path-to-movie-file]" << endl << endl << "If no optional path to a movie file is provided, attempts to use an attached" << endl << " camera for input. Otherwise, attempts to use the movie file for input." << endl << endl; return 0; } cout << "Getting Movie " << argv[1] << endl; camera = cvCreateFileCapture(argv[1]); usingCamera = 0; } if (! camera) { cout << "Failed to get input from a video capture source." << endl << endl << "Usage: " << endl << " >> TestCapture [optional-path-to-movie-file]" << endl << endl << "If no optional path to a movie file is provided, attempts to use an attached" << endl << " camera for input. Otherwise, attempts to use the movie file for input." << endl << endl; return 0; } cvNamedWindow (WINDOW_NAME, CV_WINDOW_AUTOSIZE); IplImage * current_frame = cvQueryFrame (camera); while (key != 'q' && key != 'Q') { //Loop until user enters 'q' current_frame = cvQueryFrame (camera); if (current_frame==NULL) { //implies reached camera end cvSetCaptureProperty(camera, CV_CAP_PROP_POS_FRAMES, 0); //reset camera to beginning current_frame = cvQueryFrame (camera) ; if (current_frame==NULL) //shouldn't happen break; } cvShowImage(WINDOW_NAME, current_frame); } cvReleaseCapture(&camera); cvReleaseImage(¤t_frame); }
Changed 15 years ago by njbutko@…
Attachment: | TestCapture.cpp added |
---|
comment:35 Changed 15 years ago by mail@…
HighGui works with GTK (the XServer is started, the window pops up with the image). Tested with Example Code from the OpenCV book ch2_ex2_1.cpp. No camera tested.
comment:37 Changed 15 years ago by jdv85 (Jonas Due Vesterheden)
Cc: | jonasduevesterheden@… added |
---|
Cc Me!
comment:38 Changed 15 years ago by jdv85 (Jonas Due Vesterheden)
Cc: | jonasduevesterheden@… removed |
---|
Cc Me!
comment:39 Changed 15 years ago by njbutko@…
The Yahoo OpenCV User Group has instructions for how to build OpenCV 2.0 using CMake here. The idea is to use the older version of g++ (4.0). Presumably this will work for OpenCV 1.0 also, and will cause 32-bit libraries to be built that will properly link to Quicktime and Carbon libraries.
From the post:
OpenCV 1.2 successfully builds on Snow leopard (10.6) if CMAKE_CXX_COMPILER and CMAKE_C_COMPILER are respectively set to /usr/bin/g++-4.0 and /usr/bin/gcc-4.0 (same approach as Jason's below) And indeed programs only compile successfully when using the old compiler. (aka. /usr/bin/g++-4.0) When using the gcc 4.2 compiler supplied in 10.6 - the errors come out of window_carbon.cpp (a boatload of them - it complains of missing symbols, which I think a little aggressive debugging can easily fix)
comment:41 Changed 15 years ago by njbutko@…
As of Sept. 30 OpenCV 2.0 is "Released." I don't know how this is different from the "1.2 Beta Release" from two weeks ago, but you can download the release here:
http://sourceforge.net/projects/opencvlibrary/files/
This builds for me on Snow Leopard when following the instructions on the OpenCV website:
From http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port:
Building using the new CMake build system =========================== mkdir opencv/build cd opencv/build cmake .. ccmake . If you are on Snow Leopard, hit 't' to toggle advanced mode. Set CMAKE_CXX_COMPILER="/usr/bin/g++-4.0" and CMAKE_C_COMPILER="/usr/bin/gcc-4.0" and then continue with the following steps. Hit 'c' to configure. Hit 'g' to generate the config file and exit ccmake. make -j8 sudo make install
All of my OpenCV programs seem to work as expected, including the carbon windowing system and the quicktime video capture.
The caveat is that when you build programs linking to OpenCV, you must pass in the -arch i386 flag to g++ (build explicitly in 32-bit mode).
comment:42 follow-up: 43 Changed 15 years ago by mf2k (Frank Schima)
Cc: | macsforever2000@… added |
---|
Cc Me!
comment:43 follow-up: 44 Changed 15 years ago by ajb78@…
comment:44 Changed 15 years ago by grundmann.matthias@…
Replying to ajb78@…:
Replying to macsforever2000@…:
Cc Me!
Any news on this?
I managed to get OpenCV 2.0 to compile in 64 bit mode, again by substituting carbon with cocoa and deactivating quicktime support (it has ffmpeg support though, so besides the webcam issue most should be fine) and some minor tweaks. I don't know if the maintainer wants to upload the prepared Portfile into macports. In the mean-time I set up a easy tutorial on my blog (http://blog.mgrundmann.com/?p=5), you can find the Portfile for OpenCV 2.0 there as well.
comment:48 Changed 15 years ago by rob@…
On http://code.google.com/p/opencv-cocoa/ you'll find a project that has implemented (parts of?) highgui in cocoa, enabling the use of OpenCV in 64 bit applications with support for CvWindows and capture from e.g. camera via QuickTime. Reading from/writing to movie files goes via ffmpeg.
This project can be compiled with all prequisite libraries sourced from macports
comment:49 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Owner: | changed from stante@… to ryandesign@… |
---|---|
Status: | new → assigned |
comment:50 follow-ups: 51 52 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | stante@… added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Updated and fixed in r64069.
comment:51 Changed 15 years ago by ryanlei750328@…
Replying to ryandesign@…:
Updated and fixed in r64069.
Cheers and many thanks! The revision log says: "ensure 32-bit-only system libs like quicktime and carbon don't get used when building 64-bit", and "ensure python stuff doesn't get built", but somehow it's finally fixed.
May I ask two OpenCV questions:
1. Is there any way to get Logitech QuickCam Vision Pro for Mac to work with OpenCV on Snow Leopard?
I used to do with the "make_framework.sh" script which successfully detects iSight via the following configurations:
HighGUI configuration ================================================ Windowing system -------------- Use Carbon / Mac OS X: yes Use gtk+ 2.x: no Use gthread: no Image I/O --------------------- Use ImageIO / Mac OS X: yes Use libjpeg: no Use zlib: no Use libpng: no Use libtiff: no Use libjasper: no Use libIlmImf/OpenEXR: no Video I/O --------------------- Use QuickTime / Mac OS X: yes Use xine: no Use gstreamer: no Use ffmpeg: no Use dc1394 & raw1394: no Use dc1394_v2 & raw1394: no Use v4l: no Use v4l2: no Use unicap: no
Now that quicktime and carbon are dropped, how can we handle image/video/camera I/O and GUI? Both the Macports and CMake ways.
2. Can someone contribute to the Mac_OS_X_OpenCV_Port page on willowgarage?
I mean the section Building using the new CMake build system of the page Mac_OS_X_OpenCV_Port. The instructions are not enough and are often outdated. I've struggling with the latest SVN using CMake. Basically I need some detailed help on "ccmake settings" and "what to do in Xcode" and "prerequisites for image/video support". Currently I have the following errors:
highgui/ffmpeg/avcodec.h: No such file or directory highgui/cvcap_ffmpeg.cpp:90:31: error: ffmpeg/avformat.h: No such file or directory highgui/cvcap_ffmpeg.cpp:152: error: 'CODEC_ID_H264' was not declared in this scope
Installing ffmpeg-devel from Macports or building ffmpeg from SVN does not solve this problem. For the latter, I did move the headers to /usr/local/include/ffmpeg and the libraries to /usr/local/lib, but I still got a "file not found" error.
Thanks again.
comment:52 follow-up: 53 Changed 15 years ago by ryanlei750328@…
Replying to ryandesign@…:
Updated and fixed in r64069.
The latest port results in the following errors:
$ sudo port install -d opencv Password: ---> Computing dependencies for opencv ---> Building opencv Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_opencv/work/OpenCV-2.0.0" && /usr/bin/make -j2 all " returned error 2 Command output: ranlib: file: .libs/lib_cvaux.a(lib_cvaux_la-decomppoly.o) has no symbols ranlib: file: .libs/lib_cvaux.a(lib_cvaux_la-enmin.o) has no symbols ranlib: file: .libs/lib_cvaux.a(lib_cvaux_la-extendededges.o) has no symbols In file included from highgui/cvcap_ffmpeg.cpp:97: /opt/local/include/libavformat/avformat.h:164:1: warning: "PKT_FLAG_KEY" redefined In file included from highgui/cvcap_ffmpeg.cpp:87: /usr/local/include/ffmpeg/avcodec.h:991:1: warning: this is the location of the previous definition libtool: link: ( cd ".libs" && rm -f "lib_cvaux.la" && ln -s "../lib_cvaux.la" "lib_cvaux.la" ) /bin/sh ../libtool --tag=CXX --mode=compile /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I.. -DNDEBUG -I../include/opencv -I/opt/local/include -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -fast -g -O2 -arch x86_64 -MT lib_highgui_la-grfmt_imageio.lo -MD -MP -MF .deps/lib_highgui_la-grfmt_imageio.Tpo -c -o lib_highgui_la-grfmt_imageio.lo `test -f 'highgui/grfmt_imageio.cpp' || echo './'`highgui/grfmt_imageio.cpp libtool: compile: /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I.. -DNDEBUG -I../include/opencv -I/opt/local/include -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -fast -g -O2 -arch x86_64 -MT lib_highgui_la-grfmt_imageio.lo -MD -MP -MF .deps/lib_highgui_la-grfmt_imageio.Tpo -c highgui/grfmt_imageio.cpp -fno-common -DPIC -o .libs/lib_highgui_la-grfmt_imageio.o In file included from highgui/cvcap_ffmpeg.cpp:97: /opt/local/include/libavformat/avformat.h:117: error: redefinition of 'struct AVPacket' /usr/local/include/ffmpeg/avcodec.h:942: error: previous definition of 'struct AVPacket' /opt/local/include/libavformat/avformat.h:163: error: invalid type in declaration before ';' token /opt/local/include/libavformat/avformat.h:163: error: conflicting declaration 'typedef int AVPacket' /usr/local/include/ffmpeg/avcodec.h:988: error: 'AVPacket' has a previous declaration as 'typedef struct AVPacket AVPacket' /opt/local/include/libavformat/avformat.h: In function 'void av_free_packet(AVPacket*)': /opt/local/include/libavformat/avformat.h:211: error: 'void av_free_packet(AVPacket*)' was declared 'extern' and later 'static' /usr/local/include/ffmpeg/avcodec.h:2863: error: previous declaration of 'void av_free_packet(AVPacket*)' highgui/cvcap_ffmpeg.cpp: In member function 'virtual bool CvCapture_FFMPEG::grabFrame()': highgui/cvcap_ffmpeg.cpp:546: warning: 'avcodec_decode_video' is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:3354) highgui/cvcap_ffmpeg.cpp:548: warning: 'avcodec_decode_video' is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:3354) highgui/cvcap_ffmpeg.cpp: In member function 'virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)': highgui/cvcap_ffmpeg.cpp:1213: warning: 'av_alloc_format_context' is deprecated (declared at /opt/local/include/libavformat/avformat.h:873) highgui/cvcap_ffmpeg.cpp:1213: warning: 'av_alloc_format_context' is deprecated (declared at /opt/local/include/libavformat/avformat.h:873) make[2]: *** [lib_highgui_la-cvcap_ffmpeg.lo] Error 1 make[2]: *** Waiting for unfinished jobs.... mv -f .deps/lib_highgui_la-grfmt_imageio.Tpo .deps/lib_highgui_la-grfmt_imageio.Plo make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Error: Status 1 encountered during processing.
I previously installed ffmpeg with no arguments. Is that wrong?
comment:53 Changed 15 years ago by ryanlei750328@…
Replying to ryanlei750328@…:
Replying to ryandesign@…:
Updated and fixed in r64069.
The latest port results in the following errors:
$ sudo port install -d opencv Password: ---> Computing dependencies for opencv ---> Building opencv Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_opencv/work/OpenCV-2.0.0" && /usr/bin/make -j2 all " returned error 2 Command output: ranlib: file: .libs/lib_cvaux.a(lib_cvaux_la-decomppoly.o) has no symbols ranlib: file: .libs/lib_cvaux.a(lib_cvaux_la-enmin.o) has no symbols ranlib: file: .libs/lib_cvaux.a(lib_cvaux_la-extendededges.o) has no symbols In file included from highgui/cvcap_ffmpeg.cpp:97: /opt/local/include/libavformat/avformat.h:164:1: warning: "PKT_FLAG_KEY" redefined In file included from highgui/cvcap_ffmpeg.cpp:87: /usr/local/include/ffmpeg/avcodec.h:991:1: warning: this is the location of the previous definition libtool: link: ( cd ".libs" && rm -f "lib_cvaux.la" && ln -s "../lib_cvaux.la" "lib_cvaux.la" ) /bin/sh ../libtool --tag=CXX --mode=compile /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I.. -DNDEBUG -I../include/opencv -I/opt/local/include -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -fast -g -O2 -arch x86_64 -MT lib_highgui_la-grfmt_imageio.lo -MD -MP -MF .deps/lib_highgui_la-grfmt_imageio.Tpo -c -o lib_highgui_la-grfmt_imageio.lo `test -f 'highgui/grfmt_imageio.cpp' || echo './'`highgui/grfmt_imageio.cpp libtool: compile: /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I.. -DNDEBUG -I../include/opencv -I/opt/local/include -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -fast -g -O2 -arch x86_64 -MT lib_highgui_la-grfmt_imageio.lo -MD -MP -MF .deps/lib_highgui_la-grfmt_imageio.Tpo -c highgui/grfmt_imageio.cpp -fno-common -DPIC -o .libs/lib_highgui_la-grfmt_imageio.o In file included from highgui/cvcap_ffmpeg.cpp:97: /opt/local/include/libavformat/avformat.h:117: error: redefinition of 'struct AVPacket' /usr/local/include/ffmpeg/avcodec.h:942: error: previous definition of 'struct AVPacket' /opt/local/include/libavformat/avformat.h:163: error: invalid type in declaration before ';' token /opt/local/include/libavformat/avformat.h:163: error: conflicting declaration 'typedef int AVPacket' /usr/local/include/ffmpeg/avcodec.h:988: error: 'AVPacket' has a previous declaration as 'typedef struct AVPacket AVPacket' /opt/local/include/libavformat/avformat.h: In function 'void av_free_packet(AVPacket*)': /opt/local/include/libavformat/avformat.h:211: error: 'void av_free_packet(AVPacket*)' was declared 'extern' and later 'static' /usr/local/include/ffmpeg/avcodec.h:2863: error: previous declaration of 'void av_free_packet(AVPacket*)' highgui/cvcap_ffmpeg.cpp: In member function 'virtual bool CvCapture_FFMPEG::grabFrame()': highgui/cvcap_ffmpeg.cpp:546: warning: 'avcodec_decode_video' is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:3354) highgui/cvcap_ffmpeg.cpp:548: warning: 'avcodec_decode_video' is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:3354) highgui/cvcap_ffmpeg.cpp: In member function 'virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)': highgui/cvcap_ffmpeg.cpp:1213: warning: 'av_alloc_format_context' is deprecated (declared at /opt/local/include/libavformat/avformat.h:873) highgui/cvcap_ffmpeg.cpp:1213: warning: 'av_alloc_format_context' is deprecated (declared at /opt/local/include/libavformat/avformat.h:873) make[2]: *** [lib_highgui_la-cvcap_ffmpeg.lo] Error 1 make[2]: *** Waiting for unfinished jobs.... mv -f .deps/lib_highgui_la-grfmt_imageio.Tpo .deps/lib_highgui_la-grfmt_imageio.Plo make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Error: Status 1 encountered during processing.I previously installed ffmpeg with no arguments. Is that wrong?
After deleting all of those in /usr/local/include and /usr/local/lib, I got these:
... highgui/cvcap_ffmpeg.cpp:87:30: error: ffmpeg/avcodec.h: No such file or directory highgui/cvcap_ffmpeg.cpp:93:30: error: ffmpeg/swscale.h: No such file or directory ... highgui/cvcap_ffmpeg.cpp: In member function 'virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)': highgui/cvcap_ffmpeg.cpp:1213: warning: 'av_alloc_format_context' is deprecated (declared at /opt/local/include/libavformat/avformat.h:873) highgui/cvcap_ffmpeg.cpp:1213: warning: 'av_alloc_format_context' is deprecated (declared at /opt/local/include/libavformat/avformat.h:873) make[2]: *** [lib_highgui_la-cvcap_ffmpeg.lo] Error 1 make[2]: *** Waiting for unfinished jobs.... ...
Patched port file: +snowleopard64 allows to compile opencv in 64 bit