[Libreoffice] Link external libraries before internal ones

Petr Mladek pmladek at suse.cz
Fri Jul 29 07:40:20 PDT 2011


Hi Bjoern,

--as-needed link flag has been enabled by default since openSUSE-11.3 or
so. It requires to mention libraries in the link flags in the right
order. I have troubles to link libqstart_gtklx.so. I get:

--- cut ---
[ build LNK ] Library/libqstart_gtklx.so
R=/usr/src/packages/BUILD && S=$R/libreoffice-bootstrap-3.4.2.3 && O=
$S/solver/340/unxlngx6.pro && W=$O/workdir &&  mkdir -p
$W/LinkTarget/Library/ && g++ -shared -Wl,-z,noexecstack '-
Wl,-rpath,$ORIGIN:$ORIGIN/../ure-link/lib' '-Wl,-rpath-link,$O/lib'
-Wl,-z,defs  -Wl,-rpath-link,/lib:/usr/lib -Wl,-z,combreloc   -L
$S/solenv/unxlngx6/lib -L$O/lib -L$S/solenv/unxlngx6
/lib -L/usr/lib64/xulrunner-1.9.1  -Wl,--hash-style=both
-Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
-Wl,-Bsymbolic-functions  -Wl,--strip-all  -pthread -lgtk-x11-2.0 -
lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lcairo
-lpango-1.0 -lfreetype -lfontconfig -lgdk_pixbuf_xlib-2.0
-lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthrea
d-2.0 -lrt -lglib-2.0
$W/CxxObject/sfx2/source/appl/shutdowniconunx.o   -Wl,--start-group
-Wl,--end-group -lcomphelpgcc3 -luno_cppu -luno_cppuhelpergcc3 -lfwelx
-li18nisolang1gcc3
 -luno_sal -lsaxlx -lsblx -lsotlx -lsvllx -lsvtlx -ltklx -ltllx
-lucbhelper4gcc3 -lutllx -lvcllx -lxml2 -lsfxlx -o
$W/LinkTarget/Library/libqstart_gtklx.so
/usr/src/packages/BUILD/libreoffice-bootstrap-3.4.2.3/solver/340/unxlngx6.pro/workdir/CxxObject/sfx2/source/appl/shutdowniconunx.o: In function `ResIdToPixbuf(unsigned short)':
shutdowniconunx.cxx:(.text+0x124): undefined reference to
`g_return_if_fail_warning'
shutdowniconunx.cxx:(.text+0x174): undefined reference to `g_malloc'
shutdowniconunx.cxx:(.text+0x2b0): undefined reference to `g_free'
shutdowniconunx.cxx:(.text+0x2e6): undefined reference to
`gdk_pixbuf_new_from_data'
shutdowniconunx.cxx:(.text+0x323): undefined reference to
`g_return_if_fail_warning'
/usr/src/packages/BUILD/libreoffice-bootstrap-3.4.2.3/solver/340/unxlngx6.pro/workdir/CxxObject/sfx2/source/appl/shutdowniconunx.o: In function `menu_deactivate_cb(_GtkWidget*)':
shutdowniconunx.cxx:(.text+0x415): undefined reference to
`gtk_menu_get_type'
shutdowniconunx.cxx:(.text+0x420): undefined reference to
`g_type_check_instance_cast'
/usr/src/packages/BUILD/libreoffice-bootstrap-3.4.2.3/solver/340/unxlngx6.pro/workdir/CxxObject/sfx2/source/appl/shutdowniconunx.o: In function `add_item(_GtkMenuShell*, char const*, r
tl::OUString*, unsigned short, void (*)())':
shutdowniconunx.cxx:(.text+0x533): undefined reference to
`gtk_image_new_from_pixbuf'
shutdowniconunx.cxx:(.text+0x543): undefined reference to
`g_type_check_instance_cast'
shutdowniconunx.cxx:(.text+0x54b): undefined reference to
`g_object_unref'
--- cut ---

It would help me to put $(GTK_LIBS) after shutdowniconunx.o on the
command line.

In fact, the 3rd party libraries should be mentioned at the end of the
command line because neither of use symbols from the internal libraries.

I am a bit lost how to solve this with the GNU make. Could you please
help me?


Best Regards,
Petr


PS: I have temporary used --no-as-needed link flag:

--- cut ---
# FIXME: GTK libs has to be mentioned after LO native libs 
no_as_needed_ldflag=-Wl,--no-as-needed 
 
$(eval $(call gb_Library_set_ldflags,qstart_gtk,\ 
     $$(LDFLAGS) \ 
     $$(no_as_needed_ldflag) \
     $(GTK_LIBS) \
))
--- cut ---

I had to use extra variable because the comma ',' can't be used inside
the macro. I am not aware about any more elegant solution :-)



More information about the LibreOffice mailing list