How to make a C++ -module?

Patrick Welche <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <20160621123400.GA26561@quark>
I'm trying to create a C++ loadable module. I thought it would be as easy
as:

======================= configure.ac ===================================
AC_INIT(hellow, 0.0.1)
AC_CONFIG_MACRO_DIR(m4)
AC_PROG_CXX
AM_INIT_AUTOMAKE([foreign])
LT_INIT
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
======================= Makefile.am ====================================
lib_LTLIBRARIES = hellow.la

hellow_la_SOURCES = hellow.cpp
hellow_la_LDFLAGS = -module -avoid-version
======================= hellow.cpp =====================================
#include <iostream>

void myfunc(void)
{
        std::cout << "You called myfunc()!" << std::endl;
}
========================================================================

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?


Cheers,

Patrick

g++ (nb1 20160606) 5.4.0

$ ls /lib/libgcc*
/lib/libgcc_s.so          /lib/libgcc_s.so.1        /lib/libgcc_s.so.1.0
$ ls /usr/lib/libgcc*
/usr/lib/libgcc.a         /usr/lib/libgcc_s.so      /usr/lib/libgcc_s.so.1.0
/usr/lib/libgcc_eh.a      /usr/lib/libgcc_s.so.1

/lib/libgcc_s.so.1.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, for NetBSD 7.99.31, not stripped
/usr/lib/libgcc.a: current ar archive

# Which release of libtool.m4 was used?
macro_version=2.4.2
macro_revision=1.3337
...
# The directories searched by this compiler when creating a shared library.
compiler_lib_search_dirs=""

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

# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=""

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