iLCSoft / LCIO

Linear Collider I/O
BSD 3-Clause "New" or "Revised" License
17 stars 35 forks source link

Compilation fails on Mac OSX High Sierra #45

Closed jstrube closed 6 years ago

jstrube commented 6 years ago

Steps to reproduce:

Result:

In file included from /Users/stru821/Workdir/LCIO-02-11/src/cpp/src/UTIL/Operators.cc:8:
/Users/stru821/Workdir/LCIO-02-11/src/cpp/include/UTIL/CellIDDecoder.h:18:17: warning: using namespace directive in
      global context in header [-Wheader-hygiene]
using namespace lcio ;
                ^
In file included from /Users/stru821/Workdir/LCIO-02-11/src/cpp/src/UTIL/Operators.cc:9:
In file included from /Users/stru821/Workdir/LCIO-02-11/src/cpp/include/UTIL/PIDHandler.h:4:
/Users/stru821/Workdir/LCIO-02-11/src/cpp/include/UTIL/CollectionParameterMap.h:9:17: warning: using namespace
      directive in global context in header [-Wheader-hygiene]
using namespace EVENT;
                ^
In file included from /Users/stru821/Workdir/LCIO-02-11/src/cpp/src/UTIL/Operators.cc:9:
/Users/stru821/Workdir/LCIO-02-11/src/cpp/include/UTIL/PIDHandler.h:16:17: warning: using namespace directive in
      global context in header [-Wheader-hygiene]
using namespace lcio ;
                ^
[ 26%] Building CXX object lcio/CMakeFiles/lcio.dir/src/UTIL/lXDR.cc.o
/Users/stru821/Workdir/LCIO-02-11/src/cpp/src/UTIL/lXDR.cc:14:10: fatal error: '/usr/include/sys/types.h' file not
      found
#include "/usr/include/sys/types.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~

I've also been trying to compile with gcc-7 (homebrew version), but also without success.

gaede commented 6 years ago

@jstrube I cannot reproduce your problem. I can build LCIO w/o problems on High Sierra. On my system /usr/include/sys/types.h exists. Are you sure your xcode and command line tools are installed correctly ? Concerning the gcc-7 build: Can you comment out the following lines:

IF( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
 LIST( APPEND COMPILER_FLAGS -Wl,-no-undefined )
ENDIF()

in cmake/ilcsoft_default_cxx_flags.cmake and retry ? This is a fix recently reported for a Debian system - not sure it helps on MacOSX, though.

petricm commented 6 years ago

Also DD4hep compilations(cmake) fails

CMake Error at /cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc7-opt/lcio/HEAD/LCIOConfig.cmake:57 (INCLUDE):
  INCLUDE could not find load file:

    /cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc7-opt/lcio/HEAD/lib/cmake/LCIOLibDeps.cmake
Call Stack (most recent call first):
  cmake/DD4hepBuild.cmake:391 (find_package)
  cmake/DD4hepBuild.cmake:483 (dd4hep_find_packageEx)
  cmake/DD4hepBuild.cmake:685 (dd4hep_find_package)
  cmake/DD4hepBuild.cmake:980 (dd4hep_handle_optional_sources)
  cmake/DD4hepBuild.cmake:1130 (dd4hep_add_library)
  DDG4/CMakeLists.txt:54 (dd4hep_add_plugin)
andresailer commented 6 years ago

For @petricm's problem This line needs to be removed following #44 https://github.com/iLCSoft/LCIO/blob/master/cmake/LCIOConfig.cmake.in#L57

jstrube commented 6 years ago

@gaede The XCode was indeed out of date. The OS update had not updated xcode. xcode-select --install indeed fixed it.

The gcc-7 fix results in cmake completing, but make results in

[  3%] Building CXX object sio/CMakeFiles/sio.dir/src/SIO_stream.cc.o
In file included from /usr/include/wchar.h:72:0,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/cwchar:44,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/postypes.h:40,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/iosfwd:40,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/ios:38,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/iostream:39,
                 from /Users/stru821/Workdir/LCIO-02-11/sio/src/SIO_stream.cc:17:
/usr/include/zlib.h:663:46: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                              __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                              ^
/usr/include/zlib.h:1295:37: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                     __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                     ^
/usr/include/zlib.h:1434:38: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                      __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                      ^
/usr/include/zlib.h:1469:39: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                       __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                       ^
/usr/include/zlib.h:1729:37: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                     __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                     ^
/usr/include/zlib.h:1765:35: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                   __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                   ^
/usr/include/zlib.h:1918:53: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                                     __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                                     ^
/usr/include/zlib.h:1920:53: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                                     __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                                     ^
jstrube commented 6 years ago

Homebrew update installed gcc-7.2.0.1 today. For whatever reason, that worked (with the lines commented out as suggested).