Bug 40385 - uim-pref-qt4: failed to link with ld --as-needed
Summary: uim-pref-qt4: failed to link with ld --as-needed
Alias: None
Product: UIM
Classification: Unclassified
Component: helper: pref (show other bugs)
Version: unspecified
Hardware: Other All
: medium minor
Assignee: uim-bugs
QA Contact:
Depends on:
Reported: 2011-08-25 19:56 UTC by d+bugzilla
Modified: 2011-08-25 22:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

fix build with ld --as-needed (827 bytes, patch)
2011-08-25 19:56 UTC, d+bugzilla
Details | Splinter Review

Description d+bugzilla 2011-08-25 19:56:26 UTC
Created attachment 50582 [details] [review]
fix build with ld --as-needed

[ this is forwarded from http://bugs.debian.org/639320 ]
[ patch created by Julian Taylor <jtaylor.debian@googlemail.com> ]

the package uim fails to build when using the linker flag --as-needed
This is caused by the library libuim placed before the static 
libuim-counted-init library which needs its symbols.
ld will then drop libuim as it appears not needed.

attached patch fixes this by adding libuim again behind libuim-counted-init

* failed to link with ld --as-needed

% g++ -m64 -Wl,-O1 -Wl,--as-needed -o uim-pref-qt4 customwidgets.o qt4.o moc_customwidgets.o moc_qt4.o    -L/usr/src/uim/uim -L/usr/src/uim/replace -L/usr/src/uim/replace/.libs -L/usr/src/uim/uim/.libs -L/usr/lib -lreplace -luim -luim-scm -luim-x-util -luim-custom -luim-counted-init -lQtGui -lQtCore -lpthread
/usr/bin/ld: /usr/src/uim/uim/.libs/libuim-counted-init.a(libuim_counted_init_la-counted-init.o): undefined reference to symbol 'uim_init'
/usr/bin/ld: note: 'uim_init' is defined in DSO /usr/src/uim/uim/.libs/libuim.so so try adding it to the linker command line
/usr/src/uim/uim/.libs/libuim.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

* succeeded to link with ld --as-needed (added -luim behind -luim-counted-init)

% g++ -m64 -Wl,-O1 -Wl,--as-needed -o uim-pref-qt4 customwidgets.o qt4.o moc_customwidgets.o moc_qt4.o    -L/usr/src/uim/uim -L/usr/src/uim/replace -L/usr/src/uim/replace/.libs -L/usr/src/uim/uim/.libs -L/usr/lib -lreplace -luim -luim-scm -luim-x-util -luim-custom -luim-counted-init -luim -lQtGui -lQtCore -lpthread
Comment 1 Etsushi Kato 2011-08-25 22:37:34 UTC
Thanks.  Fixed in trunk.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.