build groff|other c++ progs that do not use libstdc++.so.x?

build groff|other c++ progs that do not use libstdc++.so.x?

Post by Michael Wa » Wed, 06 Feb 2002 17:41:34



I want to build groff or other c++ progs that do not need
libstdc++.so.x to run.

I am able to compile groff 1.17.2 with gcc ver 2.95.2, and
groff does not need libstdc++.so.x.

[julie:/opt/home/mwang/Build/groff-1.17.2]ldd ./src/roff/groff/groff
        libm.so.1 =>     /usr/lib/libm.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1

But when I compile the same version of groff (1.17.2)
with gcc ver 3.0.3, groff does need libstdc++.so.x.
(And even a hello world program needs libstdc++.so.x).

[zilu:/opt/home/mwang/Build/groff-1.17.2]ldd ./src/roff/groff/groff
        libstdc++.so.3 =>        /usr/local/lib/libstdc++.so.3
        libm.so.1 =>     /usr/lib/libm.so.1
        libgcc_s.so.1 =>         /usr/local/lib/libgcc_s.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1

Of course, I prefer groff built with gcc ver 2.95.2 since it can
run anywhere independent of libstdc++.so.x and people LD_LIBRARY_PATH.

Is this an issue how I build gcc or gcc has changed? I used
make bootstrap in building gcc (3.0.3), I did not use
bootstrap for gcc ver 2.95.2.

Can some use the new version of gcc (3.0.3) to build programs (hello world)
that does not need libgcc_s.so.x?

An email reply, or email copy of your post is appreciated. Thanks.

 
 
 

build groff|other c++ progs that do not use libstdc++.so.x?

Post by Phil Edwar » Thu, 07 Feb 2002 06:35:01


[cc'd to poster]


> I want to build groff or other c++ progs that do not need
> libstdc++.so.x to run.

Simple answer:  use -static.  The executable will be huge, and will not
depend on any shared libs at all.

More complex answer:  use -Wl with the apprpriate linker arguments to select
the static versions of the libraries you don't want to have dependancies for.
Then switch it back to dynamic linking.  There are examples "out there"
of how to do this; google is your friend.

Quote:> (And even a hello world program needs libstdc++.so.x).

Go figure.  libstdc++ is where the iostream code is.

Quote:> Is this an issue how I build gcc or gcc has changed?

GCC 2.x used a different libstdc++ than GCC 3.x uses.

Quote:> Can some use the new version of gcc (3.0.3) to build programs (hello world)
> that does not need libgcc_s.so.x?

libgcc_s is a different beast.  Be very careful with dropping that library.
You shouldn't mind depending on or distributing that library, since it's
far more stable than libstdc++ is right now.

Luck++;
Phil

--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and* the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams

 
 
 

build groff|other c++ progs that do not use libstdc++.so.x?

Post by Michael Wa » Sat, 16 Feb 2002 12:02:23



>> I want to build groff or other c++ progs that do not need
>> libstdc++.so.x to run.


communications. With Phil's help, the issue becomes more clear
to me. I summarize here so that whoever travelled here in the
future will see the foot prints.

gcc can be built in two ways, use static libraries which is the
default behaviour of gcc 2.95.2, or use shared libraries which is
the default behaviour of gcc 3.0.3.

http://gcc.gnu.org/install/ says:

  Unlike GCC 2.95.x and earlier, shared libraries are enabled by
  default on all platforms that support shared libraries ...

To disable shared library, you use "--disable-shared" option in
configure, i.e.

  ./configure --disable-shared && make bootstrap

 
 
 

1. Help: man, groff, libstdc++.so.27

Happy New Year!

To get some disk space after update my kernel from 1.2.13. to 2.0.0, I
deleted groff package (used setup with slackware 3.0). Later I found man
uses groff. So, I installed groff again from slackware96 (useed the same
setup). Now, mostly man dosest work now, the error message is:

        /usr/bin/gtbl: can't load library 'libstdc++.so.27'
        /usr/bin/groff: can't load library 'libstdc++.so.27'
        /line ?/?(END)

Xman stuck at formating, giving the message at window tite bar:

        Something went wrong trying to run the command: cd /usr/man;
gtbl /tmp/xamna00833 | grepn | gtbl | -Tascii -man /tmp/xmanb00833 2>
/dev/null

Under /usr/lib, I have

        libstdc++.so.2.7.0

Under /usr/bin, I have:

        groff  
        gtbl -> tbl
        tbl

Thank you very much for your help!

Sun

2. restricted surfing

3. Using C if not C++ to prog windows??!

4. saving a process to disk

5. Building GNU's libstdc++.so.2.8.1.1?

6. Patch List Report Generator

7. Problem compiling C++ progs using gcc 2.7.2

8. finding last line of files ...

9. Shared object libstdc++.so.3 not found

10. Porting DOS prog using packet driver

11. How can I build a driver using C++?

12. Building a library that can be used by C and C++ programs

13. NCurses progs refuse cooperation with others?