public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Including -R /usr/local/lib?
@ 1998-04-18  8:31 Amos A Gouaux
  1998-04-18 16:05 ` Martin von Loewis
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Amos A Gouaux @ 1998-04-18  8:31 UTC (permalink / raw)
  To: egcs

When using egcs on Solaris 2.6 to compile C++ code, for the
executable to run one must do the following:

   $ g++ t.C -R /usr/local/lib

If this is not done, then this is what happens:

   $ g++ t.C
   $ ldd a.out
           libstdc++.so.2.8.0 =>    (file not found)
           libm.so.1 =>     /usr/lib/libm.so.1
           libc.so.1 =>     /usr/lib/libc.so.1
           libdl.so.1 =>    /usr/lib/libdl.so.1

It seems like the g++ command should know where libstdc++ is, and
automatically add the `-R /usr/local/lib' business for the user.
Is there an option or environment setting for configure that I
can use to get egcs to automatically add the `-R /usr/local/lib'?

amos



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

* Re: Including -R /usr/local/lib?
  1998-04-18  8:31 Including -R /usr/local/lib? Amos A Gouaux
@ 1998-04-18 16:05 ` Martin von Loewis
  1998-04-18 18:00 ` Alexandre Oliva
  1998-04-19 18:10 ` Joe Buck
  2 siblings, 0 replies; 7+ messages in thread
From: Martin von Loewis @ 1998-04-18 16:05 UTC (permalink / raw)
  To: amos; +Cc: egcs

> It seems like the g++ command should know where libstdc++ is, and
> automatically add the `-R /usr/local/lib' business for the user.
> Is there an option or environment setting for configure that I
> can use to get egcs to automatically add the `-R /usr/local/lib'?

I believe this has been discussed in the past, you may want to search
the list archives. I would dislike g++ automatically adding -R options
to the binary. That way, you get binaries that work only on the
machine you compile on, and not on any other Solaris machine.

I recommend to use either of two solutions:
- configure egcs with --disable-shared, so you'll link libstdc++ 
  statically. This seems reasonable especially since the ABI of
  g++ is in the permanent state of flux (I believe since g++ 1).
- add the -R option to the spec file after installation. This is
  what we do in-house; we also add /usr/local/X11/lib. Since this
  is a site-specific configuration, I would not want g++ to do
  it by default.

Regards,
Martin

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

* Re: Including -R /usr/local/lib?
  1998-04-18  8:31 Including -R /usr/local/lib? Amos A Gouaux
  1998-04-18 16:05 ` Martin von Loewis
@ 1998-04-18 18:00 ` Alexandre Oliva
  1998-04-19  8:38   ` Kamil Iskra
  1998-04-19 18:48   ` Amos A Gouaux
  1998-04-19 18:10 ` Joe Buck
  2 siblings, 2 replies; 7+ messages in thread
From: Alexandre Oliva @ 1998-04-18 18:00 UTC (permalink / raw)
  To: Amos A Gouaux; +Cc: egcs

Amos A Gouaux <amos@utdallas.edu> writes:

> When using egcs on Solaris 2.6 to compile C++ code, for the
> executable to run one must do the following:

>    $ g++ t.C -R /usr/local/lib

> It seems like the g++ command should know where libstdc++ is, and
> automatically add the `-R /usr/local/lib' business for the user.

This has been discussed to death already, and there was someone
willing to work on a fix (sorry, I don't remember who it was :-(

There are two possible current workarounds:

1) modify the specs file (/usr/local/lib/gcc-lib/*/*/specs) and add -R
to the `*link:' or `*lib:' pattern

2) modify `libstdc++/config/*.ml' and modify the `-h' or `-soname'
switch so that it includes the full pathname of the library.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


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

* Re: Including -R /usr/local/lib?
  1998-04-19  8:38   ` Kamil Iskra
@ 1998-04-19  8:15     ` Alexandre Oliva
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 1998-04-19  8:15 UTC (permalink / raw)
  To: Kamil Iskra; +Cc: egcs

Kamil Iskra <kamil@dwd.interkom.pl> writes:

> Excuse me, but what is wrong with setting the LD_LIBRARY_PATH environment
> variable so that it includes /usr/local/lib?

We have several versions of gcc installed in directories that are not
/usr/local.  I won't assume users will select the appropriate library
because they won't, and then they'll blame me.  I'd better make sure
their programs pick up the correct library at run-time.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


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

* Re: Including -R /usr/local/lib?
  1998-04-18 18:00 ` Alexandre Oliva
@ 1998-04-19  8:38   ` Kamil Iskra
  1998-04-19  8:15     ` Alexandre Oliva
  1998-04-19 18:48   ` Amos A Gouaux
  1 sibling, 1 reply; 7+ messages in thread
