undefined reference at linking stage

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

undefined reference at linking stage

Ilya Chernykh

I have a problem with building kdewebdev3 (quanta) for Factory.

The error is

======

[  685s] /bin/sh ../../libtool --silent --tag=CXX   --mode=link g++  -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fpermissive -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DENABLE_CVSSERVICE  -module -avoid-version -module -no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined   -lkatepartinterfaces -L/opt/kde3/lib -L/usr/lib/qt3/lib  -Wl,--as-needed -Wl,--enable-new-dtags    -Wl,-Bsymbolic-functions -lxml2 -o libkxsldbgpart.la -rpath /opt/kde3/lib/kde3 dummy.lo libkxsldbgcommon.la -lkparts -lxml2
[  693s] ./.libs/libkxsldbgcommon.a(xsldbg.o): In function `xsldbgLoadXmlTemporary':
[  693s] /home/abuild/rpmbuild/BUILD/kdewebdev-3.5.10/kxsldbg/kxsldbgpart/libxsldbg/xsldbg.cpp:1030: undefined reference to `docbParseFile'
[  693s] ./.libs/libkxsldbgcommon.a(xsldbg.o): In function `xsldbgLoadXmlData':
[  693s] /home/abuild/rpmbuild/BUILD/kdewebdev-3.5.10/kxsldbg/kxsldbgpart/libxsldbg/xsldbg.cpp:980: undefined reference to `docbParseFile'
[  693s] collect2: error: ld returned 1 exit status

======

I wonder why it is compiling well, but the linker reports an error.

Buildlog:
https://build.opensuse.org/package/live_build_log?arch=i586&package=kdewebdev3&project=KDE%3AKDE3&repository=openSUSE_Factory
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: undefined reference at linking stage

Robert Schweikert-6


On 02/05/2013 04:47 PM, Ilya Chernykh wrote:

>
> I have a problem with building kdewebdev3 (quanta) for Factory.
>
> The error is
>
> ======
>
> [  685s] /bin/sh ../../libtool --silent --tag=CXX   --mode=link g++  -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fpermissive -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DENABLE_CVSSERVICE  -module -avoid-version -module -no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined   -lkatepartinterfaces -L/opt/kde3/lib -L/usr/lib/qt3/lib  -Wl,--as-needed -Wl,--enable-new-dtags    -Wl,-Bsymbolic-functions -lxml2 -o libkxsldbgpart.la -rpath /opt/kde3/lib/kde3 dummy.lo libkxsldbgcommon.la -lkparts -lxml2
> [  693s] ./.libs/libkxsldbgcommon.a(xsldbg.o): In function `xsldbgLoadXmlTemporary':
> [  693s] /home/abuild/rpmbuild/BUILD/kdewebdev-3.5.10/kxsldbg/kxsldbgpart/libxsldbg/xsldbg.cpp:1030: undefined reference to `docbParseFile'
> [  693s] ./.libs/libkxsldbgcommon.a(xsldbg.o): In function `xsldbgLoadXmlData':
> [  693s] /home/abuild/rpmbuild/BUILD/kdewebdev-3.5.10/kxsldbg/kxsldbgpart/libxsldbg/xsldbg.cpp:980: undefined reference to `docbParseFile'
> [  693s] collect2: error: ld returned 1 exit status
>
> ======
>
> I wonder why it is compiling well, but the linker reports an error.

Because during compile time the compiler sees a declaration for
"docbParseFile" and can figure out what call to generate. However,
during linking you do not have the binary artifact on the link line that
provides the implementation for "docbParseFile". Therefore, the linker
cannot stitch things together properly and creates an error.

You'll have to figure out which library or object provides the
implementation for "docbParseFile" and then add it to your link line.

HTH,
Robert

--
Robert Schweikert                           MAY THE SOURCE BE WITH YOU
SUSE-IBM Software Integration Center                   LINUX
Tech Lead
[hidden email]
[hidden email]
781-464-8147
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: undefined reference at linking stage

Philipp Thomas-3
In reply to this post by Ilya Chernykh
Am 05.02.13 22:47, schrieb Ilya Chernykh:
> [  693s] ./.libs/libkxsldbgcommon.a(xsldbg.o): In function `xsldbgLoadXmlData':
> [  693s] /home/abuild/rpmbuild/BUILD/kdewebdev-3.5.10/kxsldbg/kxsldbgpart/libxsldbg/xsldbg.cpp:980: undefined reference to `docbParseFile'
> [  693s] collect2: error: ld returned 1 exit status
>
> ======
>
> I wonder why it is compiling well, but the linker reports an error.
>
The compiler only sees one file at a time. It can therefore only
generate the appropriate calls
to external symbols and leave the resolution up the the linker. It's up
to you to find out where
the symbol comes from, either another object or a library and add that
to the linker call.

Philipp
 
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: undefined reference at linking stage

Esztermann, Ansgar-2

On Feb 6, 2013, at 15:53 , Philipp Thomas wrote:

>> I wonder why it is compiling well, but the linker reports an error.
>>
> The compiler only sees one file at a time. It can therefore only
> generate the appropriate calls
> to external symbols and leave the resolution up the the linker.

Besides, C++ does not really support modules, so the compiler only knows about prototypes. The existence of a real object corresponding to that prototype is never checked (except at link time, as seen in the case at hand).


A.

--
Ansgar Esztermann
DV-Systemadministration
Max-Planck-Institut für biophysikalische Chemie, Abteilung 105

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]