Re: How to make a C++ -module?
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.gnu.libtool.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 21 Jun 2016, Patrick Welche wrote: > I'm trying to create a C++ loadable module. I thought it would be as easy > as: [ stuff removed ] > This fails with: > > /bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -module -avoid-version -o hellow.la -rpath /usr/local/lib hellow.lo > > *** Warning: linker path does not have real file for library -lgcc. > *** I have the capability to make that library automatically link in when > *** you link to this library. But I can only do this if you have a > *** shared version of the library, which you do not appear to have > *** because I did check the linker path looking for a file starting > *** with libgcc and none of the candidates passed a file format test > *** using a regex pattern. Last file checked: /usr/lib/libgcc.a > > Presumably, this means that things aren't as simple as I thought. > What am I missing? Nothing is easy when it comes to C++-based modules. Risks are elevated if a C-based program uses C++-based modules due to unhandled C++ exceptions or C++ exceptions possibly not working. You are going to need a shared library for the (correct) C++ run-time as well as libgcc_s.so. These need to somehow appear where libtool is searching for them. They will also need to be available in a path where the system searches for shared libraries in order to load the module. > # Dependencies to place before and after the objects being linked to > # create a shared library. > predep_objects="/usr/lib/crti.o /usr/lib/crtbeginS.o" > postdep_objects="/usr/lib/crtendS.o /usr/lib/crtn.o" > predeps="" > postdeps="-lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc" I am not sure what libgcc is used for. It seems to only ever be delivered as a static library in the GCC installation tree. Its appearance in the link line may be a bug (possibly a bug in GCC). Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool