Re: How to make a C++ -module?

Robert Boehne <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <CAADOFPELcbLK8iLTY3kN0chg29_-JDUOm8-sCFaXhaCBsghQYQ@mail.gmail.com>
Patrick,

Did you build the compiler yourself?  Basically Libtool is saying you only
have a static version of your runtime library, so if you built the compiler
yourself, add --enable-shared when you configure.  If not, I'll see if I
can get a NetBSD VM up and running so I can reproduce your problem, but at
first glance it appears to be your compiler.

Robert
On Jun 21, 2016 8:58 AM, "Bob Friesenhahn" <[email protected]>
wrote:

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

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.