public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Fun with shared libs on HPUX - Request for help
@ 2000-03-26 15:30 Robert A Nesius
  2000-03-26 21:32 ` Alexandre Oliva
  2000-04-01  0:00 ` Robert A Nesius
  0 siblings, 2 replies; 8+ messages in thread
From: Robert A Nesius @ 2000-03-26 15:30 UTC (permalink / raw)
  To: gcc-help

Howdy all, 
I managed to get a nice build of gcc 2.95.1 built by following 
(roughly) the following steps. 

On: HPUX 10.20 

Build binuntils 2.9.1 - install bin utils into area where gcc 
  will be installed.  

Configure gcc 2.95.1 like so: 
setenv CC gcc
../gcc-2.95.1/configure --prefix=/usr/intel/pkgs/gcc/2.95.1 --enable-shared 
--enable-threads --without-gnu-ld --with-gnu-as  
--with-as=/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/as 

And that seemed to work great!  But the problem I'm running 
into is that my libstdc++ lib is apparantly not really a 
shared library, even though -fPIC is getting set by the 
configure.  When I try to create a shared library that needs 
to pull in routines from libstdc++, I get errors indicating I 
need to build libstdc++ with +z or +Z.  

eg: 
[pdxhp204]-> ~ 55> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -shared -fpic -o libworld.
sl my_helloworld.o
/usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status

I'm having trouble bottoming out on what the best way to fix this 
is.  Build libstdc++ by itself separately after the main build 
and reinstall it, using aCC and +Z?  

Working around the build issues for HPUX has caused me to get into a 
slightly confused state as to how fix this.  Could some HPUX savvy 
people offer some insights?  

Thanks much! 

-Rob
-- 
#include <sig.h>
------------------------------------------------------------------
Robert Nesius             rnesius@ichips.intel.com    503.264.2830

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

* Re: Fun with shared libs on HPUX - Request for help
  2000-03-26 15:30 Fun with shared libs on HPUX - Request for help Robert A Nesius
@ 2000-03-26 21:32 ` Alexandre Oliva
  2000-03-27 10:09   ` Robert A Nesius
  2000-04-01  0:00   ` Alexandre Oliva
  2000-04-01  0:00 ` Robert A Nesius
  1 sibling, 2 replies; 8+ messages in thread
From: Alexandre Oliva @ 2000-03-26 21:32 UTC (permalink / raw)
  To: Robert A Nesius; +Cc: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

On Mar 26, 2000, Robert A Nesius <rnesius@ichips.intel.com> wrote:

> But the problem I'm running into is that my libstdc++ lib is
> apparantly not really a shared library, even though -fPIC is getting
> set by the configure.

> /usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
                                                                                                                         ^
See, it's linking with the static version of libstdc++, for some
reason.   e reason I don't understand.  Check whether libstdc++.sl
was installed, and, if it was, where it lives.

> I'm having trouble bottoming out on what the best way to fix this 
> is.  Build libstdc++ by itself separately after the main build 
> and reinstall it, using aCC and +Z?  

No, that definitely won't help, C++ compilers still don't produce
link-compatible code.

-- 
Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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

* Re: Fun with shared libs on HPUX - Request for help
  2000-03-26 21:32 ` Alexandre Oliva
@ 2000-03-27 10:09   ` Robert A Nesius
  2000-03-27 10:55     ` Alexandre Oliva
  2000-04-01  0:00     ` Robert A Nesius
  2000-04-01  0:00   ` Alexandre Oliva
  1 sibling, 2 replies; 8+ messages in thread
From: Robert A Nesius @ 2000-03-27 10:09 UTC (permalink / raw)
  To: gcc-help; +Cc: Alexandre Oliva

On 27 Mar 2000, Alexandre Oliva wrote:

> On Mar 26, 2000, Robert A Nesius <rnesius@ichips.intel.com> wrote:
> 
> > But the problem I'm running into is that my libstdc++ lib is
> > apparantly not really a shared library, even though -fPIC is getting
> > set by the configure.
> 
> > /usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
>                                                                                                                          ^
> See, it's linking with the static version of libstdc++, for some
> reason.   e reason I don't understand.  Check whether libstdc++.sl
> was installed, and, if it was, where it lives.

Gotcha.  From my gmake.out file (which captured all the stdio and
stderr from the build, I see libstdc++.a being created, and then 
presumably libstdc++.sl...  

mv tlist stdlist
rm -f tlibstdc++.a.2.10.0
ar rc tlibstdc++.a.2.10.0 `cat stdlist`
mv tlibstdc++.a.2.10.0 libstdc++.a.2.10.0
true libstdc++.a.2.10.0
rm -f libstdc++.a
ln -s libstdc++.a.2.10.0 libstdc++.a || cp libstdc++.a.2.10.0 libstdc++.a
rm -f tlist
cp stdlist tlist
if [ x"yes" = xyes ]; then \
  sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \
  mv tlist2 tlist ; \
else true ; fi
mv tlist piclist
/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/g
cc-2.95.1/hpux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/
 -g -O2 -fno-implicit-templates -fPIC -shared -o libstdc++.sl `cat piclist` 

But after that only two more references to libstdc++.sl exist in 
the 4 megabyte log: 

        if (cd ../${dir}/${lib}; gmake "SHELL=/bin/sh" "INSTALL=/bin/sh /fs3/com
p.apps_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c" "INSTALL_DATA=/bin/sh /fs3/c
omp.apps_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c -m 644" "INSTALL_PROGRAM=/b
in/sh /fs3/comp.apps_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c " "prefix=/usr/
intel/pkgs/gcc/2.95.1" "exec_prefix=/usr/intel/pkgs/gcc/2.95.1" "tooldir=/usr/in
tel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20" "gxx_include_dir=/usr/intel/pkgs/gcc/2
.95.1/include/g++-3" "libsubdir=/usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-h
p-hpux10.20/2.95.1" "gcc_version=2.95.1" "gcc_version_trigger=/fs3/comp.apps_bui
ld.1/gcc-2.95.1/gcc-2.95.1/gcc/version.c" "AR=ar" "AR_FLAGS=rc" "CC=/fs3/comp.ap
ps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.95.1/hp
ux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CXX=/fs3/
comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.
95.1/hpux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CF
LAGS=-g -O2" "CXXFLAGS=-g -O2" "NM=nm" "RANLIB=true" "LIBCFLAGS=-g -O2" "LIBCXXF
LAGS=-g -O2 -fno-implicit-templates" "LOADLIBES=" "LDFLAGS=" "MAKEINFO=/fs3/comp
.apps_build.1/gcc-2.95.1/hpux_10.20/texinfo/makeinfo/makeinfo  " "SHLIB=libstdc+
+.sl" "SHCURSES=" "RUNTESTFLAGS=" \
                        CFLAGS="-g -O2 ${flags}" \
                        CXXFLAGS="-g -O2 ${flags}" \
                        LIBCFLAGS="-g -O2 ${flags}" \
                        LIBCXXFLAGS="-g -O2 -fno-implicit-templates ${flags}" \
                        LDFLAGS=" ${flags}" \
                        all); then \
          true; \
        else \
          exit 1; \
        fi; \
      else true; \
      fi; \
    fi; \
  done; \
fi
if [ x"yes" = xyes ] && [ ! -d pic ]; then \
  mkdir pic; \
else true; fi
touch stamp-picdir
cd ../libio ; gmake "SHELL=/bin/sh" "INSTALL=/bin/sh /fs3/comp.apps_build.1/gcc-
2.95.1/gcc-2.95.1/install-sh -c" "INSTALL_DATA=/bin/sh /fs3/comp.apps_build.1/gc
c-2.95.1/gcc-2.95.1/install-sh -c -m 644" "INSTALL_PROGRAM=/bin/sh /fs3/comp.app
s_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c " "prefix=/usr/intel/pkgs/gcc/2.95
.1" "exec_prefix=/usr/intel/pkgs/gcc/2.95.1" "tooldir=/usr/intel/pkgs/gcc/2.95.1
/hppa1.1-hp-hpux10.20" "gxx_include_dir=/usr/intel/pkgs/gcc/2.95.1/include/g++-3
" "libsubdir=/usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1"
 "gcc_version=2.95.1" "gcc_version_trigger=/fs3/comp.apps_build.1/gcc-2.95.1/gcc
-2.95.1/gcc/version.c" "AR=ar" "AR_FLAGS=rc" "CC=/fs3/comp.apps_build.1/gcc-2.95
.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/ -B/us
r/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CXX=/fs3/comp.apps_build.1/g
cc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc
/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CFLAGS=-g -O2  -threa
ds" "CXXFLAGS=-g -O2  -threads" "NM=nm" "RANLIB=true" "LIBCFLAGS=-g -O2  -thread
s" "LIBCXXFLAGS=-g -O2 -fno-implicit-templates  -threads" "LOADLIBES=" "LDFLAGS=
-threads" "MAKEINFO=/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/texinfo/makeinf
o/makeinfo  " "SHLIB=libstdc++.sl" "SHCURSES=" "RUNTESTFLAGS=" iostream.list
gmake[5]: `iostream.list' is up to date.

