I know that OS X's linker is quite different than the Linux linker -- you might want to dig into the ld(1) man page on OS X as a starting point, and/or consult developer.apple.com for more details.

On Dec 5, 2007, at 10:04 AM, Matthias Jurenz wrote:

Hi Jeff,

I have added checks for the functions open64, creat64, etc. to the VT's configure script, so building of VT works fine on MacOS AND Solaris (Terry had the same problem).
Thanks for your hint ;-)

Unfortunately, there is a new problem on MacOS. I get the following linker errors, if I try
to link an application with the VT libraries:

gcc -finstrument-functions pi_seq.o -lm -o pi_seq
-L/Users/jurenz/lib/vtrace-5.4.1/lib -lvt -lotf -lz -L/usr/local/ lib/ -lbfd -lintl -L/usr/local/lib/ -liberty
/usr/bin/ld: multiple definitions of symbol _close
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(close.So) definition of _close /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _close in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fclose
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fclose.So) definition of _fclose /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fclose in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fdopen
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fdopen.So) definition of _fdopen /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fdopen in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fgets
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fgets.So) definition of _fgets /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fgets in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fopen
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fopen.So) definition of _fopen /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fopen in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fprintf
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../ libm.dylib(fprintf.So) definition of _fprintf /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fprintf in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fputc
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fputc.So) definition of _fputc /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fputc in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fread
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fread.So) definition of _fread /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fread in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _fwrite
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fwrite.So) definition of _fwrite /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fwrite in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _open
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(open.So) definition of _open /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _open in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _read
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(read.So) definition of _read /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _read in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _rewind
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(rewind.So) definition of _rewind /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _rewind in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _write
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(write.So) definition of _write /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _write in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _writev
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(writev.So) definition of _writev /Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _writev in section (__TEXT,__text)
/usr/bin/ld: warning multiple definitions of symbol _lseek
/Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _lseek in section (__TEXT,__text) /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(lseek.So) definition of _lseek
/usr/bin/ld: warning multiple definitions of symbol _fseek
/Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fseek in section (__TEXT,__text) /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fseek.So) definition of _fseek
/usr/bin/ld: warning multiple definitions of symbol _fseeko
/Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fseeko in section (__TEXT,__text) /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fseek.So) definition of _fseeko
/usr/bin/ld: warning multiple definitions of symbol _fscanf
/Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _fscanf in section (__TEXT,__text) /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(fscanf.So) definition of _fscanf
/usr/bin/ld: warning multiple definitions of symbol _putc
/Users/jurenz/lib/vtrace-5.4.1/lib/libvt.a(vt_iowrap.o) definition of _putc in section (__TEXT,__text) /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libm.dylib(putc.So) definition of _putc
collect2: ld returned 1 exit status
make: *** [pi_seq] Error 1

To intercept I/O calls, VT overwrites the Libc's I/O functions in the source file vtlib/vt_iowrap.c. It seems that the GNU compiler on MacOS doen't like that ?? Has anyone an idea what's wrong ?
I have used the GNU compiler version 4.0.1 on MacOS 9 (darwin 8.11.1).
To avoid this problem, I/O tracing will be disabled on MacOS... but that's not a nice solution :-(


Regards,
Matthias