From: Kamil Iskra @ 1998-04-19  8:38 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: egcs

On 18 Apr 1998, Alexandre Oliva wrote:

> > When using egcs on Solaris 2.6 to compile C++ code, for the
> > executable to run one must do the following:
> 
> >    $ g++ t.C -R /usr/local/lib
> 
> > It seems like the g++ command should know where libstdc++ is, and
> > automatically add the `-R /usr/local/lib' business for the user.
[snip]
> There are two possible current workarounds:
> 
> 1) modify the specs file (/usr/local/lib/gcc-lib/*/*/specs) and add -R
> to the `*link:' or `*lib:' pattern
> 
> 2) modify `libstdc++/config/*.ml' and modify the `-h' or `-soname'
> switch so that it includes the full pathname of the library.

Excuse me, but what is wrong with setting the LD_LIBRARY_PATH environment
variable so that it includes /usr/local/lib? That's what I did with gcc
2.8.1 on my university, I would expect it to work the same with egcs?

/ Kamil Iskra    AmigaOS  Linux/i386  Linux/m68k               \
| GeekGadgets GCC maintainer   UNIX system administrator       |
| iskra@student.uci.agh.edu.pl  kiskra@ernie.icslab.agh.edu.pl |
\ kamil@dwd.interkom.pl   http://student.uci.agh.edu.pl/~iskra /


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

* Re: Including -R /usr/local/lib?
  1998-04-18  8:31 Including -R /usr/local/lib? Amos A Gouaux
  1998-04-18 16:05 ` Martin von Loewis
  1998-04-18 18:00 ` Alexandre Oliva
@ 1998-04-19 18:10 ` Joe Buck
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Buck @ 1998-04-19 18:10 UTC (permalink / raw)
  To: Amos A Gouaux; +Cc: egcs

> When using egcs on Solaris 2.6 to compile C++ code, for the
> executable to run one must do the following:
> 
>    $ g++ t.C -R /usr/local/lib

That's true only because you specified --enable-shared and did
not specify --prefix.  Had you specfied --prefix, you would have
needed to wire in $(prefix)/lib instead.

> It seems like the g++ command should know where libstdc++ is, and
> automatically add the `-R /usr/local/lib' business for the user.

> Is there an option or environment setting for configure that I
> can use to get egcs to automatically add the `-R /usr/local/lib'?

I believe that you could modify the specs file.

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

* Re: Including -R /usr/local/lib?
  1998-04-18 18:00 ` Alexandre Oliva
  1998-04-19  8:38   ` Kamil Iskra
@ 1998-04-19 18:48   ` Amos A Gouaux
  1 sibling, 0 replies; 7+ messages in thread
From: Amos A Gouaux @ 1998-04-19 18:48 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: egcs

First, I apologize for not searching the web list archives more
extensively.  I searched the last two months and didn't see any
solutions, then I posted.  If I searched the very next month I
would have come across the more lengthy thread. 

BTW, can a search page be added?  On SunSolve, you can specify
which "collections" to search, how many months back to search,
and how many responses to return.  Here, the collections could be
the various egcs lists.  Considering the size of this project,
some kind of more intelligent searching mechanism would really be
helpful.

On 18 Apr 1998, Alexandre Oliva wrote:

> 1) modify the specs file (/usr/local/lib/gcc-lib/*/*/specs) and add -R
> to the `*link:' or `*lib:' pattern

I'm not familiar with the syntax of this file, so instead tried
the following suggestion. 

> 2) modify `libstdc++/config/*.ml' and modify the `-h' or `-soname'
> switch so that it includes the full pathname of the library.

Indeed, this works just fine.  Actually, this might even be
better since one could still use LD_RUN_PATH, if absolutely
necessary.  The specs file approach would render LD_RUN_PATH
useless. 

Since it was raised, I would agree that g++ should not
arbitrarily add -R all over the place.  However, since g++
automatically links in libstdc++, it seems reasonable that the
resulting executable should at least be able to find this
library.  Altering sol2shm.ml took care of this nicely. 

Thanks.

amos



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

end of thread, other threads:[~1998-04-19 18:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-18  8:31 Including -R /usr/local/lib? Amos A Gouaux
1998-04-18 16:05 ` Martin von Loewis
1998-04-18 18:00 ` Alexandre Oliva
1998-04-19  8:38   ` Kamil Iskra
1998-04-19  8:15     ` Alexandre Oliva
1998-04-19 18:48   ` Amos A Gouaux
1998-04-19 18:10 ` Joe Buck

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