From the make install: 
if [ x"yes" = xyes ]; then \
  sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \
  mv tlist2 tlist ; \
else true ; fi
mv tlist piclist
/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/g
cc-2.95.1/hpux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/
 -g -O2 -fno-implicit-templates -fPIC -shared -o libstdc++.sl `cat piclist` 

Checking the build area and the install area for the shared lib itself: 

# The build area:
[dtthp204]-> hpux_10.20 27> find . -name '*libstdc++*' -print
./hppa1.1-hp-hpux10.20/threads/libstdc++
./hppa1.1-hp-hpux10.20/threads/libstdc++/libstdc++.a
./hppa1.1-hp-hpux10.20/threads/libstdc++/libstdc++.sl
./hppa1.1-hp-hpux10.20/threads/libstdc++/libstdc++.a.2.10.0
./hppa1.1-hp-hpux10.20/libstdc++
./hppa1.1-hp-hpux10.20/libstdc++/libstdc++.a
./hppa1.1-hp-hpux10.20/libstdc++/libstdc++.sl
./hppa1.1-hp-hpux10.20/libstdc++/libstdc++.a.2.10.0
[dtthp204]-> hpux_10.20 28> cd /usr/intel/pkgs/gcc/2.95.1/

# The install area
[dtthp204]-> 2.95.1 29> find . -name '*libstdc++*' -print
./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/threads/libstdc++.a
./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a
./lib/threads/libstdc++.a.2.10.0
./lib/threads/libstdc++.sl
./lib/libstdc++.a.2.10.0
./lib/libstdc++.sl
[dtthp204]-> 2.95.1 30> cd lib

[dtthp204]-> lib 34> file libstdc++.sl
libstdc++.sl:   PA-RISC1.1 shared library -not stripped

[dtthp204]-> lib 37> file libstdc++.a.2.10.0 
libstdc++.a.2.10.0:     archive file -PA-RISC1.1 relocatable library

[dtthp204]-> ~ 38> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -c -shared -fpic my_helloworld.cpp
[dtthp204]-> ~ 39> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -shared -fpic -o libworld.sl my_helloworld.o
/usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status

Slightly more verbosely (using -v): 
[dtthp204]-> ~ 40> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -v -shared -fpic -o libworld.sl my_helloworld.o
Reading specs from /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/collect2 -ldce -z -b -o libworld.sl -L/usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/intel/pkgs/gcc/2.95.1/lib my_helloworld.o -lstdc++ -lm -lgcc -lgcc
/usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status



> > I'm having trouble bottoming out on what the best way to fix this 
> > is.  Build libstdc++ by itself separately after the main build 
> > and reinstall it, using aCC and +Z?  
> 
> No, that definitely won't help, C++ compilers still don't produce
> link-compatible code.

Understood. 

I checked the gcc FAQ on gnu.org and found this: 

---
Installing gcc on HP-UX without a precompiled gcc binary is somewhat tedious.
- Get gcc-XXX (2.95.2) and the GNU binutils. 
- Unpack GCC and configure for C only and --without-gnu-as. Build and install. 
- Use this Compiler to build and install then binutils. 
- Make sure you have GNU as in your PATH before the HP-UX as 
  (i.e.   /usr/local/bin is before /usr/bin and /usr/ccs/bin). 
