* Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
@ 1999-10-28 5:37 Dr. Armin Tschammer
1999-10-31 13:57 ` Dr. Armin Tschammer
1999-11-10 11:22 ` jd_wells
0 siblings, 2 replies; 13+ messages in thread
From: Dr. Armin Tschammer @ 1999-10-28 5:37 UTC (permalink / raw)
To: help-gcc
Hi,
Now I succeded in compiling and installing the gcc 2.95.1 on a hpux
10.20 box.
I would like to create shared libraries and I did the following:
g++ -fpic -c a.C
g++ -fpic -c b.C
g++ -shared a.o b.o -o x.sl
I got the following message:
/usr/ccs/bin/ld: DP relative code in file /var/tmp/cc2TTYoc.o - shared
library must be position
independent. Use +z or +Z to recompile.
collect2: ld returned 1 exit status
Any hints ??
Thanks
Armin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-10-28 5:37 Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !! Dr. Armin Tschammer
@ 1999-10-31 13:57 ` Dr. Armin Tschammer
1999-11-10 11:22 ` jd_wells
1 sibling, 0 replies; 13+ messages in thread
From: Dr. Armin Tschammer @ 1999-10-31 13:57 UTC (permalink / raw)
To: help-gcc
Hi,
Now I succeded in compiling and installing the gcc 2.95.1 on a hpux
10.20 box.
I would like to create shared libraries and I did the following:
g++ -fpic -c a.C
g++ -fpic -c b.C
g++ -shared a.o b.o -o x.sl
I got the following message:
/usr/ccs/bin/ld: DP relative code in file /var/tmp/cc2TTYoc.o - shared
library must be position
independent. Use +z or +Z to recompile.
collect2: ld returned 1 exit status
Any hints ??
Thanks
Armin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-10-28 5:37 Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !! Dr. Armin Tschammer
1999-10-31 13:57 ` Dr. Armin Tschammer
@ 1999-11-10 11:22 ` jd_wells
1999-11-10 11:22 ` jd_wells
` (3 more replies)
1 sibling, 4 replies; 13+ messages in thread
From: jd_wells @ 1999-11-10 11:22 UTC (permalink / raw)
To: help-gcc
I am currently experiencing the exact same
problem. Did you ever find out what the problem
is?
Any help would be appreciated...
JD Wells
In article
<38183EF6.39D5007F@oi42.kwu.siemens.de>,
"Dr. Armin Tschammer"
<tscha00a@oi42.kwu.siemens.de> wrote:
> Hi,
> Now I succeded in compiling and installing the
gcc 2.95.1 on a hpux
> 10.20 box.
> I would like to create shared libraries and I
did the following:
>
> g++ -fpic -c a.C
> g++ -fpic -c b.C
> g++ -shared a.o b.o -o x.sl
>
> I got the following message:
>
> /usr/ccs/bin/ld: DP relative code in
file /var/tmp/cc2TTYoc.o - shared
> library must be position
> independent. Use +z or +Z to recompile.
> collect2: ld returned 1 exit status
>
> Any hints ??
>
> Thanks
>
> Armin
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 11:22 ` jd_wells
@ 1999-11-10 11:22 ` jd_wells
1999-11-10 12:03 ` Eric Ladner
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: jd_wells @ 1999-11-10 11:22 UTC (permalink / raw)
To: help-gcc
I am currently experiencing the exact same
problem. Did you ever find out what the problem
is?
Any help would be appreciated...
JD Wells
In article
< 38183EF6.39D5007F@oi42.kwu.siemens.de >,
"Dr. Armin Tschammer"
<tscha00a@oi42.kwu.siemens.de> wrote:
> Hi,
> Now I succeded in compiling and installing the
gcc 2.95.1 on a hpux
> 10.20 box.
> I would like to create shared libraries and I
did the following:
>
> g++ -fpic -c a.C
> g++ -fpic -c b.C
> g++ -shared a.o b.o -o x.sl
>
> I got the following message:
>
> /usr/ccs/bin/ld: DP relative code in
file /var/tmp/cc2TTYoc.o - shared
> library must be position
> independent. Use +z or +Z to recompile.
> collect2: ld returned 1 exit status
>
> Any hints ??
>
> Thanks
>
> Armin
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 11:22 ` jd_wells
1999-11-10 11:22 ` jd_wells
@ 1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:03 ` Eric Ladner
` (2 more replies)
1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-30 23:28 ` jd_wells
3 siblings, 3 replies; 13+ messages in thread
From: Eric Ladner @ 1999-11-10 12:03 UTC (permalink / raw)
To: help-gcc
Try this instead:
g++ -fpic -c a.C
g++ -fpic -c b.C
ld -b a.o b.o -o x.sl
This works for me. I've had problems in the past with g(cc/++)'s
-shared
flag on HP-UX. This makes the linker do it.
Eric
jd_wells@my-deja.com wrote:
> I am currently experiencing the exact same
> problem. Did you ever find out what the problem
> is?
>
> Any help would be appreciated...
> JD Wells
>
> In article
> <38183EF6.39D5007F@oi42.kwu.siemens.de>,
> "Dr. Armin Tschammer"
> <tscha00a@oi42.kwu.siemens.de> wrote:
> > Hi,
> > Now I succeded in compiling and installing the
> gcc 2.95.1 on a hpux
> > 10.20 box.
> > I would like to create shared libraries and I
> did the following:
> >
> > g++ -fpic -c a.C
> > g++ -fpic -c b.C
> > g++ -shared a.o b.o -o x.sl
> >
> > I got the following message:
> >
> > /usr/ccs/bin/ld: DP relative code in
> file /var/tmp/cc2TTYoc.o - shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > collect2: ld returned 1 exit status
> >
> > Any hints ??
> >
> > Thanks
> >
> > Armin
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
================================================================
Eric Ladner | HPUX Systems Admin, Oracle DBA
Pascagoula Refinery | Java Programmer, Perl scripter, C++
Chevron Products Company | programmer, etc., etc., etc.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 12:03 ` Eric Ladner
@ 1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:17 ` Jeffrey A Law
1999-11-30 23:28 ` Eric Ladner
2 siblings, 0 replies; 13+ messages in thread
From: Eric Ladner @ 1999-11-10 12:03 UTC (permalink / raw)
To: help-gcc
Try this instead:
g++ -fpic -c a.C
g++ -fpic -c b.C
ld -b a.o b.o -o x.sl
This works for me. I've had problems in the past with g(cc/++)'s
-shared
flag on HP-UX. This makes the linker do it.
Eric
jd_wells@my-deja.com wrote:
> I am currently experiencing the exact same
> problem. Did you ever find out what the problem
> is?
>
> Any help would be appreciated...
> JD Wells
>
> In article
> < 38183EF6.39D5007F@oi42.kwu.siemens.de >,
> "Dr. Armin Tschammer"
> <tscha00a@oi42.kwu.siemens.de> wrote:
> > Hi,
> > Now I succeded in compiling and installing the
> gcc 2.95.1 on a hpux
> > 10.20 box.
> > I would like to create shared libraries and I
> did the following:
> >
> > g++ -fpic -c a.C
> > g++ -fpic -c b.C
> > g++ -shared a.o b.o -o x.sl
> >
> > I got the following message:
> >
> > /usr/ccs/bin/ld: DP relative code in
> file /var/tmp/cc2TTYoc.o - shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > collect2: ld returned 1 exit status
> >
> > Any hints ??
> >
> > Thanks
> >
> > Armin
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
================================================================
Eric Ladner | HPUX Systems Admin, Oracle DBA
Pascagoula Refinery | Java Programmer, Perl scripter, C++
Chevron Products Company | programmer, etc., etc., etc.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:03 ` Eric Ladner
@ 1999-11-10 12:17 ` Jeffrey A Law
1999-11-30 23:28 ` Jeffrey A Law
1999-11-30 23:28 ` Eric Ladner
2 siblings, 1 reply; 13+ messages in thread
From: Jeffrey A Law @ 1999-11-10 12:17 UTC (permalink / raw)
To: Eric Ladner; +Cc: help-gcc
In message < 3829CF78.77507FC5@chevron.com >you write:
> Try this instead:
>
> g++ -fpic -c a.C
> g++ -fpic -c b.C
> ld -b a.o b.o -o x.sl
>
> This works for me. I've had problems in the past with g(cc/++)'s
This is wrong. Your ctors and dtors in the shared library will not work.
The solution for this problem is in the FAQ. It's not hard. The entry
"why can't I build a shared library".
jeff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 11:22 ` jd_wells
1999-11-10 11:22 ` jd_wells
1999-11-10 12:03 ` Eric Ladner
@ 1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-30 23:28 ` Joerg Faschingbauer
1999-11-30 23:28 ` jd_wells
3 siblings, 2 replies; 13+ messages in thread
From: Joerg Faschingbauer @ 1999-11-11 1:27 UTC (permalink / raw)
To: help-gcc
jd_wells@my-deja.com writes:
> I am currently experiencing the exact same
> problem. Did you ever find out what the problem
> is?
>
> Any help would be appreciated...
> JD Wells
>
>
> In article
> <38183EF6.39D5007F@oi42.kwu.siemens.de>,
> "Dr. Armin Tschammer"
> <tscha00a@oi42.kwu.siemens.de> wrote:
> > Hi,
> > Now I succeded in compiling and installing the
> gcc 2.95.1 on a hpux
> > 10.20 box.
> > I would like to create shared libraries and I
> did the following:
> >
> > g++ -fpic -c a.C
> > g++ -fpic -c b.C
> > g++ -shared a.o b.o -o x.sl
> >
> > I got the following message:
> >
> > /usr/ccs/bin/ld: DP relative code in
> file /var/tmp/cc2TTYoc.o - shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > collect2: ld returned 1 exit status
> >
> > Any hints ??
A common trap in building shared C++ libs is that gcc itself (and
libstdc++.a) does not bootstrap PICly by default. You have to tell it
to. Configure as usual, and
make bootstrap CFLAGS=-fPIC CXXFLAGS=-fPIC
Also, pass -fPIC (-fpic?) on the link line as well because, when
linking, g++ (collect2) generates code for the ctors of global objects
to be called properly. This code has to be compiled PICly.
I don't know if this cures all of your problems for the HP, but it
sure helps along the way. I once managed to make a HP shared lib with
gcc 2.7.2.3, and ended up with a weird link line that read as follows,
for whatever reason.
g++ -fPIC -shared <the files> -l<library1> ... \
-Xlinker +I -Xlinker _GLOBAL__DI \
-u __eprintf -u __pure_virtual -u __builtin_delete \
-u __builtin_new -u __builtin_vec_delete -u __builtin_vec_new \
-u __muldi3 -u __udivdi3 -u __umoddi3 -lgcc \
the_shared_lib.sl
Joerg
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-11 1:27 ` Joerg Faschingbauer
@ 1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-30 23:28 ` Joerg Faschingbauer
1 sibling, 0 replies; 13+ messages in thread
From: Joerg Faschingbauer @ 1999-11-11 1:27 UTC (permalink / raw)
To: help-gcc
jd_wells@my-deja.com writes:
> I am currently experiencing the exact same
> problem. Did you ever find out what the problem
> is?
>
> Any help would be appreciated...
> JD Wells
>
>
> In article
> < 38183EF6.39D5007F@oi42.kwu.siemens.de >,
> "Dr. Armin Tschammer"
> <tscha00a@oi42.kwu.siemens.de> wrote:
> > Hi,
> > Now I succeded in compiling and installing the
> gcc 2.95.1 on a hpux
> > 10.20 box.
> > I would like to create shared libraries and I
> did the following:
> >
> > g++ -fpic -c a.C
> > g++ -fpic -c b.C
> > g++ -shared a.o b.o -o x.sl
> >
> > I got the following message:
> >
> > /usr/ccs/bin/ld: DP relative code in
> file /var/tmp/cc2TTYoc.o - shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > collect2: ld returned 1 exit status
> >
> > Any hints ??
A common trap in building shared C++ libs is that gcc itself (and
libstdc++.a) does not bootstrap PICly by default. You have to tell it
to. Configure as usual, and
make bootstrap CFLAGS=-fPIC CXXFLAGS=-fPIC
Also, pass -fPIC (-fpic?) on the link line as well because, when
linking, g++ (collect2) generates code for the ctors of global objects
to be called properly. This code has to be compiled PICly.
I don't know if this cures all of your problems for the HP, but it
sure helps along the way. I once managed to make a HP shared lib with
gcc 2.7.2.3, and ended up with a weird link line that read as follows,
for whatever reason.
g++ -fPIC -shared <the files> -l<library1> ... \
-Xlinker +I -Xlinker _GLOBAL__DI \
-u __eprintf -u __pure_virtual -u __builtin_delete \
-u __builtin_new -u __builtin_vec_delete -u __builtin_vec_new \
-u __muldi3 -u __udivdi3 -u __umoddi3 -lgcc \
the_shared_lib.sl
Joerg
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-11 1:27 ` Joerg Faschingbauer
@ 1999-11-30 23:28 ` Joerg Faschingbauer
1 sibling, 0 replies; 13+ messages in thread
From: Joerg Faschingbauer @ 1999-11-30 23:28 UTC (permalink / raw)
To: help-gcc
jd_wells@my-deja.com writes:
> I am currently experiencing the exact same
> problem. Did you ever find out what the problem
> is?
>
> Any help would be appreciated...
> JD Wells
>
>
> In article
> <38183EF6.39D5007F@oi42.kwu.siemens.de>,
> "Dr. Armin Tschammer"
> <tscha00a@oi42.kwu.siemens.de> wrote:
> > Hi,
> > Now I succeded in compiling and installing the
> gcc 2.95.1 on a hpux
> > 10.20 box.
> > I would like to create shared libraries and I
> did the following:
> >
> > g++ -fpic -c a.C
> > g++ -fpic -c b.C
> > g++ -shared a.o b.o -o x.sl
> >
> > I got the following message:
> >
> > /usr/ccs/bin/ld: DP relative code in
> file /var/tmp/cc2TTYoc.o - shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > collect2: ld returned 1 exit status
> >
> > Any hints ??
A common trap in building shared C++ libs is that gcc itself (and
libstdc++.a) does not bootstrap PICly by default. You have to tell it
to. Configure as usual, and
make bootstrap CFLAGS=-fPIC CXXFLAGS=-fPIC
Also, pass -fPIC (-fpic?) on the link line as well because, when
linking, g++ (collect2) generates code for the ctors of global objects
to be called properly. This code has to be compiled PICly.
I don't know if this cures all of your problems for the HP, but it
sure helps along the way. I once managed to make a HP shared lib with
gcc 2.7.2.3, and ended up with a weird link line that read as follows,
for whatever reason.
g++ -fPIC -shared <the files> -l<library1> ... \
-Xlinker +I -Xlinker _GLOBAL__DI \
-u __eprintf -u __pure_virtual -u __builtin_delete \
-u __builtin_new -u __builtin_vec_delete -u __builtin_vec_new \
-u __muldi3 -u __udivdi3 -u __umoddi3 -lgcc \
the_shared_lib.sl
Joerg
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 11:22 ` jd_wells
` (2 preceding siblings ...)
1999-11-11 1:27 ` Joerg Faschingbauer
@ 1999-11-30 23:28 ` jd_wells
3 siblings, 0 replies; 13+ messages in thread
From: jd_wells @ 1999-11-30 23:28 UTC (permalink / raw)
To: help-gcc
I am currently experiencing the exact same
problem. Did you ever find out what the problem
is?
Any help would be appreciated...
JD Wells
In article
<38183EF6.39D5007F@oi42.kwu.siemens.de>,
"Dr. Armin Tschammer"
<tscha00a@oi42.kwu.siemens.de> wrote:
> Hi,
> Now I succeded in compiling and installing the
gcc 2.95.1 on a hpux
> 10.20 box.
> I would like to create shared libraries and I
did the following:
>
> g++ -fpic -c a.C
> g++ -fpic -c b.C
> g++ -shared a.o b.o -o x.sl
>
> I got the following message:
>
> /usr/ccs/bin/ld: DP relative code in
file /var/tmp/cc2TTYoc.o - shared
> library must be position
> independent. Use +z or +Z to recompile.
> collect2: ld returned 1 exit status
>
> Any hints ??
>
> Thanks
>
> Armin
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:17 ` Jeffrey A Law
@ 1999-11-30 23:28 ` Eric Ladner
2 siblings, 0 replies; 13+ messages in thread
From: Eric Ladner @ 1999-11-30 23:28 UTC (permalink / raw)
To: help-gcc
Try this instead:
g++ -fpic -c a.C
g++ -fpic -c b.C
ld -b a.o b.o -o x.sl
This works for me. I've had problems in the past with g(cc/++)'s
-shared
flag on HP-UX. This makes the linker do it.
Eric
jd_wells@my-deja.com wrote:
> I am currently experiencing the exact same
> problem. Did you ever find out what the problem
> is?
>
> Any help would be appreciated...
> JD Wells
>
> In article
> <38183EF6.39D5007F@oi42.kwu.siemens.de>,
> "Dr. Armin Tschammer"
> <tscha00a@oi42.kwu.siemens.de> wrote:
> > Hi,
> > Now I succeded in compiling and installing the
> gcc 2.95.1 on a hpux
> > 10.20 box.
> > I would like to create shared libraries and I
> did the following:
> >
> > g++ -fpic -c a.C
> > g++ -fpic -c b.C
> > g++ -shared a.o b.o -o x.sl
> >
> > I got the following message:
> >
> > /usr/ccs/bin/ld: DP relative code in
> file /var/tmp/cc2TTYoc.o - shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > collect2: ld returned 1 exit status
> >
> > Any hints ??
> >
> > Thanks
> >
> > Armin
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
================================================================
Eric Ladner | HPUX Systems Admin, Oracle DBA
Pascagoula Refinery | Java Programmer, Perl scripter, C++
Chevron Products Company | programmer, etc., etc., etc.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !!
1999-11-10 12:17 ` Jeffrey A Law
@ 1999-11-30 23:28 ` Jeffrey A Law
0 siblings, 0 replies; 13+ messages in thread
From: Jeffrey A Law @ 1999-11-30 23:28 UTC (permalink / raw)
To: Eric Ladner; +Cc: help-gcc
In message < 3829CF78.77507FC5@chevron.com >you write:
> Try this instead:
>
> g++ -fpic -c a.C
> g++ -fpic -c b.C
> ld -b a.o b.o -o x.sl
>
> This works for me. I've had problems in the past with g(cc/++)'s
This is wrong. Your ctors and dtors in the shared library will not work.
The solution for this problem is in the FAQ. It's not hard. The entry
"why can't I build a shared library".
jeff
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~1999-11-30 23:28 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-28 5:37 Linking shared libraries on hpux 10.20 with gcc 2.92.1 fails !! Dr. Armin Tschammer
1999-10-31 13:57 ` Dr. Armin Tschammer
1999-11-10 11:22 ` jd_wells
1999-11-10 11:22 ` jd_wells
1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:03 ` Eric Ladner
1999-11-10 12:17 ` Jeffrey A Law
1999-11-30 23:28 ` Jeffrey A Law
1999-11-30 23:28 ` Eric Ladner
1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-11 1:27 ` Joerg Faschingbauer
1999-11-30 23:28 ` Joerg Faschingbauer
1999-11-30 23:28 ` jd_wells
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).