[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Robert Boehne
Subject: Re: How to make a C++ -module?
Date: Tue, 21 Jun 2016 11:24:59 -0500


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.


On Jun 21, 2016 8:58 AM, "Bob Friesenhahn" <address@hidden> 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

[ stuff removed ]

This fails with:

/bin/sh ./libtool  --tag=CXX   --mode=link g++  -g -O2 -module -avoid-version  -o -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  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"
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 Friesenhahn
GraphicsMagick Maintainer,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]