Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

makefile help on AIX 5.3 using xlC 8.0

59 views
Skip to first unread message

MK

unread,
May 10, 2007, 10:13:39 PM5/10/07
to
Hi,

Firstly, my apologies about the long post. Secondly, the problem...

I'm currently migrating a backend from AIX 5.1 (with Visual Age 6 XL C/
C++) to a new server with AIX 5.3 (XL C/C++ Version 8 with all patches
or fixes applied) and am having issues with symbol resolution errors
due to some badly created shared libraries. I suspect the cause is in
the way they are created in the makefile. The applications compile and
link without errors, but when I run them the symbol resolution errors
occur. I have tested the compiler and it works fine with my isolated
test cases, so the compiler and setup doesn't seem to be the problem.

When a binary that uses certain shared libraries is executed, symbol
resolution errors occur due to symbols not being exported from certain
depend modules. The issue with this is that the so called dependant
libraries it seems to link are not dependant at all (checked with
dump). As a test, hacking the makefile to link to a shared library
that is known to work, works fine. Where this issue occurs, the make
files use the makeC++SharedLib script that comes with the compiler.
Everything I've done so far points to an issue with the main makefile
in the creation of the export files (*.exp) and the creation of the
shared libraries.

I have a few questions, so I'll just start with some simple things:

1. The makefile that builds the shared libraries in the problem area,
creates export files as follows (extract rule from makefile):


.a.exp :
@echo "#!$*.a" > $*.exp
@$(NM) ./$< | $(AWK) $(AP_GET_SYMBOL_NAMES) >> $*.exp

Example:

nm -C -g ./libMKExample.a | awk '{ if ($2 == "D") { print $1 }}' >>
libMKExample.exp

Comparing the libMKExample.exp file from both servers shows
differences where the one on the new server contains 162 more exports.

I also created an export file using xlC with options -qmkshrobj -
qexpfile on the new server. The differences between this export file
and the one created with the nm command above were two symbols only.
It seems that xlC v8.0 may be more specific or strict.


2. The rule in the makefile to create the shared library with makeC+
+SharedLib script follows:

MSL_COMMAND=makeC++SharedLib
MSL_FLAGS=-p 40
MSL=$(MSL_COMMAND) $(MSL_FLAGS)

.a.so :
@for file in $$(ls $(UNIHOME)/exp/*.exp) ;\
do \
if [[ "$${file##*/}" != "$*.exp" ]] ;\
then \
EXPORTS="$${EXPORTS} -I$${file}" ;\
fi; \
done; \
$(MSL) -o $(SHARED_LIB) $(ARCHIVE) $${EXPORTS} $(GLOBAL_LIBS)

Where GLOBAL_LIBS contains -L and -l options and EXPORTS is a list of
export files (except the one for the current library being built)
passed to makeC++SharedLib with the -I option. Also, where SHARED_LIB
is the *.so shared file and ARCHIVE is the *.a archive file.


3. Using the -bnoquiet option during the make, shows that although all
the libraries are passed to the linker, it will import some symbols
from each one on the new server. Whereas on the old server, it will
only import what it needs or uses.


Please let me know what you need to see that will help resolve this
and I'll post it.

Regards,

Michael

0 new messages