This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: Share object (libstdc++) - Software release question.


>>>>> "Guangsheng" == Guangsheng Liu <liugs@hotmail.com> writes:

Guangsheng>   Could you do me a favor and answer me one more question? If -lstdc++ is 
Guangsheng> specified, it will look for libstdc++.so first, then libstdc++.a if 
Guangsheng> libstdc++.so doesn't exist.
Guangsheng>   Now, I have both of them, what can I do to make link with libstdc++.a 
Guangsheng> instead of libstdc++.so? I check all the documentation, can't find it.
Guangsheng>   I appreciate your help.

(This is slightly off-topic here in this list; it rather belongs in
one of the gcc newsgroups, preferably gnu.g++.help.)

You could use -static generally, but this would lead to libc.a being
linked as well which is not desirable the way it is with
libstdc++. Several ways around it.

1. Use -v to determine what libs g++ takes under the hood. Then, use
   -nodefaultlibs to switch them off and specifiy them yourself,
   switching to -static before stdc++, and back to -dynamic afterwards.

2. Remove libstdc++.so. Don't know if that is an option; depends on
   whether you are running programs linked against it.

3. (This is what I prefer.) Build gcc yourself, configuring a
   different prefix to not disturb you default installation, and *not*
   configuring --enable-shared (I still don't know why all
   distributions come with a gcc configured that way). When compiling
   and linking, be sure to call your own gcc, like

   /my/own/prefix/bin/g++ -et cetera

Have fun,
Joerg

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