uiuc-hpc / Recorder

Multi-level I/O tracing library
Other
43 stars 14 forks source link

Multiple definition error during linking of Recorder #15

Closed blastmaster closed 2 years ago

blastmaster commented 2 years ago

Hi, maybe I'am holding it wrong but when trying to compile recorder doing the following steps:

cd Recorder-2.3.1/
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/$USER/bin/Recorder/ ..
make

I get the follwoing error message during the linking step.

[...]
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: CMakeFiles/recorder.dir/recorder-hdf5.c.o: previous definition here
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: error: CMakeFiles/recorder.dir/recorder-function-profiler.c.o: multiple definition of '__real_open64'
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: CMakeFiles/recorder.dir/recorder-hdf5.c.o: previous definition here
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: error: CMakeFiles/recorder.dir/recorder-function-profiler.c.o: multiple definition of '__real_open'
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: CMakeFiles/recorder.dir/recorder-hdf5.c.o: previous definition here
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: error: CMakeFiles/recorder.dir/recorder-function-profiler.c.o: multiple definition of '__real_creat64'
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: CMakeFiles/recorder.dir/recorder-hdf5.c.o: previous definition here
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: error: CMakeFiles/recorder.dir/recorder-function-profiler.c.o: multiple definition of '__real_creat'
/sw/installed/binutils/2.35-GCCcore-10.2.0/bin/ld.gold: CMakeFiles/recorder.dir/recorder-hdf5.c.o: previous definition here
collect2: error: ld returned 1 exit status
make[2]: *** [bin/librecorder.so.2.3.0] Error 1
make[1]: *** [lib/CMakeFiles/recorder.dir/all] Error 2
make: *** [all] Error 2

I shorten the messages because it's the same for nearly all symbols you want to intercept, POSIX-IO, MPI, HDF5. Configuration via CMake was fine without any errors. Maybe there is something wrong in the linking order? Did you know this issue? Or did I something wrong?

wangvsa commented 2 years ago

Hi thanks for the information. Those errors were safely ignored by earlier versions of gcc. But gcc-10 reports and stops on those errors. I'll try to resolve them and get back to you soon.

wangvsa commented 2 years ago

I believe I have fixed the issue, can you pull the latest code and retry?

blastmaster commented 2 years ago

Thanks you for your fast response. Yes this solves the issue. However, there is an other little bug which still prevents compilation. For this you need to add #include <string> at the top of the file. I tried it locally, then it will compile.

wangvsa commented 2 years ago

Thanks for pointing that out. Strange my compiler didn't complain about it. I'll add it.

blastmaster commented 2 years ago

Yes probably you are using a different libc++ implementation then its possible that the string stuff is already included in the vector or algorithm or unordered_map header. Thanks a lot.