Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Bern.

macrumors newbie
Original poster
Jan 30, 2015
9
0
I am trying to configure and build an open source program from the internet which is intended to be used with Matlab. This is my first time trying to install an open source program and I keep running into issues. I have been using the cmake GUI to try and configure my program, however this is the result I get:

Code:
The C compiler identification is AppleClang 6.0.0.6000056
The CXX compiler identification is AppleClang 6.0.0.6000056
Check for working C compiler: /usr/bin/cc
Check for working C compiler: /usr/bin/cc -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: /usr/bin/c++
Check for working CXX compiler: /usr/bin/c++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Try OpenMP C flag = [ ]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [-fopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [/openmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [-Qopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [-openmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [-xopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [+Oopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [-qsmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP C flag = [-mp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [ ]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [-fopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [/openmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [-Qopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [-openmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [-xopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [+Oopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [-qsmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Try OpenMP CXX flag = [-mp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Failed
Could NOT find OpenMP (missing:  OpenMP_C_FLAGS OpenMP_CXX_FLAGS) 
Performing Test HAS_BRANCH_PEDICTION
Performing Test HAS_BRANCH_PEDICTION - Success
Using bash: /bin/bash
Using perl: /usr/bin/perl
Performing Test HAS_GETOPT
Performing Test HAS_GETOPT - Success
getopt found. 
Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5") 
Found OpenEXR: /usr/local/lib/libHalf.dylib  
Found ImageMagick: /usr/local/Cellar/imagemagick/6.9.0-3/lib/libMagick++-6.Q16.dylib  
ImageMagick CFLAGS: /usr/local/Cellar/imagemagick/6.9.0-3/include/ImageMagick-6
Found NETPBM: /usr/local/lib/libnetpbm.a
Found TIFF: /usr/local/lib/libtiff.dylib  
Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - not found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found
Looking for Q_WS_MAC
Looking for Q_WS_MAC - found
Looking for QT_MAC_USE_COCOA
Looking for QT_MAC_USE_COCOA - found
Found Qt4: /usr/local/bin/qmake (found version "4.8.6") 
Qt4 found
Failed to find matlab root directory. Specify it manually by setting MATLAB_ROOT cmake cache variable.
Found OpenGL: /System/Library/Frameworks/OpenGL.framework  
Found GLUT: /System/Library/Frameworks/GLUT.framework  
Found FFTW: /usr/local/lib/libfftw3.dylib  
Using GSL from /usr/local/Cellar/gsl/1.16
mkoctfile found.
OpenCV library found.
Configuring done

My problem appears to be with OpenMP, which I understand is not supported by AppleClang. I have installed gcc and gcc47 to try and fix the problem but I don't know how to set the default compiler to either of these. When I select 'configure' in cmake, it gives me the following options:

Use default native compilers
Specify native compilers
Specify toolchain file for cross-compiling
Specify options for cross-compiling

For the configuration above I used 'default native compilers'. I have also tried the 'specify native compilers' entering in the gcc47 path but then it doesn't complete.

Any help or advice is greatly appreciated. Thank you.
 
Last edited by a moderator:
Hi:

- Try to install the macports gcc4.7 package

- Don't try to change the gcc Apple default compiler. You could have problems later when installing other packages.

- In the cmake script substitute:

gcc (Apple's gnu C) compiler by gcc-mp-4.7
the g++ (Apple's gnu c++) compiler by g++-mp-4.7


mp are the OpenMP compatible versions.

The Apple default (gnu) native compilers don't include OpenMP

This works for me and for my Macuser's students of Parallel Computing

By the way, also it is possible to install MPI :)

Anyway, running/compiling/mixing MATLAB/OpenMP programs is not an easy task. MATLAB is a "black box". I use this for my research papers (not for my students), but I use other techniques as MEX files..etc...

Good luck

JP
 
Last edited:
Thanks for your reply JP.

I have now downloaded macports and did the following:

sudo port install gcc47
sudo port select --set gcc mp-gcc47


Is this what you meant for me to do?

Also, please pardon my ignorance, but when you say make the substitutions in the cmake script - where is that? Is it something I set in Terminal, the cmake GUI or in the CMakeLists.txt file?
 
Thanks for your reply JP.

I have now downloaded macports and did the following:

sudo port install gcc47
sudo port select --set gcc mp-gcc47


Is this what you meant for me to do?

Yes to the first command and no to the second one.

port install gcc47 OK because this installs gcc4.7 with openMP

sudo port select. No because now this is your default compiler. I dont know of you could "unset" this command.....I prefer the apple compiler as default.




Also, please pardon my ignorance, but when you say make the substitutions in the cmake script - where is that? Is it something I set in Terminal, the cmake GUI or in the CMakeLists.txt file?

I suppose that at first lines of the script, there are lines for define the default compilers to be used....
ie.

cc=gcc
CC=g++

For example the first line tells the script the standard C compiler to be used. The second line do the same for the C++ compiler.

To test OpenMP do the following

get a hello_world OpenMP file

http://www.dartmouth.edu/~rc/classes/intro_openmp/hello_world_openmp.html

copy the C version file and rename it as "Hello_World_OMP.c"


Compile it:

gcc-mp.4.7 Hello_World_OMP.c -fopenmp -o hello_world

It this works, you installed the OpenMP correctly

by the way, the -fopenmp option is for include the OpenMP library


Regards

JP
 
Last edited:
Thank you so much! I wasn't sure what you meant at first but I finally got it :)

All I did was:

CC=gcc CXX=g++ cmake ..

and happy day, I get a bunch of 'success's.

I did this in Terminal as apposed to the CMake GUI I was using before. So my question now is, in Terminal how do I do the CMake GUI equivalent to 'Generate'?

Thank you.
B.
 
Thank you so much! I wasn't sure what you meant at first but I finally got it :)

All I did was:

CC=gcc CXX=g++ cmake ..

and happy day, I get a bunch of 'success's.

I did this in Terminal as apposed to the CMake GUI I was using before. So my question now is, in Terminal how do I do the CMake GUI equivalent to 'Generate'?

Thank you.
B.

Yes. You did ok.

Sorry. I do not understand the question.

JP
 
Sorry, please disregard the previous question.

Another question I have is about the following section from my cmake:

Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - not found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found


I have installed qt using homebrew. Should I have installed a different qt from macports?

Thank you.
 
Sorry, please disregard the previous question.

Another question I have is about the following section from my cmake:

Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - not found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found


I have installed qt using homebrew. Should I have installed a different qt from macports?

Thank you.

Sorry Bern. I can't help you in that question.

JP
 
No problem, thanks anyway.

Perhaps you could help me with a matlab issue in my cmake?

I redid my cmake to set the MATLAB_ROOT directory:

CC=gcc CXX=g++ cmake .. -DMATLAB_ROOT = /Users/bernard/Documents/pfstools/pfstools-2.0.0/src/matlab

The open source program I am trying to install is called pfstools, maybe you know of it? Anyway, as it is meant to be used with matlab there is a matlab folder in it with mex files. This is the folder that I set the MATLAB_ROOT directory to.

My cmake all went fine except for this message I found:

-- Failed to find mex matlab compiler.

Do you know how to fix this?

Thank you for your time.
 
No problem, thanks anyway.

Perhaps you could help me with a matlab issue in my cmake?

I redid my cmake to set the MATLAB_ROOT directory:

CC=gcc CXX=g++ cmake .. -DMATLAB_ROOT = /Users/bernard/Documents/pfstools/pfstools-2.0.0/src/matlab

The open source program I am trying to install is called pfstools, maybe you know of it? Anyway, as it is meant to be used with matlab there is a matlab folder in it with mex files. This is the folder that I set the MATLAB_ROOT directory to.

My cmake all went fine except for this message I found:

-- Failed to find mex matlab compiler.

Do you know how to fix this?

Thank you for your time.

Hi Again:

No, I dont know this package.

Anyway, I think the problem is that as you tell me the package uses MATLAB. Then it is trying to compile a MATLAB program. To do this MATLAB uses a compiler called mex (It is a compiler+libraries to work in MATLAB)

The error message is telling to you that the mex program is not found.

You must configure mex to work with Mac. This depends on the platform. I use mex only in UNIX (not in my Mac). Search in google how to do it or ask to MATLAB staff.

In Mac, the path is:

/Applications/MATLAB_R2012b.app/bin/

mex can to be configured using mex -setup


In UNIX, it was done by the system administrator of my University

Regards

JP
 
Thank you so much! I wasn't sure what you meant at first but I finally got it :)

All I did was:

CC=gcc CXX=g++ cmake ..

and happy day, I get a bunch of 'success's.

I did this in Terminal as apposed to the CMake GUI I was using before. So my question now is, in Terminal how do I do the CMake GUI equivalent to 'Generate'?

Thank you.
B.
Hi,

I meet the same problem as "--Failed to find mex matlab compiler" when I'm trying to compile pfstools through cmake, but I have finished the setup of mex in matlab. So, I'm writing to ask how to deal with this problem? Thank you.

Best Regards,
Jiangyan
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.