[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    RE: KDE 1.90 compile error on AIX
From:       Platzer Wolfgang <wolfgang.platzer () infonova ! at>
Date:       2000-05-31 7:04:13
[Download RAW message or body]


Maybe this information I got from another AIX developer may be useful for
updating the libtool:

Wolfgang





Actually, shared libraries work just fine under AIX.  The only problem
is that most packages don't understand how to *build* them.

I've found that the GNU 'libtool' software seems to get it right, but
it requires some work to convert stuff to use it.  I've managed to get
enough of GTK+ and friends using shared libs that Enlightenment runs
under AIX 4.3.3 (see http://www.enlightenment.org, goodbye CDE ;)

If it's a 'libfoobar.so' file, note that you will need the -brtl linker
flag to get the linker/binder to look for .so files.  You can also try
adding a symlink from 'libfoobar.a' to 'libfoobar.so' (your mileage may
vary).

I'm attaching 2 scripts that I've used to good effect to convert
non-shared libraries to shared.  No guarantees, they're ugly, but they
seem to work fine for me. ;)

Store them both in ~/bin or someplace in your $PATH.  The ldAix was
shamelessly stolen from the Tk/Tcl distribution.

Useage:  make_shared libfoobar.a -lthis -lthat -lwhatever -lc

Add -l's and -L's as needed, and any other ld flags (-blibpath, etc)
you feel a need for.

Hope that all helps...

--- make_shared script ---
#!/bin/ksh
set -x
libshare=$1
shift
libs=$*
cp -p $libshare $libshare.bak
mkdir .buildshare
cd .buildshare
ar x ../$libshare

ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -o
$libshare *.o $libs
if [ $? = 0 ] ; then
	mv $libshare ..
fi
cd ..
rm -rf .buildshare
--- end make_shared ---
--- ldAix script ---
#!/bin/sh
#
# ldAix ldCmd ldArg ldArg ...
#
# This shell script provides a wrapper for ld under AIX in order to
# create the .exp file required for linking.  Its arguments consist
# of the name and arguments that would normally be provided to the
# ld command.  This script extracts the names of the object files
# from the argument list, creates a .exp file describing all of the
# symbols exported by those files, and then invokes "ldCmd" to
# perform the real link.
#
# RCS: @(#) $Id: ldAix,v 1.3 1999/03/10 05:52:52 stanton Exp $

# Extract from the arguments the names of all of the object files.

args=$*
ofiles=""
for i do
    x=`echo $i | grep '[^.].o$'`
    if test "$x" != ""; then
	ofiles="$ofiles $i"
    fi
done

# Extract the name of the object file that we're linking.
outputFile=`echo $args | sed -e 's/.*-o \([^ ]*\).*/\1/'`

# Create the export file from all of the object files, using nm followed
# by sed editing.  Here are some tricky aspects of this:
#
# 1. Nm produces different output under AIX 4.1 than under AIX 3.2.5;
#    the following statements handle both versions.
# 2. Use the -g switch to nm instead of -e under 4.1 (this shows just
#    externals, not statics;  -g isn't available under 3.2.5, though).
# 3. Eliminate lines that end in ":": these are the names of object
#    files (relevant in 4.1 only).
# 4. Eliminate entries with the "U" key letter;  these are undefined
#    symbols (relevant in 4.1 only).
# 5. Eliminate lines that contain the string "0|extern" preceded by space;
#    in 3.2.5, these are undefined symbols (address 0).
# 6. Eliminate lines containing the "unamex" symbol.  In 3.2.5, these
#    are also undefined symbols.
# 7. If a line starts with ".", delete the leading ".", since this will
#    just cause confusion later.
# 8. Eliminate everything after the first field in a line, so that we're
#    left with just the symbol name.

nmopts="-g -C"
osver=`uname -v`
if test $osver -eq 3; then
  nmopts="-e"
fi
rm -f lib.exp
echo "#! $outputFile" >lib.exp
/usr/ccs/bin/nm $nmopts -h $ofiles | sed -e '/:$/d' -e '/ U /d' -e '/[
]0|extern/d' -e '/unamex/d' -e 's/^\.//' -e 's/[ 	|].*//' | sort |
uniq >>lib.exp

# If we're linking a .a file, then link all the objects together into a 
# single file "shr.o" and then put that into the archive.  Otherwise link 
# the object files directly into the .a file.

outputFile=`echo $args | sed -e 's/.*-o \([^ ]*\).*/\1/'`
noDotA=`echo $outputFile | sed -e '/\.a$/d'`
echo "noDotA=\"$noDotA\""
if test "$noDotA" = "" ; then
    linkArgs=`echo $args | sed -e 's/-o .*\.a /-o shr.o /'`
    echo $linkArgs
    eval $linkArgs
    echo ar cr $outputFile shr.o
    ar cr $outputFile shr.o
    rm -f shr.o
else
    eval $args
fi
--- end ldAix script ---

 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic