Please Ignore I linked .a's instead of individual .os, somehow it worked.
 CC -G -o libD.so -mt -norunpath -L. -la -lb


--- On Tue, 11/18/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Subject: [dtrace-discuss] Getting error ld: fatal: symbol `__SUNW_dof' is 
> multiply-defined:
> To: dtrace-discuss@opensolaris.org
> Date: Tuesday, November 18, 2008, 12:16 PM
> I have 2 .cpp  files in two different directories in which I
> need to put DTrace probes. They are compiled into two .a
> libraries one after another. In the end they are combined to
> a single .so file. This sequence I can not change. I get an
> error "ld: fatal: symbol `__SUNW_dof' is
> multiply-defined:". What is the solution for this?
> 
> Here is my simulation of real world problem in sample
> files.
> 
> $gmake
> CC -mt -xtarget=ultra -g -xs -c -o a.o a.cpp
> dtrace -G -32 -s 1.d a.o -o 1.o
> CC -xar -o liba.a a.o 1.o
> CC -mt -xtarget=ultra -g -xs -c -o b.o b.cpp
> dtrace -G -32 -s 2.d b.o -o 2.o
> CC -xar -o libb.a b.o 2.o
> CC  -G -o libc.so a.o b.o 1.o 2.o -mt -norunpath
> ld: fatal: symbol `__SUNW_dof' is multiply-defined:
>         (file 1.o type=OBJT; file 2.o type=OBJT);
> ld: fatal: File processing errors. No output written to
> libc.so
> gmake: *** [all] Error 1
> 
> $cat Makefile
> all::
>         CC -mt -xtarget=ultra -g -xs -c -o a.o a.cpp
>         dtrace -G -32 -s 1.d a.o -o 1.o
>         CC -xar -o liba.a a.o 1.o
>         CC -mt -xtarget=ultra -g -xs -c -o b.o b.cpp
>         dtrace -G -32 -s 2.d b.o -o 2.o
>         CC -xar -o libb.a b.o 2.o
>         CC  -G -o libc.so a.o b.o 1.o 2.o -mt -norunpath
> clean::
>         rm *.o *.a
> 
> $cat 1.d
> provider sjsws1 {
>     probe reached1(const char *);
> };
> 
> $cat 2.d
> provider sjsws2 {
>     probe reached2(const char *);
> };
> 
> $cat a.cpp
> #include <stdio.h>
> #include "sjsws.h"
> 
> main()
> {
>     DTRACE_REACHED1("one");
> }
> 
> $cat b.cpp
> #include <stdio.h>
> #include "sjsws.h"
> 
> void myfunc(void)
> {
>     DTRACE_REACHED2("two");
> }
> 
> $cat sjsws.h
> #ifndef SJSWS
> #define SJSWS 1
> 
> #include "sys/sdt.h"
> #ifdef  __cplusplus
> extern "C" {
> #endif
> 
> #define DTRACE_REACHED1(arg0) \
>         __dtrace_sjsws1___reached1(arg0)
> #define DTRACE_REACHED2(arg0) \
>         __dtrace_sjsws2___reached2(arg0)
> 
> extern void __dtrace_sjsws1___reached1(const char *);
> extern void __dtrace_sjsws2___reached2(const char *);
> 
> #ifdef  __cplusplus
> }
> #endif
> 
> #endif
> 
> 
> 
>       
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org


      
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to