- Reconfigure gcc --with-gnu-as and for the languages you need. 
- Rebuild and install the final version.
- You may rebuild and reinstall binutils with this compiler afterwards.
---

Hmm. Could rebuliding binutils possibly be the key?  Has anyone else
gotten shared libs working correctly on HPUX?  I'm thinking there
are people out there who must have by this point.

-Rob


-- 
#include <sig.h>
------------------------------------------------------------------
Robert Nesius             rnesius@ichips.intel.com    503.264.2830



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

* Re: Fun with shared libs on HPUX - Request for help
  2000-03-27 10:09   ` Robert A Nesius
@ 2000-03-27 10:55     ` Alexandre Oliva
  2000-04-01  0:00       ` Alexandre Oliva
  2000-04-01  0:00     ` Robert A Nesius
  1 sibling, 1 reply; 8+ messages in thread
From: Alexandre Oliva @ 2000-03-27 10:55 UTC (permalink / raw)
  To: Robert A Nesius; +Cc: gcc-help, Alexandre Oliva

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

On Mar 27, 2000, Robert A Nesius <rnesius@ichips.intel.com> wrote:

> ./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/threads/libstdc++.a
> ./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a
> ./lib/threads/libstdc++.a.2.10.0
> ./lib/threads/libstdc++.sl
> ./lib/libstdc++.a.2.10.0
> ./lib/libstdc++.sl

Just create links in the directories that contain the `.a's to the
`.sl' files in the corresponding directories, and you shall be fine.
libstdc++ installation should probably be adjusted to make the links.

-- 
Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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

* Re: Fun with shared libs on HPUX - Request for help
  2000-03-26 21:32 ` Alexandre Oliva
  2000-03-27 10:09   ` Robert A Nesius
@ 2000-04-01  0:00   ` Alexandre Oliva
  1 sibling, 0 replies; 8+ messages in thread
From: Alexandre Oliva @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Robert A Nesius; +Cc: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

On Mar 26, 2000, Robert A Nesius <rnesius@ichips.intel.com> wrote:

> But the problem I'm running into is that my libstdc++ lib is
> apparantly not really a shared library, even though -fPIC is getting
> set by the configure.

> /usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
                                                                                                                         ^
See, it's linking with the static version of libstdc++, for some
reason.   e reason I don't understand.  Check whether libstdc++.sl
was installed, and, if it was, where it lives.

> I'm having trouble bottoming out on what the best way to fix this 
> is.  Build libstdc++ by itself separately after the main build 
> and reinstall it, using aCC and +Z?  

No, that definitely won't help, C++ compilers still don't produce
link-compatible code.

-- 
Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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

* Re: Fun with shared libs on HPUX - Request for help
  2000-03-27 10:55     ` Alexandre Oliva
@ 2000-04-01  0:00       ` Alexandre Oliva
  0 siblings, 0 replies; 8+ messages in thread
From: Alexandre Oliva @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Robert A Nesius; +Cc: gcc-help, Alexandre Oliva

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

On Mar 27, 2000, Robert A Nesius <rnesius@ichips.intel.com> wrote:

> ./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/threads/libstdc++.a
> ./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a
> ./lib/threads/libstdc++.a.2.10.0
> ./lib/threads/libstdc++.sl
> ./lib/libstdc++.a.2.10.0
> ./lib/libstdc++.sl

Just create links in the directories that contain the `.a's to the
`.sl' files in the corresponding directories, and you shall be fine.
libstdc++ installation should probably be adjusted to make the links.

-- 
Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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

* Re: Fun with shared libs on HPUX - Request for help
  2000-03-27 10:09   ` Robert A Nesius
  2000-03-27 10:55     ` Alexandre Oliva
@ 2000-04-01  0:00     ` Robert A Nesius
  1 sibling, 0 replies; 8+ messages in thread
From: Robert A Nesius @ 2000-04-01  0:00 UTC (permalink / raw)
  To: gcc-help; +Cc: Alexandre Oliva

