Shared lib help

Atfer transforming my library (.a) into share library (.so) by recompiling
my lib with “-shared -fPIC”.
My program to a sementation violation before the main. I have put a cout at
the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.

“Rejean Senecal” <rsenecal@oerlikon.ca-no-spam> wrote in message
news:at55jb$rvm$1@inn.qnx.com

Atfer transforming my library (.a) into share library (.so) by recompiling
my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?

My program to a sementation violation before the main. I have put a cout
at
the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.

Yes I did.
I compile all objects in my library with -shared and -fPIC. And link the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L pathtolib” to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share libraries
are.



“Kris Warkentin” <kewarken@qnx.com> wrote in message
news:at580o$ffs$1@nntp.qnx.com

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …
Atfer transforming my library (.a) into share library (.so) by
recompiling
my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?

My program to a sementation violation before the main. I have put a cout
at
the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.
\

You probably need to build the ‘a.shared’ variants of your second-level
libraries. And then link them to make the .so, like you have.

Basically, I found the hard way that if a .so needs to call symbols from
another library, than that second library needs to have been built as a
‘a.shared’ variant.


Rejean Senecal wrote:

Yes I did.
I compile all objects in my library with -shared and -fPIC. And link the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L pathtolib” to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share libraries
are.



“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at580o$ffs$> 1@nntp.qnx.com> …

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …

Atfer transforming my library (.a) into share library (.so) by

recompiling

my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?


My program to a sementation violation before the main. I have put a cout

at

the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.


\

Yes some symbols from the library need other symbols a another of my
library.
How do I build the ‘a.shared’ variant. Do I just do ‘a: ar -r mystaticlib
*.obj’ with the same .o I used to build the shared llibrary?

“Rommel Dongre” <rdongre@pillardata.com> wrote in message
news:at5fit$keg$1@nntp.qnx.com

You probably need to build the ‘a.shared’ variants of your second-level
libraries. And then link them to make the .so, like you have.

Basically, I found the hard way that if a .so needs to call symbols from
another library, than that second library needs to have been built as a
‘a.shared’ variant.


Rejean Senecal wrote:
Yes I did.
I compile all objects in my library with -shared and -fPIC. And link the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L pathtolib”
to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share
libraries
are.



“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at580o$ffs$> 1@nntp.qnx.com> …

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …

Atfer transforming my library (.a) into share library (.so) by

recompiling

my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?


My program to a sementation violation before the main. I have put a
cout

at

the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.



\

Aha. This is what I meant earlier when I was asking whether ALL objects in
the shared lib had been compiled PIC. If you’re using our recursive
makefile heirarchy, you can create an ‘a.shared’ directory which will
compile all the objects as PIC and create something like ‘libmylibS.a’ which
you can then link your main shared lib to. Basically you’re just making a
regular archive with shared code so when you link your main library to it
you don’t blow up.

cheers,

Kris

“Rejean Senecal” <rsenecal@oerlikon.ca-no-spam> wrote in message
news:at5gc6$a79$1@inn.qnx.com

Yes some symbols from the library need other symbols a another of my
library.
How do I build the ‘a.shared’ variant. Do I just do ‘a: ar -r mystaticlib
*.obj’ with the same .o I used to build the shared llibrary?

“Rommel Dongre” <> rdongre@pillardata.com> > wrote in message
news:at5fit$keg$> 1@nntp.qnx.com> …

You probably need to build the ‘a.shared’ variants of your second-level
libraries. And then link them to make the .so, like you have.

Basically, I found the hard way that if a .so needs to call symbols from
another library, than that second library needs to have been built as a
‘a.shared’ variant.


Rejean Senecal wrote:
Yes I did.
I compile all objects in my library with -shared and -fPIC. And link
the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L
pathtolib”
to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share
libraries
are.



“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at580o$ffs$> 1@nntp.qnx.com> …

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …

Atfer transforming my library (.a) into share library (.so) by

recompiling

my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?


My program to a sementation violation before the main. I have put a
cout

at

the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.





\

Can you explain to me why not using the recursive makefile heirarchy will
cause the code to BLOW UP.

“Kris Warkentin” <kewarken@qnx.com> wrote in message
news:at7mdc$42o$1@nntp.qnx.com

Aha. This is what I meant earlier when I was asking whether ALL objects
in
the shared lib had been compiled PIC. If you’re using our recursive
makefile heirarchy, you can create an ‘a.shared’ directory which will
compile all the objects as PIC and create something like ‘libmylibS.a’
which
you can then link your main shared lib to. Basically you’re just making a
regular archive with shared code so when you link your main library to it
you don’t blow up.

