Sorry, this content is no longer available

Ask Your Question
1

failed to make opencv.git with gcc48 on macosx mavericks

asked Mar 30 '14

benzwt gravatar image

updated Mar 30 '14

berak gravatar image

I forked the repos, and clone a copy on my computer, my OS is macosx maverick and the gcc version is 4.8

I just failed to make the fresh opencv, the error messages are as below, It is the matter of the gcc ?

In file included from /Users/benzene/works/OpenCV/opencv/modules/core/include/opencv2/core.hpp:52:0,
                 from /Users/benzene/works/OpenCV/opencv/modules/highgui/include/opencv2/highgui.hpp:46,
                 from /Users/benzene/works/OpenCV/opencv/modules/highgui/src/precomp.hpp:45,
                 from /Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:43:
/Users/benzene/works/OpenCV/opencv/modules/core/include/opencv2/core/base.hpp:228:35: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
 #   pragma GCC diagnostic ignored "-Winvalid-noreturn"
                                   ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm: In function 'void cvDestroyAllWindows()':
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:199:23: error: expected ';' before 'in'
     for(NSString *key in list) {
                       ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:199:23: error: 'in' was not declared in this scope
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:199:26: error: expected ';' before 'list'
     for(NSString *key in list) {
                          ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:199:26: warning: for increment expression has no effect [-Wunused-value]
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm: In function 'void cvShowImage(const char*, const CvArr*)':
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:31: error: expected ';' before 'in'
             for(NSString *key in [window sliders]) {
                               ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:31: error: 'in' was not declared in this scope
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:42: error: expected ']' before 'sliders'
             for(NSString *key in [window sliders]) {
                                          ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:42: error: expected ';' before 'sliders'
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:42: error: 'sliders' was not declared in this scope
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:49: error: expected ')' before ']' token
             for(NSString *key in [window sliders]) {
                                                 ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:49: error: expected primary-expression before ']' token
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:49: error: expected ';' before ']' token
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:229:27: warning: unused variable 'key' [-Wunused-variable]
             for(NSString *key in [window sliders]) {
                           ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm: In function 'const char* cvGetWindowName(void*)':
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:435:23: error: expected ';' before 'in'
     for(NSString *key in windows) {
                       ^
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:435:23: error: 'in' was not declared in this scope
/Users/benzene/works/OpenCV/opencv/modules/highgui/src/window_cocoa.mm:435:26: error: expected ';' before 'windows'
     for(NSString *key in windows) {
                          ^
/Users/benzene/works/OpenCV ...
(more)
Preview: (hide)

Comments

1

btw, "modules/core/include/opencv2/core.hpp" looks more like you're trying to compile the 3.0(master) branch, not the 2.4.8 one. (also the line numbers match better then)

.

did you do a "git checkout 2.4" ?

.

(it probably won't solve it, just for clarity)

berak gravatar imageberak (Mar 31 '14)edit

Same problem for me: http://codepaste.net/tackx9

I keep finding mentions about highgui needing to be compiled by "clang":

"You have to compile the CUDA components using GCC 4.5, while compiling the rest of OpenCV with Clang, otherwise you cannot get the HighGui module to work. HighGui will only compile with the Apple installed compilers because it uses Cocoa. If you do not need HighGui, you can compile OpenCV with GCC. You can specify the proper compilers quite easily with cmake."

SOURCE: http://stackoverflow.com/questions/16144966/compile-opencv-with-cuda-for-mac

drtaglia gravatar imagedrtaglia (Apr 28 '14)edit

1 answer

Sort by » oldest newest most voted
0

answered Apr 28 '14

drtaglia gravatar image

updated Apr 28 '14

I have spent half an afternoon fixing this, this is what I got

What I did was using Qt4 from homebrew instead of the native Objective-C COCOA stuff from HighGui. As reported, I had to hack the cmake files in a number of places to have a clean build too.

Preview: (hide)

Question Tools

Stats

Asked: Mar 30 '14

Seen: 1,039 times

Last updated: Apr 28 '14