Linking fails with "file not recognized: file format not recognized"

293 views Asked by At

I'm currently trying to re-compile an old project using the Intel OneAPI-compiler. Compilation has worked before, thus I assume the code should be runnable. Compilation itself works fine, but linking fails with

CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx.o: file not recognized: file format not recognized
icpx: error: linker command failed with exit code 1 (use -v to see invocation)

The full linker output is

mpiicpc for the Intel(R) MPI Library 2021.10 for Linux*
Copyright Intel Corporation.
Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230721)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm
Configuration file: /opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm/../bin/icpx.cfg
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda-12.2, version 
 "/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -shared -o libphysics_variables.so.1.10.0 /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/opt/intel/oneapi/mpi/2021.10.0/lib/release -L/opt/intel/oneapi/mpi/2021.10.0/lib -L/opt/intel/oneapi/compiler/2023.2.1/linux/compiler/lib/intel64_lin -L/opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm/../lib -L/opt/intel/oneapi/compiler/2023.2.1/linux/compiler/lib/intel64_lin -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-linux-gnu/12/../../.. -L/opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm/../lib -L/lib -L/usr/lib -L/opt/intel/oneapi/tbb/2021.10.0/env/../lib/intel64/gcc4.8 -L/opt/intel/oneapi/mpi/2021.10.0//libfabric/lib -L/opt/intel/oneapi/mpi/2021.10.0//lib/release -L/opt/intel/oneapi/mpi/2021.10.0//lib -L/opt/intel/oneapi/mkl/2023.2.0/lib/intel64 -L/opt/intel/oneapi/ipp/2021.9.0/lib/intel64 -L/opt/intel/oneapi/ippcp/2021.8.0/lib/intel64 -L/opt/intel/oneapi/ipp/2021.9.0/lib/intel64 -L/opt/intel/oneapi/dnnl/2023.2.0/cpu_dpcpp_gpu_dpcpp/lib -L/opt/intel/oneapi/dal/2023.2.0/lib/intel64 -L/opt/intel/oneapi/compiler/2023.2.1/linux/compiler/lib/intel64_lin -L/opt/intel/oneapi/compiler/2023.2.1/linux/lib -L/opt/intel/oneapi/ccl/2021.10.0/lib/cpu_gpu_dpcpp -soname libphysics_variables.so.1 CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx.o CMakeFiles/physics_variables.dir/Unity/unity_0_cxx.cxx.o -rpath /media/storage/local_opt/boost/lib: /media/storage/local_opt/boost/lib/libboost_system.so.1.83.0 /media/storage/local_opt/boost/lib/libboost_filesystem.so.1.83.0 /media/storage/local_opt/boost/lib/libboost_program_options.so.1.83.0 /media/storage/local_opt/boost/lib/libboost_serialization.so.1.83.0 /media/storage/local_opt/boost/lib/libboost_atomic.so.1.83.0 --enable-new-dtags -rpath /opt/intel/oneapi/mpi/2021.10.0/lib/release -rpath /opt/intel/oneapi/mpi/2021.10.0/lib -lmpicxx -lmpifort -lmpi -ldl -lrt -lpthread -lsvml -lirng -lstdc++ -limf -lm -lgcc_s -lgcc -lintlc -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc -lirc_s /usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o
CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx.o: file not recognized: file format not recognized
icpx: error: linker command failed with exit code 1 (use -v to see invocation)

The error also occurs if I delete all object files, run make clean and redo make. It also fails if I disable the unity-build.
Is there anything else I can do to compile/link my files?

Edit: The compilation line used for compiling the code is (as example for one file):

/opt/intel/oneapi/mpi/2021.10.0/bin/mpiicpc -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_SERIALIZATION_DYN_LINK -DBOOST_SERIALIZATION_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -Dphysics_variables_EXPORTS -I/home/user/Documents/C++-Projects/physics_variables/./include -isystem /media/storage/local_opt/boost/include -fPIC -mavx2 -fPIC -flto -fopenmp -O2 -funroll-loops -fstrict-aliasing -std=gnu++17 -MD -MT CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx.o -MF CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx.o.d -o CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx.o -c /home/user/Documents/C++-Projects/physics_variables/CMakeFiles/physics_variables.dir/Unity/unity_1_cxx.cxx
0

There are 0 answers