UG4 / ugcore

The core functionality of UG4. Includes sources, build-scripts, and utility scripts.
https://github.com/UG4/ugcore
Other
36 stars 23 forks source link

Compilation failure on OSX #38

Closed stephanmg closed 3 years ago

stephanmg commented 3 years ago

See the Travis build (STATIC_BUILD=OFF and TARGET=vrl this corresponds to build2 and build4):

https://travis-ci.org/github/UG4/ugcore/jobs/729465313

`/Users/travis/build/UG4/ugcore/travis_root/ug4/ugcore/ugbase/common/stopwatch.h:53:10: fatal error: 'chrono' file not found

include `

Looks like in these cases (--with-gxx-include-dir=/usr/include/c++/4.2.1) which has not the C++11 headers available. Can someone confirm?

Note: When using -stdlib=libc++ then the libc++standard library is included, instead of the gnu libstdc++. On OS X, the libc++version has c++11 support. The gnu libstdc++ one does not. (At least to my knowledge)

mlampe commented 3 years ago

The combo gcc/osx tests the "gcc" supplied by MacOS. This "gcc" is actually clang using c++ headers and lib from gcc 4.2.1. But half of the clang/osx tests (using clang with or without -stdlib=libc++) also fail because the 'crono' header file is not found: [https://travis-ci.org/github/UG4/ugcore/builds/728486378]

stephanmg commented 3 years ago

@mlampe: How about this for .travis.yml?

- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CXXFLAGS="-stdlib=libc++"; fi

At least this worked for me on Travis. On OS X before Mavericks g++ was really just an alias for clang as @mlampe points out and libstdc++ (OSX) was the default library (No C++11).

Starting from OS X Mavericks libc++ is the default (C++11).

Thus for pre-Mavericks one needs to use: -std=c++11 -stdlib=libc++ or std=gnu++11 -stdlib=libc++ with clang/gcc on OSX

For later OSX releases one can compile (Clang) via: clang++ -std=c++11 or clang++ -std=gnu++11.

mlampe commented 3 years ago

As I said above: The two OSX Travis builds with CC=clang and TARGET=vrl fail either way. The 'chrono' header is not found.