This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/10268: C++ executables fail: libstdc++.so.5 not found


The following reply was made to PR c++/10268; it has been noted by GNATS.

From: Hallvard B Furuseth <h dot b dot furuseth at usit dot uio dot no>
To: ehrhardt at mathematik dot uni-ulm dot de,
    gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org,
    gcc-gnats at gcc dot gnu dot org
Cc:  
Subject: Re: c++/10268: C++ executables fail: libstdc++.so.5 not found
Date: Mon, 31 Mar 2003 12:14:10 +0200

 ehrhardt at mathematik dot uni-ulm dot de writes:
 >     This behaviour is intentional. -R adds paths to the executable and
 >     gcc should not add system specific paths to an executable.
 >     You can either set LD_RUN_PATH at compile time or LD_LIBRARY_PATH
 >     at run time.
 
 *What*?  Why is it better to have an executable which doesn't work than
 one where GCC has added a path which is needed to make it work?  In
 particular since the user must add the same path to make it work anyway.
 
 If you don't want to add to the executable's path, I think you should
 only build static libraries.  If one configures gcc to build dynamic
 libraries, add the path and warn about whatever the problem is with
 adding such a path, or don't add it and give a very loud warning that
 g++ will build executables that don't work.
 
 If you don't want to do that, I it would be better to remove the
 -L<path> too from g++'s defaults, at least that way the user won't think
 he has built a working executable just because he compiled with standard
 options and the compilation succeeded.
 
 And document this, and how one is supposed to make it work.
 Requiring users to set LD_LIBRARY_PATH at run time is a silly default,
 and setting environment variables doesn't work well in Makefiles anyway,
 but I suppose one could add this to Makefile:
   LDFLAGS=-R`g++ -print-file-name=libstdc++.so.5 | sed 's%/[^/]*$%%'`
 (Does that work if there are other libstdc++'s in the path?)
 Or better, some new command which doesn't require the user to understand
 sed and pipes.  I've noticed there is a libgcc_s.so as well which only
 seems to be used by g++, is that always in the same location as
 libstdc++.so or can one need another -R for that?
 
 BTW, can I configure gcc to put that directory in the path for g++ but
 not for gcc, or edit the specs file to do so?
 
 -- 
 Hallvard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]