Ask Your Question
1

failed to make opencv.git with gcc48 on macosx mavericks

asked 2014-03-30 11:18:33 -0600

benzwt gravatar image

updated 2014-03-30 12:29:44 -0600

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)
edit retag flag offensive close merge delete

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 ( 2014-03-31 03:35:36 -0600 )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 ( 2014-04-28 07:47:30 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2014-04-28 13:48:11 -0600

drtaglia gravatar image

updated 2014-04-28 13:50:42 -0600

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.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-03-30 11:18:33 -0600

Seen: 1,028 times

Last updated: Apr 28 '14