Topic: Compiler problem - MacOSX

I am trying to compile oofem on my MacBook using from git repository, but I am running into trouble because the standar compiler on mac OS is Clang. I used the following options:

cmake -DCMAKE_CXX_FLAGS="-g -Wall -DDEBUG" ~/oofem.git/ [which works like a charm in Linux]

cmake -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" ~/oofem.git/ [workaround to enable c++ compiling features - as per a quick google search]

I also tried to modify the compiler flags in the original cmake.txt file, but it did not work either. In any case, I get the following output:

Wilsons-MacBook-Pro-2:default wilsondasilva$ cmake -DCMAKE_CXX_FLAGS="-g -Wall -DDEBUG" ~/oofem.git/
-- The CXX compiler identification is Clang 6.0.0
-- The C compiler identification is Clang 6.0.0
-- 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
-- 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
-- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
-- Looking for C++ include unistd.h
-- Looking for C++ include unistd.h - found
-- Looking for C++ include execinfo.h
-- Looking for C++ include execinfo.h - found
-- Looking for access
-- Looking for access - found
-- Looking for cbrt
-- Looking for cbrt - found
-- Looking for isnan
-- Looking for isnan - not found
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/wilsondasilva/oofem.git/default

Next, when I try to run "make", I get the following message:

Wilsons-MacBook-Pro-2:debug wilsondasilva$ make
Scanning dependencies of target fm
[  0%] Building CXX object src/fm/CMakeFiles/fm.dir/fluidmodel.C.o
In file included from /Users/wilsondasilva/oofem.git/src/fm/fluidmodel.C:36:
/Users/wilsondasilva/oofem.git/src/oofemlib/element.h:1042:31: error: cannot
      use incomplete type 'oofem::IntegrationRule' as a range
        for ( GaussPoint *gp: *ir ) {
                              ^
/Users/wilsondasilva/oofem.git/src/oofemlib/element.h:74:7: note: forward
      declaration of 'oofem::IntegrationRule'
class IntegrationRule;
      ^
/Users/wilsondasilva/oofem.git/src/oofemlib/element.h:1052:31: error: cannot
      use incomplete type 'oofem::IntegrationRule' as a range
        for ( GaussPoint *gp: *ir ) {
                              ^
/Users/wilsondasilva/oofem.git/src/oofemlib/element.h:74:7: note: forward
      declaration of 'oofem::IntegrationRule'
class IntegrationRule;
      ^
2 errors generated.
make[2]: *** [src/fm/CMakeFiles/fm.dir/fluidmodel.C.o] Error 1
make[1]: *** [src/fm/CMakeFiles/fm.dir/all] Error 2
make: *** [all] Error 2

Is there anybody who managed to compile oofem from git using mac os. The version available in the website (oofem2.3.zip) works pretty well on my mac, but the git version (which is updated) does not. Please advise.

Re: Compiler problem - MacOSX

Hi!

integrationrule.h needs to be included in element.h. This is a small bug that was fixed a couple of weeks ago, but we have not yet merged it into the main branch. The simplest fix is to type #include "integrationrule.h" in element.h. An alternative is to pull the latest version from https://github.com/Micket/oofem.git

/Erik

Re: Compiler problem - MacOSX

I will be merging in all these changes today.

Re: Compiler problem - MacOSX

The tweak you mentioned worked; nonetheless, I get an error message that appears when the compilation reaches cca. 50%. See message below:
[ 51%] Building CXX object src/sm/CMakeFiles/sm.dir/isolinearelasticmaterial.C.o
/Users/Kurt/oofem.git/src/sm/structuralinterfacematerial.C:185:12: error: use of
      undeclared identifier 'abs'; did you mean 'fabs'?
    if ( ( abs( traction3D.at(1) ) > 1.0e-3 ) || ( abs( traction3D.at(2...
           ^~~
           fabs
/usr/include/math.h:431:15: note: 'fabs' declared here
extern double fabs(double);
              ^
/Users/Kurt/oofem.git/src/sm/structuralinterfacematerial.C:185:52: error: use of
      undeclared identifier 'abs'; did you mean 'fabs'?
    if ( ( abs( traction3D.at(1) ) > 1.0e-3 ) || ( abs( traction3D.at(2...
                                                   ^~~
                                                   fabs
/usr/include/math.h:431:15: note: 'fabs' declared here
extern double fabs(double);
              ^
/Users/Kurt/oofem.git/src/sm/structuralinterfacematerial.C:200:10: error: use of
      undeclared identifier 'abs'; did you mean 'fabs'?
    if ( abs( traction3D.at(2) ) > 1.0e-3 ) {
         ^~~
         fabs
/usr/include/math.h:431:15: note: 'fabs' declared here
extern double fabs(double);
              ^
3 errors generated.
make[2]: *** [src/sm/CMakeFiles/sm.dir/structuralinterfacematerial.C.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/sm/CMakeFiles/sm.dir/all] Error 2
make: *** [all] Error 2

Re: Compiler problem - MacOSX

Those function calls should be "fabs(..)" and not "abs(..)". These are also fixed (and I will try to get these merged into oofem.org today, i was not feeling well yesterday, so I never got around to do it).

Re: Compiler problem - MacOSX

No problems or rush at all Dr. Ohman, I keep posting log errors in order to support oofem developers and help those who are using oofem in MacOSX. Thank you for your support.