[kde-solaris] i need help :-)

Stefan Teleman steleman at nyc.rr.com
Sat Oct 1 03:49:22 CEST 2005


On Friday 30 September 2005 15:34, Stanislav Lakhtin wrote:
> Hello, All.
> I have question on Solaris10(SunFire440, UltrasparcIIIi), studio10
> I have a bag in process of linking kdelibs-3.4.2.
> Problem with ./kio/misc:
>

> Undefined                       first referenced
>  symbol                             in file
> int KIO::PasswordDialog::getNameAndPassword(QString&,QString&,bool*,const
> QString&,bool,const QString&,const QString&,const QString&)
> .libs/uiserver.o KSSLCertDlg::KSSLCertDlg(QWidget*,const char*,bool)
> .libs/uiserver.o void KIO::ProgressBase::finished() .libs/uiserver.o
>
> and other....
>
> i can't understood what is this?
> Can you help me? Thanks & sorry - i very bad write english.

Hi.

Your English is fine. :-)

Here's what causes this problem, it's a known problem.

libkio.so.4.2.0 is being built by the link editor from several *.a libraries 
-- this is actually true for many shared libraries in KDE. This is done 
indirectly by libtool (Makefile calls libtool, which in turn calls the link 
editor). libtool contains a bug, in that it does not pass the right options 
to the link editor. so, you have to do a little hand editing in order to get 
this to work.

there are two ways of fixing this:

1. [Painful]: look in the Makefile for libkio, and find out which archive 
libraries are used in building libkio. mine looks like this:

libkio_la_LIBADD = kssl/libkssl.la kio/libkiocore.la \
        kio/libksycoca.la bookmarks/libkbookmarks.la kfile/libkfile.la \
        ../kdeui/libkdeui.la ../kdesu/libkdesu.la \
        ../kwallet/client/libkwalletclient.la \
        $(LIBZ) $(LIBFAM) $(LIBVOLMGT) $(LIB_KDECORE) 
$(top_builddir)/dcop/libDCOP.la $(LIB_QT) -lfam

which translates into the following archive libraries:

kio/.libs/libkiocore.a kio/.libs/libksycoca.a \
bookmarks/.libs/libkbookmarks.a kfile/.libs/libkfile.a

all the other ones are shared libraries, so these won't cause any trouble.

you can build a list of all he object files which were archived in each of 
these shared libraries, and link these object files explicitly into 
libkio.so.4.2.0, by changing these two lines in the Makefile:

am_libkio_la_OBJECTS = dummy.lo <add the list of object files here>
libkio_la_OBJECTS = dummy.lo <and add the same list here as well>

this is very painful to do, and you'll have to do this for every single shared 
library which is being link edited from existing *.a library. not fun.

2. [A Little Less Painful But Not Much]: fix libtool:

the following line in libtool (around line 6746)

wl="-Qoption ld "

change it to
wl=""

this will make libtool pass the right option to the link editor:
-z allextract

instead of what it was doing before:
-Qoption ld -z allextract

The other thing to keep in mind: for C++ and SunStudio (any version), *never* 
call the linker (/usr/ccs/bin/ld) directly. *always* link through the 
compiler driver:

$(CXX) $(CXXFLAGS) $(LDFLAGS)

so, libtool needs some more editing:

# The linker used to build libraries.
LD="${CXX} ${CXXFLAGS} ${LDFLAGS} "
## LD="/usr/ccs/bin/ld"

and then there are four groups of lines in libtool which need to be edited as 
well:

1 (around line 6818):
old_archive_cmds="\$CC \$CXXFLAGS \$LDFLAGS -xar -o \$oldlib \$oldobjs"

2 (around line 240):
# Commands used to build and install a shared archive.
archive_cmds="\$CC \$CFLAGS \$LDFLAGS -G \${allow_undefined_flag} -h \$soname 
-o \$lib \$libobjs \$deplibs \$linker_flags"
archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat \$export_symbols 
| \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$lib.exp~\$echo \\\"local: 
*; };\\\" >> \$lib.exp~
        \$CC \$CFLAGS \$LDFLAGS -G \${allow_undefined_flag} -M \$lib.exp -h 
\$soname -o \$lib \$libobjs \$deplibs \$linker_flags~\$rm \$lib.exp"

3 (around line 6829):
# Commands used to build and install a shared archive.
archive_cmds="\$CC \$CXXFLAGS \$LDFLAGS -G \${allow_undefined_flag} -nolib 
-h\$soname -o \$lib \$predep_objects \$libobjs \$deplibs \$postdep_objects 
\$compiler_flags"
archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat \$export_symbols 
| \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$lib.exp~\$echo \\\"local: 
*; };\\\" >> \$lib.exp~
        \$CC \$CXXFLAGS \$LDFLAGS -G \${allow_undefined_flag} -nolib \${wl}-M 
\${wl}\$lib.exp -h\$soname -o \$lib \$predep_objects \$libobjs \$deplibs 
\$postdep_objects \$compiler_flags~\$rm \$lib.exp"

4 (around line 7126):
# Commands used to build and install a shared archive.
archive_cmds="\$CC \$CFLAGS \$LDFLAGS -G \${allow_undefined_flag} -h \$soname 
-o \$lib \$libobjs \$deplibs \$linker_flags"
archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat \$export_symbols 
| \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$lib.exp~\$echo \\\"local: 
*; };\\\" >> \$lib.exp~
        \$CC \$CFLAGS \$LDFLAGS -G \${allow_undefined_flag} -M \$lib.exp -h 
\$soname -o \$lib \$libobjs \$deplibs \$linker_flags~\$rm \$lib.exp"

it will probably be much easier of you went to the download directory where my 
build of KDE 3.4.1 lives, and grab the sample libtool from there. that 
libtool is fixed. you will have to change the paths to SunStudio 10 a little, 
but that is nowhere nearly as annoying as editing all these linker fixes in 
libtool.

once you get a fixed libtool, you can use the same one in all the KDE modules, 
so you can safely copy it to all the KDE build directories (kdebase, 
kdenetwork, etc).

please let me know. :-)

--Stefan

-- 
Stefan Teleman          'Nobody Expects the Spanish Inquisition'
steleman at nyc.rr.com                          -Monty Python


More information about the kde-solaris mailing list