libtool
[Top][All Lists]
Advanced

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

Re: lt_dlopen fails on AIX


From: Brice Goglin
Subject: Re: lt_dlopen fails on AIX
Date: Thu, 30 Aug 2012 08:13:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120624 Icedove/10.0.5

I don't know how to use a debugger on AIX, but I added printf inside our embedded libltdl and found the following.

It looks at the ".la", parses it, finds the ".so" name, tries to dlopen it, and fails since this file is not installed. There's no way this code can work currently since it really expects a ".so" while only the ".a" and ".la" are installed.

Either I am missing a libtool flag when building/installing my plugin (a flag that would cause the ".so" to be installed). Or something broke between the way libtool and AIX build plugins.

Brice




Le 29/08/2012 16:06, Robert Boehne a écrit :
Step into the debugger and see what filename it's trying to use.  What I can tell you, is that 7 years ago all this worked on AIX 4.3, Linux, HPUX, OSF/1, IRIX, Solaris and Windows (at my previous employer).  We made C++ modules that were lt_dlopen'd at runtime.

On Wed, Aug 29, 2012 at 8:02 AM, Brice Goglin <address@hidden> wrote:
Le 29/08/2012 14:50, Robert Boehne a écrit :
Are you passing the name of the libtool "la" file to lt_dlopen?

I tried that (among others) but it fails with "file not found".
Is this the recommended strategy? I as initially using lt_dopenext on the libtool file without any extension.


Putting a shared object in an archive is the AIX way of building shared libs.
AIX also supports system V compatibility libraries that look more like
what you're used to on Linux & Solaris.
If you prefer to build these more familiar sorts, you can put -Wl,-brtl in LDFLAGS
which will cause Libtool to change the way it links, and create libFoo.so SysV-style libraries.

If dlopen is supposed to work on AIX with .la files pointing to .a files containing .so, that'd be fine. But it keeps failing here :/

Brice



HTH,

Robert

On Wed, Aug 29, 2012 at 4:18 AM, Brice Goglin <address@hidden> wrote:
Hello,

I cannot get ltdl to load plugins on AIX 6.1. I am compiling plugins
with -module -avoid-version. libtool generates a ".so" but then embeds
it inside a ".a" and it looks like it really wants me to use this ".a"
since the ".so" doesn't even get installed.

When lt_dlopen tries to open the plugins (tried dlopen with an extension
and dlopenext without extension), it fails saying "file not found". The
raw dlopen doesn't want to load the .a file because of a "bad magic number".

dlopen succeeds if I use "foo.a(foo.so)" as a file name instead of
"foo.a", and if I add RTLD_MEMBER to the flags. But I don't see any
reference to RTLD_MEMBER in libltdl, so I assume I am not building the
plugins correctly.

What should I do to properly build my plugin? I assume I need to .la to
point to a .so instead of a .a but I can't find how do that. FWIW,
things work fine on Linux and Solaris, at least.

Here's the (dummy) plugin compile lines:

source='topology-fake.c' object='core_fake_la-topology-fake.lo' libtool=yes \
        DEPDIR=.deps depmode=xlc /bin/sh ../.././config/depcomp \
        /bin/sh ../libtool  --tag=CC   --mode=compile cc -qlanglvl=extc89 -DHAVE_CONFIG_H -I. -I../../src -I../include/private/autogen -I../include/hwloc/autogen  -I/pf/k/k203045/hwloc-1.6a1-1/build/include -I/pf/k/k203045/hwloc-1.6a1-1/include -DHWLOC_INSIDE_LIBHWLOC -DHWLOC_PLUGINS_DIR=\"/pf/k/k203045/hwloc-1.6a1-1/build/install/lib/hwloc\" -I../../src/libltdl -DHWLOC_BUILD_PLUGIN   -g -c -o core_fake_la-topology-fake.lo `test -f 'topology-fake.c' || echo '../../src/'`topology-fake.c
libtool: compile:  cc -qlanglvl=extc89 -DHAVE_CONFIG_H -I. -I../../src -I../include/private/autogen -I../include/hwloc/autogen -I/pf/k/k203045/hwloc-1.6a1-1/build/include -I/pf/k/k203045/hwloc-1.6a1-1/include -DHWLOC_INSIDE_LIBHWLOC -DHWLOC_PLUGINS_DIR=\"/pf/k/k203045/hwloc-1.6a1-1/build/install/lib/hwloc\" -I../../src/libltdl -DHWLOC_BUILD_PLUGIN -g -c ../../src/topology-fake.c -Wp,-qmakedep=gcc,-MF.deps/core_fake_la-topology-fake.TPlo  -DPIC -o .libs/core_fake_la-topology-fake.o
/bin/sh ../libtool  --tag=CC   --mode=link cc -qlanglvl=extc89  -g -module -avoid-version  -o core_fake.la -rpath /pf/k/k203045/hwloc-1.6a1-1/build/install/lib/hwloc core_fake_la-topology-fake.lo  -lpthread
libtool: link: /usr/bin/nm -B -BCpg  .libs/core_fake_la-topology-fake.o   | awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B")) && (substr($ 3,1,1) != ".")) { print $ 3 } }' | sort -u > .libs/core_fake.exp
libtool: link: cc -qlanglvl=extc89 -Wl,-bM:SRE -o .libs/core_fake.so  .libs/core_fake_la-topology-fake.o   -lpthread -lc -Wl,-bnoentry  -qlanglvl=extc89   -Wl,-bE:.libs/core_fake.exp -Wl,-berok
libtool: link: ar cru .libs/core_fake.a .libs/core_fake.so
libtool: link: ( cd ".libs" && rm -f "core_fake.la" && ln -s "../core_fake.la" "core_fake.la" )


And the generated .la that lt_dlopen does not want to load:

cat src/core_fake.la
# core_fake.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.1
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='core_fake.so'

# Names of this library.
library_names='core_fake.a core_fake.a'

# The name of the static archive.
old_library=''

# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''

# Libraries that this one depends upon.
dependency_libs=' -lpthread'

# Names of additional weak libraries provided by this library
weak_library_names=''

# Version information for core_fake.
current=0
age=0
revision=0

# Is this an already installed library?
installed=no

# Should we warn about portability when linking against -modules?
shouldnotlink=yes

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/pf/k/k203045/hwloc-1.6a1-1/build/install/lib/hwloc'


Thank you
Brice


_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool





reply via email to

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