> Unfortunately, VT fails to compile on OS X Leopard (10.5.1).
>
> - Is there a way to remove the anonymous variadic macros?
> - open64, creat64, etc. do not appear to exist on OS X.
>
> I don't know if you want to go through the work of supporting OS X or
> not -- if not, we should put in appropriate controls so that VT will
> "turn itself off" when it detects that it is on a system that does not
> support what it needs (e.g., open64, creat64, ...etc.).
>
> Here's the output from a build on OS X 10.5.1:
>
> Making all in vtlib
> gcc -DHAVE_CONFIG_H -I. -I.. -I../tools/opari/lib -I../extlib/otf/
> otflib -I../extlib/otf/otflib -DBINDIR=\"/Users/jsquyres/ bogus/bin
> \" -DDATADIR=\"/Users/jsquyres/bogus/share/vampirtrace\" -DRFG   -
> DVT_IOWRAP -g -Wall -Wundef -Wno-long-long -Wsign-compare - Wmissing- > prototypes -Wstrict-prototypes -Wcomment -pedantic -Wno-long- double -
> Werror-implicit-function-declaration -finline-functions -fno-strict-
> aliasing  -MT vt_iowrap.o -MD -MP -MF .deps/vt_iowrap.Tpo -c -o
> vt_iowrap.o vt_iowrap.c
> In file included from vt_iowrap.c:32:
> vt_iowrap.h:239:20: warning: anonymous variadic macros were introduced
> in C99
> vt_iowrap.h:282:43: warning: anonymous variadic macros were introduced
> in C99
> vt_iowrap.h:328:33: warning: anonymous variadic macros were introduced
> in C99
> vt_iowrap.h:335:38: warning: anonymous variadic macros were introduced
> in C99
> vt_iowrap.c: In function ‘open’:
> vt_iowrap.c:170: warning: ‘mode_t’ is promoted to ‘int’ when passed
> through ‘...’
> vt_iowrap.c:170: warning: (so you should pass ‘int’ not ‘mode_t’ to
> ‘va_arg’)
> vt_iowrap.c:170: note: if this code is reached, the program will abort
> vt_iowrap.c: At top level:
> vt_iowrap.c:193: warning: no previous prototype for ‘open64’
> vt_iowrap.c: In function ‘open64’:
> vt_iowrap.c:204: warning: ‘mode_t’ is promoted to ‘int’ when passed
> through ‘...’
> vt_iowrap.c:204: note: if this code is reached, the program will abort
> vt_iowrap.c: At top level:
> vt_iowrap.c:249: warning: no previous prototype for ‘creat64’
> vt_iowrap.c:368: error: syntax error before ‘lseek64’
> vt_iowrap.c:368: error: syntax error before ‘off64_t’
> vt_iowrap.c:369: warning: return type defaults to ‘int’
> vt_iowrap.c:369: warning: function declaration isn’t a prototype
> vt_iowrap.c: In function ‘lseek64’:
> vt_iowrap.c:371: error: ‘off64_t’ undeclared (first use in this
> function)
> vt_iowrap.c:371: error: (Each undeclared identifier is reported only
> once
> vt_iowrap.c:371: error: for each function it appears in.)
> vt_iowrap.c:371: error: syntax error before ‘ret’
> vt_iowrap.c:376: error: implicit declaration of function ‘off64_t’
> vt_iowrap.c:376: error: syntax error before ‘)’ token
> vt_iowrap.c:383: error: ‘ret’ undeclared (first use in this function)
> vt_iowrap.c:383: error: syntax error before ‘)’ token
> vt_iowrap.c:385: error: ‘fd’ undeclared (first use in this function)
> vt_iowrap.c:389: warning: control reaches end of non-void function
> vt_iowrap.c: At top level:
> vt_iowrap.c:542: error: syntax error before ‘off64_t’
> vt_iowrap.c:543: warning: function declaration isn’t a prototype
> vt_iowrap.c: In function ‘pread64’:
> vt_iowrap.c:550: error: syntax error before ‘off64_t’
> vt_iowrap.c:550: warning: function declaration isn’t a prototype
> vt_iowrap.c:550: error: ‘fd’ undeclared (first use in this function)
> vt_iowrap.c:550: error: ‘buf’ undeclared (first use in this function) > vt_iowrap.c:550: error: ‘count’ undeclared (first use in this function) > vt_iowrap.c:550: error: ‘offset’ undeclared (first use in this function)
> vt_iowrap.c:557: error: syntax error before ‘off64_t’
> vt_iowrap.c:557: warning: function declaration isn’t a prototype
> vt_iowrap.c: At top level:
> vt_iowrap.c:567: error: syntax error before ‘off64_t’
> vt_iowrap.c:568: warning: function declaration isn’t a prototype
> vt_iowrap.c: In function ‘pwrite64’:
> vt_iowrap.c:575: error: syntax error before ‘off64_t’
> vt_iowrap.c:575: warning: function declaration isn’t a prototype
> vt_iowrap.c:575: error: ‘fd’ undeclared (first use in this function)
> vt_iowrap.c:575: error: ‘buf’ undeclared (first use in this function) > vt_iowrap.c:575: error: ‘count’ undeclared (first use in this function) > vt_iowrap.c:575: error: ‘offset’ undeclared (first use in this function)
> vt_iowrap.c:582: error: syntax error before ‘off64_t’
> vt_iowrap.c:582: warning: function declaration isn’t a prototype
> vt_iowrap.c: At top level:
> vt_iowrap.c:617: warning: no previous prototype for ‘fopen64’
> vt_iowrap.c:743: error: syntax error before ‘off64_t’
> vt_iowrap.c:744: warning: function declaration isn’t a prototype
> vt_iowrap.c: In function ‘fseeko64’:
> vt_iowrap.c:751: error: syntax error before ‘off64_t’
> vt_iowrap.c:751: warning: function declaration isn’t a prototype
> vt_iowrap.c:751: error: ‘stream’ undeclared (first use in this function) > vt_iowrap.c:751: error: ‘offset’ undeclared (first use in this function) > vt_iowrap.c:751: error: ‘whence’ undeclared (first use in this function)
> vt_iowrap.c:760: error: syntax error before ‘off64_t’
> vt_iowrap.c:760: warning: function declaration isn’t a prototype
> vt_iowrap.c: At top level:
> vt_iowrap.c:815: warning: type defaults to ‘int’ in declaration of
> ‘fpos64_t’
> vt_iowrap.c:815: error: syntax error before ‘*’ token
> vt_iowrap.c:815: warning: function declaration isn’t a prototype
> vt_iowrap.c: In function ‘fsetpos64’:
> vt_iowrap.c:822: warning: type defaults to ‘int’ in declaration of
> ‘fpos64_t’
> vt_iowrap.c:822: error: syntax error before ‘*’ token
> vt_iowrap.c:822: warning: function declaration isn’t a prototype
> vt_iowrap.c:822: error: ‘stream’ undeclared (first use in this function) > vt_iowrap.c:822: error: ‘pos’ undeclared (first use in this function)
> vt_iowrap.c:831: warning: type defaults to ‘int’ in declaration of
> ‘fpos64_t’
> vt_iowrap.c:831: error: syntax error before ‘*’ token
> vt_iowrap.c:831: warning: function declaration isn’t a prototype
> make[5]: *** [vt_iowrap.o] Error 1
> make[4]: *** [all-recursive] Error 1
> make[3]: *** [all] Error 2
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> [22:44] beezle:~/svn/vt-integration %
>
>
> --
> Jeff Squyres
> Cisco Systems
>
>
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/devel


--
Jeff Squyres
Cisco Systems

Reply via email to