Bug 40385

Summary: uim-pref-qt4: failed to link with ld --as-needed
Product: UIM Reporter: d+bugzilla
Component: helper: prefAssignee: uim-bugs
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: fix build with ld --as-needed

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.