public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiler gcc
@ 2002-07-17  0:56 Mathias Bordier
  2002-07-23 13:19 ` Claudio Bley
  0 siblings, 1 reply; 2+ messages in thread
From: Mathias Bordier @ 2002-07-17  0:56 UTC (permalink / raw)
  To: gcc-help; +Cc: mathias_bordier

Hello,

I want to create a dynamic library with the compiler
gcc.2.7.2.3 on Sun-Solaris.2.5 for C++ code.
I use JNI (Java Native Interface) for interfacing Java
and C++. I compile and I link for creating a dynamic
library (it's OK) and when I want to use this library,
I see the message:

ld.so.1: fatal: relocation error: file mylib.so:
symbol __builtin_new: refrenced symbol not found

I understand that the dynamic library I have created
is not good !

Maybe I have made an error when I compile or link my
program C++:

I have write:
for compiling: g++ -I ... -c mylib.cc
and 
for linking: g++ -shared -o mylib.so mylib.o -lstc++
-lg++

If you have an idea about my problem ????

Thanks

Mathias Bordier
Mel:mathias_bordier@yahoo.fr

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Compiler gcc
  2002-07-17  0:56 Compiler gcc Mathias Bordier
@ 2002-07-23 13:19 ` Claudio Bley
  0 siblings, 0 replies; 2+ messages in thread
From: Claudio Bley @ 2002-07-23 13:19 UTC (permalink / raw)
  To: Mathias Bordier; +Cc: gcc-help

>>>>> "Mathias" == Mathias Bordier <mathias_bordier@yahoo.fr> writes:

    Mathias> Hello, I want to create a dynamic library with the
    Mathias> compiler gcc.2.7.2.3 on Sun-Solaris.2.5 for C++ code.  I
    Mathias> use JNI (Java Native Interface) for interfacing Java and
    Mathias> C++. I compile and I link for creating a dynamic library
    Mathias> (it's OK) and when I want to use this library, I see the
    Mathias> message:

    Mathias> ld.so.1: fatal: relocation error: file mylib.so: symbol
    Mathias> __builtin_new: refrenced symbol not found

    Mathias> I understand that the dynamic library I have created is
    Mathias> not good !

    Mathias> Maybe I have made an error when I compile or link my
    Mathias> program C++:

    Mathias> I have write: for compiling: g++ -I ... -c mylib.cc 

Try with -fPIC in order to produce position independent code.

    Mathias> for linking: g++ -shared -o mylib.so mylib.o -lstc++
    Mathias> -lg++

I think you don't need to specify stdc++ (it's a typo in your command
isn't it?) and g++ library in this step - it doesn't hurt though.

HTH
Claudio

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-23 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-17  0:56 Compiler gcc Mathias Bordier
2002-07-23 13:19 ` Claudio Bley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).