On 27 Mar 2000, Alexandre Oliva wrote:

> On Mar 26, 2000, Robert A Nesius <rnesius@ichips.intel.com> wrote:
> 
> > But the problem I'm running into is that my libstdc++ lib is
> > apparantly not really a shared library, even though -fPIC is getting
> > set by the configure.
> 
> > /usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
>                                                                                                                          ^
> See, it's linking with the static version of libstdc++, for some
> reason.   e reason I don't understand.  Check whether libstdc++.sl
> was installed, and, if it was, where it lives.

Gotcha.  From my gmake.out file (which captured all the stdio and
stderr from the build, I see libstdc++.a being created, and then 
presumably libstdc++.sl...  

mv tlist stdlist
rm -f tlibstdc++.a.2.10.0
ar rc tlibstdc++.a.2.10.0 `cat stdlist`
mv tlibstdc++.a.2.10.0 libstdc++.a.2.10.0
true libstdc++.a.2.10.0
rm -f libstdc++.a
ln -s libstdc++.a.2.10.0 libstdc++.a || cp libstdc++.a.2.10.0 libstdc++.a
rm -f tlist
cp stdlist tlist
if [ x"yes" = xyes ]; then \
  sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \
  mv tlist2 tlist ; \
else true ; fi
mv tlist piclist
/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/g
cc-2.95.1/hpux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/
 -g -O2 -fno-implicit-templates -fPIC -shared -o libstdc++.sl `cat piclist` 

But after that only two more references to libstdc++.sl exist in 
the 4 megabyte log: 

        if (cd ../${dir}/${lib}; gmake "SHELL=/bin/sh" "INSTALL=/bin/sh /fs3/com
p.apps_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c" "INSTALL_DATA=/bin/sh /fs3/c
omp.apps_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c -m 644" "INSTALL_PROGRAM=/b
in/sh /fs3/comp.apps_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c " "prefix=/usr/
intel/pkgs/gcc/2.95.1" "exec_prefix=/usr/intel/pkgs/gcc/2.95.1" "tooldir=/usr/in
tel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20" "gxx_include_dir=/usr/intel/pkgs/gcc/2
.95.1/include/g++-3" "libsubdir=/usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-h
p-hpux10.20/2.95.1" "gcc_version=2.95.1" "gcc_version_trigger=/fs3/comp.apps_bui
ld.1/gcc-2.95.1/gcc-2.95.1/gcc/version.c" "AR=ar" "AR_FLAGS=rc" "CC=/fs3/comp.ap
ps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.95.1/hp
ux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CXX=/fs3/
comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.
95.1/hpux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CF
LAGS=-g -O2" "CXXFLAGS=-g -O2" "NM=nm" "RANLIB=true" "LIBCFLAGS=-g -O2" "LIBCXXF
LAGS=-g -O2 -fno-implicit-templates" "LOADLIBES=" "LDFLAGS=" "MAKEINFO=/fs3/comp
.apps_build.1/gcc-2.95.1/hpux_10.20/texinfo/makeinfo/makeinfo  " "SHLIB=libstdc+
+.sl" "SHCURSES=" "RUNTESTFLAGS=" \
                        CFLAGS="-g -O2 ${flags}" \
                        CXXFLAGS="-g -O2 ${flags}" \
                        LIBCFLAGS="-g -O2 ${flags}" \
                        LIBCXXFLAGS="-g -O2 -fno-implicit-templates ${flags}" \
                        LDFLAGS=" ${flags}" \
                        all); then \
          true; \
        else \
          exit 1; \
        fi; \
      else true; \
      fi; \
    fi; \
  done; \
fi
if [ x"yes" = xyes ] && [ ! -d pic ]; then \
  mkdir pic; \
else true; fi
touch stamp-picdir
cd ../libio ; gmake "SHELL=/bin/sh" "INSTALL=/bin/sh /fs3/comp.apps_build.1/gcc-
2.95.1/gcc-2.95.1/install-sh -c" "INSTALL_DATA=/bin/sh /fs3/comp.apps_build.1/gc
c-2.95.1/gcc-2.95.1/install-sh -c -m 644" "INSTALL_PROGRAM=/bin/sh /fs3/comp.app
s_build.1/gcc-2.95.1/gcc-2.95.1/install-sh -c " "prefix=/usr/intel/pkgs/gcc/2.95
.1" "exec_prefix=/usr/intel/pkgs/gcc/2.95.1" "tooldir=/usr/intel/pkgs/gcc/2.95.1
/hppa1.1-hp-hpux10.20" "gxx_include_dir=/usr/intel/pkgs/gcc/2.95.1/include/g++-3
" "libsubdir=/usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1"
 "gcc_version=2.95.1" "gcc_version_trigger=/fs3/comp.apps_build.1/gcc-2.95.1/gcc
-2.95.1/gcc/version.c" "AR=ar" "AR_FLAGS=rc" "CC=/fs3/comp.apps_build.1/gcc-2.95
.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/ -B/us
r/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CXX=/fs3/comp.apps_build.1/g
cc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc
/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/" "CFLAGS=-g -O2  -threa
ds" "CXXFLAGS=-g -O2  -threads" "NM=nm" "RANLIB=true" "LIBCFLAGS=-g -O2  -thread
s" "LIBCXXFLAGS=-g -O2 -fno-implicit-templates  -threads" "LOADLIBES=" "LDFLAGS=
-threads" "MAKEINFO=/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/texinfo/makeinf
o/makeinfo  " "SHLIB=libstdc++.sl" "SHCURSES=" "RUNTESTFLAGS=" iostream.list
gmake[5]: `iostream.list' is up to date.

From the make install: 
if [ x"yes" = xyes ]; then \
  sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \
  mv tlist2 tlist ; \
else true ; fi
mv tlist piclist
/fs3/comp.apps_build.1/gcc-2.95.1/hpux_10.20/gcc/xgcc -B/fs3/comp.apps_build.1/g
cc-2.95.1/hpux_10.20/gcc/ -B/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/
 -g -O2 -fno-implicit-templates -fPIC -shared -o libstdc++.sl `cat piclist` 

Checking the build area and the install area for the shared lib itself: 

# The build area:
[dtthp204]-> hpux_10.20 27> find . -name '*libstdc++*' -print
./hppa1.1-hp-hpux10.20/threads/libstdc++
./hppa1.1-hp-hpux10.20/threads/libstdc++/libstdc++.a
./hppa1.1-hp-hpux10.20/threads/libstdc++/libstdc++.sl
./hppa1.1-hp-hpux10.20/threads/libstdc++/libstdc++.a.2.10.0
./hppa1.1-hp-hpux10.20/libstdc++
./hppa1.1-hp-hpux10.20/libstdc++/libstdc++.a
./hppa1.1-hp-hpux10.20/libstdc++/libstdc++.sl
./hppa1.1-hp-hpux10.20/libstdc++/libstdc++.a.2.10.0
[dtthp204]-> hpux_10.20 28> cd /usr/intel/pkgs/gcc/2.95.1/

# The install area
[dtthp204]-> 2.95.1 29> find . -name '*libstdc++*' -print
./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/threads/libstdc++.a
./lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a
./lib/threads/libstdc++.a.2.10.0
./lib/threads/libstdc++.sl
./lib/libstdc++.a.2.10.0
./lib/libstdc++.sl
[dtthp204]-> 2.95.1 30> cd lib

[dtthp204]-> lib 34> file libstdc++.sl
libstdc++.sl:   PA-RISC1.1 shared library -not stripped

[dtthp204]-> lib 37> file libstdc++.a.2.10.0 
libstdc++.a.2.10.0:     archive file -PA-RISC1.1 relocatable library

[dtthp204]-> ~ 38> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -c -shared -fpic my_helloworld.cpp
[dtthp204]-> ~ 39> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -shared -fpic -o libworld.sl my_helloworld.o
/usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status

Slightly more verbosely (using -v): 
[dtthp204]-> ~ 40> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -v -shared -fpic -o libworld.sl my_helloworld.o
Reading specs from /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/collect2 -ldce -z -b -o libworld.sl -L/usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/intel/pkgs/gcc/2.95.1/lib my_helloworld.o -lstdc++ -lm -lgcc -lgcc
/usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status



> > I'm having trouble bottoming out on what the best way to fix this 
> > is.  Build libstdc++ by itself separately after the main build 
> > and reinstall it, using aCC and +Z?  
> 
> No, that definitely won't help, C++ compilers still don't produce
> link-compatible code.

Understood. 

I checked the gcc FAQ on gnu.org and found this: 

---
Installing gcc on HP-UX without a precompiled gcc binary is somewhat tedious.
- Get gcc-XXX (2.95.2) and the GNU binutils. 
- Unpack GCC and configure for C only and --without-gnu-as. Build and install. 
- Use this Compiler to build and install then binutils. 
- Make sure you have GNU as in your PATH before the HP-UX as 
  (i.e.   /usr/local/bin is before /usr/bin and /usr/ccs/bin). 
- Reconfigure gcc --with-gnu-as and for the languages you need. 
- Rebuild and install the final version.
- You may rebuild and reinstall binutils with this compiler afterwards.
---

Hmm. Could rebuliding binutils possibly be the key?  Has anyone else
gotten shared libs working correctly on HPUX?  I'm thinking there
are people out there who must have by this point.

-Rob


-- 
#include <sig.h>
------------------------------------------------------------------
Robert Nesius             rnesius@ichips.intel.com    503.264.2830



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

* Fun with shared libs on HPUX - Request for help
  2000-03-26 15:30 Fun with shared libs on HPUX - Request for help Robert A Nesius
  2000-03-26 21:32 ` Alexandre Oliva
@ 2000-04-01  0:00 ` Robert A Nesius
  1 sibling, 0 replies; 8+ messages in thread
From: Robert A Nesius @ 2000-04-01  0:00 UTC (permalink / raw)
  To: gcc-help

Howdy all, 
I managed to get a nice build of gcc 2.95.1 built by following 
(roughly) the following steps. 

On: HPUX 10.20 

Build binuntils 2.9.1 - install bin utils into area where gcc 
  will be installed.  

Configure gcc 2.95.1 like so: 
setenv CC gcc
../gcc-2.95.1/configure --prefix=/usr/intel/pkgs/gcc/2.95.1 --enable-shared 
--enable-threads --without-gnu-ld --with-gnu-as  
--with-as=/usr/intel/pkgs/gcc/2.95.1/hppa1.1-hp-hpux10.20/bin/as 

And that seemed to work great!  But the problem I'm running 
into is that my libstdc++ lib is apparantly not really a 
shared library, even though -fPIC is getting set by the 
configure.  When I try to create a shared library that needs 
to pull in routines from libstdc++, I get errors indicating I 
need to build libstdc++ with +z or +Z.  

eg: 
[pdxhp204]-> ~ 55> /usr/intel/pkgs/gcc/2.95.1/bin/g++ -shared -fpic -o libworld.
sl my_helloworld.o
/usr/ccs/bin/ld: DP relative code in file /usr/intel/pkgs/gcc/2.95.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.1/libstdc++.a(iostream.o) - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status

I'm having trouble bottoming out on what the best way to fix this 
is.  Build libstdc++ by itself separately after the main build 
and reinstall it, using aCC and +Z?  

Working around the build issues for HPUX has caused me to get into a 
slightly confused state as to how fix this.  Could some HPUX savvy 
people offer some insights?  

Thanks much! 

-Rob
-- 
#include <sig.h>
------------------------------------------------------------------
Robert Nesius             rnesius@ichips.intel.com    503.264.2830

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

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-26 15:30 Fun with shared libs on HPUX - Request for help Robert A Nesius
2000-03-26 21:32 ` Alexandre Oliva
2000-03-27 10:09   ` Robert A Nesius
2000-03-27 10:55     ` Alexandre Oliva
2000-04-01  0:00       ` Alexandre Oliva
2000-04-01  0:00     ` Robert A Nesius
2000-04-01  0:00   ` Alexandre Oliva
2000-04-01  0:00 ` Robert A Nesius

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).