SebWouters / CheMPS2

CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
GNU General Public License v2.0
70 stars 34 forks source link

-flto flag makes clang to produce binary llvm code which causes 'Module format not recognized' error #63

Closed yurivict closed 7 years ago

SebWouters commented 7 years ago

Can you please provide all specs (chemps2 commit, clang version, cmake version, setup options, etc.) as well as the full configuration input, configuration output, and build output?

I'm using

The relevant lines on -flto are master/CMakeLists.txt lines 87-90:

check_cxx_compiler_flag (-flto HAS_FLTO)
if (HAS_FLTO)
    set (CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS}")
endif()

My configuration yields:

-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Failed

and the build does not use -flto.

yurivict commented 7 years ago

FreeBSD 11.1 clang-4.0.0 cmake-3.9.4

SebWouters commented 7 years ago

I would also need the rest of the info:

to say something meaningful. Can you provide it?

yurivict commented 7 years ago

The error:

CMakeFiles/CMakeError.log:CMakeFiles/cmTC_b0020.dir/src.cxx.o: file not recognized: File format not recognized

  • chemps2 version

1.8.4-12-55d6b381

  • configuration input

configure environment:

F77="gfortran6" FC="gfortran6" FFLAGS="-O -Wl,-rpath=/usr/local/lib/gcc6" FCFLAGS="-Wl,-rpath=/usr/local/lib/gcc6" XDG_DATA_HOME=/usr/ports/science/chemps2/work  XDG_CONFIG_HOME=/usr/ports/science/chemps2/work  HOME=/usr/ports/science/chemps2/work PATH=/usr/ports/science/chemps2/work/.bin:.:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin SHELL=/bin/sh CONFIG_SHELL=/bin/sh
  • configuration output
-- The C compiler identification is Clang 4.0.0
-- The CXX compiler identification is Clang 4.0.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The CMake build type is Release
-- Performing Test HAS_IPO
-- Performing Test HAS_IPO - Success
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Failed
-- LAPACK detection suppressed.
-- Found TargetLAPACK: Found LAPACK: -lopenblas  
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5 detected.
-- Found TargetHDF5: Found HDF5: /usr/local/lib/libhdf5.so;/usr/local/lib/libsz.so;/usr/lib/libz.so;/usr/lib/libm.so (found version 1.10.1) (found version "1.10.1") 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_FLAGS_DEBUG
    CMAKE_C_FLAGS_DEBUG
    CMAKE_C_FLAGS_RELEASE
    CMAKE_MODULE_LINKER_FLAGS
    THREADS_HAVE_PTHREAD_ARG

build output

[  1%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/CASPT2.cpp.o
[  3%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/CASSCFnewtonraphson.cpp.o
[  4%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/ConjugateGradient.cpp.o
[  6%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/CASSCFpt2.cpp.o
[  7%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/ConvergenceScheme.cpp.o
[  9%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/CASSCFdebug.cpp.o
[ 11%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/Correlations.cpp.o
[ 12%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/CASSCF.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 14%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/Cumulant.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 15%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/Davidson.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 17%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DIIS.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 19%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRG.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 20%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGfock.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 22%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGmpsio.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 23%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGoperators.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 25%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGoperators3RDM.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 26%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGSCFindices.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 28%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGSCFintegrals.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
[ 30%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/DMRGSCFmatrix.cpp.o
c++: warning: argument unused during compilation: '-ipo' [-Wunused-command-line-argument]
SebWouters commented 7 years ago

@yurivict,

Your configuration clearly states:

-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Failed

So I assume, if you would build with

make VERBOSE=1

that no "-flto" flag is used. Can you confirm?

In any case, can you please provide the full build output up to and including the error which you obtain with "make VERBOSE=1"? It currently seems to me that "-flto" cannot be the cause of the problem...

Thanks, Seb

yurivict commented 7 years ago

-flto only fails in configure stage. I must have created this bug by mistake.

-ipo is the flag that causes many warnings, not -flto.