cheers,

Kris

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at5gc6$a79$> 1@inn.qnx.com> …
Yes some symbols from the library need other symbols a another of my
library.
How do I build the ‘a.shared’ variant. Do I just do ‘a: ar -r
mystaticlib
*.obj’ with the same .o I used to build the shared llibrary?

“Rommel Dongre” <> rdongre@pillardata.com> > wrote in message
news:at5fit$keg$> 1@nntp.qnx.com> …

You probably need to build the ‘a.shared’ variants of your
second-level
libraries. And then link them to make the .so, like you have.

Basically, I found the hard way that if a .so needs to call symbols
from
another library, than that second library needs to have been built as
a
‘a.shared’ variant.


Rejean Senecal wrote:
Yes I did.
I compile all objects in my library with -shared and -fPIC. And link
the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L
pathtolib”
to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share
libraries
are.



“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at580o$ffs$> 1@nntp.qnx.com> …

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …

Atfer transforming my library (.a) into share library (.so) by

recompiling

my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?


My program to a sementation violation before the main. I have put a
cout

at

the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.







\

Sure that you don’t use a static library in one of your shared lib?
Alain.

Rejean Senecal a écrit:

Yes I did.
I compile all objects in my library with -shared and -fPIC. And link the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L pathtolib” to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share libraries
are.



“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at580o$ffs$> 1@nntp.qnx.com> …


“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …


Atfer transforming my library (.a) into share library (.so) by


recompiling


my lib with “-shared -fPIC”.


You re-compiled each object in the shared lib with -shared?



My program to a sementation violation before the main. I have put a cout


at


the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my .so.






\

No. That has nothing to do with it. It’s just that the recursive Makefile
stuff is an easy way to build it. Otherwise, you just build all objects
with -shared but instead linking them into a “.so”, you archive them into a
“.a”. The non-pic code in a shared lib is what causes it to blow up.

cheers,

Kris

“Rejean Senecal” <rsenecal@oerlikon.ca-no-spam> wrote in message
news:at89dq$hco$1@inn.qnx.com

Can you explain to me why not using the recursive makefile heirarchy will
cause the code to BLOW UP.

“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at7mdc$42o$> 1@nntp.qnx.com> …
Aha. This is what I meant earlier when I was asking whether ALL objects
in
the shared lib had been compiled PIC. If you’re using our recursive
makefile heirarchy, you can create an ‘a.shared’ directory which will
compile all the objects as PIC and create something like ‘libmylibS.a’
which
you can then link your main shared lib to. Basically you’re just making
a
regular archive with shared code so when you link your main library to
it
you don’t blow up.

cheers,

Kris

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at5gc6$a79$> 1@inn.qnx.com> …
Yes some symbols from the library need other symbols a another of my
library.
How do I build the ‘a.shared’ variant. Do I just do ‘a: ar -r
mystaticlib
*.obj’ with the same .o I used to build the shared llibrary?

“Rommel Dongre” <> rdongre@pillardata.com> > wrote in message
news:at5fit$keg$> 1@nntp.qnx.com> …

You probably need to build the ‘a.shared’ variants of your
second-level
libraries. And then link them to make the .so, like you have.

Basically, I found the hard way that if a .so needs to call symbols
from
another library, than that second library needs to have been built
as
a
‘a.shared’ variant.


Rejean Senecal wrote:
Yes I did.
I compile all objects in my library with -shared and -fPIC. And
link
the
final .so like this
qcc -shared -Wl,-soname=libmylib.so -o libmylib.so

My executable link the the share lib by passing “-l mylib -L
pathtolib”
to
qcc.
And I changed my LD_LIBRARY_PATH to the directories where my share
libraries
are.



“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:at580o$ffs$> 1@nntp.qnx.com> …

“Rejean Senecal” <> rsenecal@oerlikon.ca-no-spam> > wrote in message
news:at55jb$rvm$> 1@inn.qnx.com> …

Atfer transforming my library (.a) into share library (.so) by

recompiling

my lib with “-shared -fPIC”.

You re-compiled each object in the shared lib with -shared?


My program to a sementation violation before the main. I have put
a
cout

at

the first line of my main and it doest event get there.
How can I debug this. Objdump show me that everything is in my
…so.









\