uiuc-hpc / Recorder

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

Build: symbols "already defined" #19

Open roblatham00 opened 2 years ago

roblatham00 commented 2 years ago

I tried both with Recorder straight from git and the 2.3.2 release, but keep getting this error when building:

% make
Consolidate compiler generated dependencies of target recorder
[  4%] Building C object lib/CMakeFiles/recorder.dir/recorder-posix.c.o
/home/robl/work/Recorder/lib/recorder-posix.c:42: warning: "_GNU_SOURCE" redefined
   42 | #define _GNU_SOURCE
      |
<command-line>: note: this is the location of the previous definition
/tmp/ccIsYwVa.s: Assembler messages:
/tmp/ccIsYwVa.s:1425: Error: symbol `pread64' is already defined
/tmp/ccIsYwVa.s:4723: Error: symbol `open64' is already defined
/tmp/ccIsYwVa.s:7799: Error: symbol `fopen64' is already defined
/tmp/ccIsYwVa.s:10294: Error: symbol `pwrite64' is already defined
/tmp/ccIsYwVa.s:12852: Error: symbol `lseek64' is already defined
make[2]: *** [lib/CMakeFiles/recorder.dir/build.make:132: lib/CMakeFiles/recorder.dir/recorder-posix.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:896: lib/CMakeFiles/recorder.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I am on Ubuntu 22.04.1, using gcc-11.2.0 libc version: 2.35-0ubuntu3.1

wangvsa commented 2 years ago

I tried the same system (using docker) but could not reproduce the error. Also tried gcc-10, gcc-9 and gcc-8, both worked fine on my side. It also worked fine on Theta and Cori. Could you give a try with an older version gcc just to narrow down the possibilities?

roblatham00 commented 2 years ago

I don't have an older gcc handy but i did try clang-14:

/home/robl/work/Recorder/lib/recorder-posix.c:267:25: error: definition with same mangled name 'open64' as another definition
int RECORDER_POSIX_DECL(open)(const char *path, int flags, ...) {
                        ^
/home/robl/work/Recorder/lib/recorder-posix.c:246:25: note: previous definition is here
int RECORDER_POSIX_DECL(open64)(const char *path, int flags, ...) {
                        ^
1 warning and 1 error generated.
wangvsa commented 2 years ago

Hmm... Strange... Just tried clang-14.0.0 and it worked fine on my side. open/open64 are the only functions reporting the error for clang? If so, could you try adding "extern inline" right before _int RECORDER_POSIXDECL(open)(const char *path, int flags, ...) and _int RECORDER_POSIXDECL(open64)(const char *path, int flags, ...) in lib/recorder-posix.c?

roblatham00 commented 2 years ago

I should point out that i'm running Ubuntu inside a 'windows subsystem for linux 2" instance -- I wonder what kind of libc modifications that introduces?

The 'extern inline' got me past the symbols errors (needed them around lseek, pread, pwrite, fopen, and their 64 bit counterparts). Now looks like there's something with C++ but that's a separate issue.

wangvsa commented 2 years ago

Yeah, I guess libc was the issue. Anyway, I probably should add "extern inline" to those functions just in case. Let me know if there's any error for C++. Thanks.

roblatham00 commented 2 years ago

whatever the C++ errors were, they are fixed in 'pilgrim'.