libtool
[Top][All Lists]
Advanced

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

Re: ltdl and C++


From: Alessandro Candini
Subject: Re: ltdl and C++
Date: Tue, 20 Sep 2011 16:45:34 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13

On 20/09/11 16:31, Patrick Welche wrote:
On Mon, Sep 19, 2011 at 03:34:22PM +0200, Alessandro Candini wrote:
Hi everyone.
I have a problem making ltdl library work with some C++ code.
I have implemented my personal version of the example at the end of
Chapter 7 in the book "Autotools" by John Calcote.
Basically it is the same, but I have C++ source files and I use g++
instead of gcc.
Configure and make works but I do not produce a dynamic linked
executable, unlike the original John's example:
../src $ ldd hello
     not a dynamic executable

And I noticed that during compilation the fPIC flag is used although
I removed every reference to it in all my Makefile.am files.
You are using libtool which works out sensible flags, and fPIC may be
such a flag, so it doesn't need to appear in your Makefile.am.

Maybe you could send us the output of "libtool --config" ?

Cheers,

Patrick
Ok, here you are some info about my environment and example project.

I'm building this project on this machine:
Linux office-007 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

This is my project structure:

hello_chap7/
|-- common
|   |-- hellocommon.h
|   |-- Makefile.am
|   `-- print.cpp
|-- configure.ac
|-- include
|   |-- libhello.h
|   `-- Makefile.am
|-- libhello
|   |-- hello_print.cpp
|   `-- Makefile.am
|-- Makefile.am
`-- src
    |-- hello.cpp
    |-- Makefile.am
    |-- module.h
    `-- modules
        `-- hithere
            |-- hithere.cpp
            `-- Makefile.am

These are my Makefile.am files inside the project:

hello_chap7/libhello/Makefile.am:

lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello_print.cpp
libhello_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/common
libhello_la_LIBADD = ../common/libhellocommon.la
#-----------------------------------------------------------------------

hello_chap7/src/modules/hithere/Makefile.am:

pkglib_LTLIBRARIES = hithere.la
hithere_la_SOURCES = hithere.cpp
hithere_la_LDFLAGS = -module -avoid-version
#-----------------------------------------------------------------------

hello_chap7/src/Makefile.am:

SUBDIRS = modules/hithere

bin_PROGRAMS = hello
hello_SOURCES = hello.cpp module.h
hello_CPPFLAGS = -I$(top_srcdir)/include
hello_LDADD = ../libhello/libhello.la -dlopen modules/hithere/hithere.la

check_SCRIPTS = greptest.sh
TESTS = $(check_SCRIPTS)

greptest.sh:
echo './hello | grep "Caneta says .* using program .*hello!"' > greptest.sh
    chmod +x greptest.sh

CLEANFILES = greptest.sh
#-----------------------------------------------------------------------

hello_chap7/include/Makefile.am:

include_HEADERS = libhello.h
#-----------------------------------------------------------------------

hello_chap7/common/Makefile.am:

noinst_LTLIBRARIES = libhellocommon.la
libhellocommon_la_SOURCES = hellocommon.h print.cpp
#-----------------------------------------------------------------------

hello_chap7/Makefile.am:

SUBDIRS = common include libhello src
#-----------------------------------------------------------------------

And in the end the libtool --config output:

macro_version=2.2.6b
macro_revision=1.3017
AS=as
DLLTOOL=dlltool
OBJDUMP=objdump
build_libtool_libs=yes
build_old_libs=yes
pic_mode=default
fast_install=yes
host_alias=
host=x86_64-pc-linux-gnu
host_os=linux-gnu
build_alias=x86_64-linux-gnu
build=x86_64-pc-linux-gnu
build_os=linux-gnu
SED="/bin/sed"
Xsed="$SED -e 1s/^X//"
GREP="/bin/grep"
EGREP="/bin/grep -E"
FGREP="/bin/grep -F"
NM="/usr/bin/nm -B"
LN_S="ln -s"
max_cmd_len=3458764513820540925
objext=o
exeext=
lt_unset=unset
SP2NL="tr \\040 \\012"
NL2SP="tr \\015\\012 \\040\\040"
reload_flag=" -r"
reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
deplibs_check_method="pass_all"
file_magic_cmd="\$MAGIC_CMD"
AR="ar"
AR_FLAGS="cru"
STRIP="strip"
RANLIB="ranlib"
old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
old_postuninstall_cmds=""
LTCC="gcc"
LTCFLAGS="-Wall -g -O2"
global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
objdir=.libs
SHELL="/bin/bash"
ECHO="echo"
MAGIC_CMD=file
need_locks="no"
DSYMUTIL=""
NMEDIT=""
LIPO=""
OTOOL=""
OTOOL64=""
libext=a
shrext_cmds=".so"
extract_expsyms_cmds=""
variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
need_lib_prefix=no
need_version=no
version_type=linux
runpath_var=LD_RUN_PATH
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
libname_spec="lib\$name"
library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
soname_spec="\${libname}\${release}\${shared_ext}\$major"
postinstall_cmds=""
postuninstall_cmds=""
finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
finish_eval=""
hardcode_into_libs=yes
sys_lib_search_path_spec="/lib/ /usr/lib/ /usr/X11R6/lib/ /usr/local/lib/"
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu "
dlopen_support=yes
dlopen_self=yes
dlopen_self_static=no
old_striplib="strip --strip-debug"
striplib="strip --strip-unneeded"
LD="/usr/bin/ld -m elf_x86_64"
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
CC="gcc"
with_gcc=yes
no_builtin_flag=" -fno-builtin"
wl="-Wl,"
pic_flag=" -fPIC -DPIC"
link_static_flag="-static"
compiler_c_o="yes"
build_libtool_need_lc=no
allow_libtool_libs_with_static_runtimes=no
export_dynamic_flag_spec="\${wl}--export-dynamic"
whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
compiler_needs_object="no"
old_archive_from_new_cmds=""
old_archive_from_expsyms_cmds=""
archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
        echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
module_cmds=""
module_expsym_cmds=""
with_gnu_ld="yes"
allow_undefined_flag=""
no_undefined_flag=""
hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
hardcode_libdir_flag_spec_ld=""
hardcode_libdir_separator=""
hardcode_direct=no
hardcode_direct_absolute=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
hardcode_automatic=no
inherit_rpath=no
link_all_deplibs=no
fix_srcfile_path=""
always_export_symbols=no
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
include_expsyms=""
prelink_cmds=""
file_list_spec=""
hardcode_action=immediate
compiler_lib_search_dirs=""
predep_objects=""
postdep_objects=""
predeps=""
postdeps=""
compiler_lib_search_path=""

--
Alessandro Candini

MEEO S.r.l.
Via Saragat 9
I-44122 Ferrara, Italy
Tel: +39 0532 1861501
Fax: +39 0532 1861637
http://www.meeo.it

========================================
"ATTENZIONE:le informazioni contenute in questo messaggio sono
da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
per errore è tenuto ad informare il mittente ed a rimuoverlo
definitivamente da ogni supporto elettronico o cartaceo."

"WARNING:This message contains confidential and/or proprietary
information which may be subject to privilege or immunity and which
is intended for use of its addressee only. Should you receive this
message in error, you are kindly requested to inform the sender and
to definitively remove it from any paper or electronic format."




reply via email to

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