Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 133583 - app-text/hunspell on amd64: -fPIC issue
Summary: app-text/hunspell on amd64: -fPIC issue
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Kevin F. Quinn (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 126452
  Show dependency tree
 
Reported: 2006-05-17 03:31 UTC by Hanno Zysik (geki)
Modified: 2006-05-18 09:05 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
create hunspell_pic.a library (hunspell-pic.diff,1.22 KB, patch)
2006-05-17 04:46 UTC, Hanno Zysik (geki)
Details | Diff
add diff to ebuild (hunspell-ebuild.diff,452 bytes, patch)
2006-05-17 04:57 UTC, Hanno Zysik (geki)
Details | Diff
hunspell-1.1.4-libtool.patch (hunspell-1.1.4-libtool.patch,3.77 KB, patch)
2006-05-17 07:17 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff
hunspell-1.1.4-renameexes.patch (hunspell-1.1.4-renameexes.patch,4.51 KB, patch)
2006-05-17 07:18 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff
Ebuild patch (hunspell-1.1.4-ebuild.patch,1.48 KB, patch)
2006-05-17 07:19 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hanno Zysik (geki) 2006-05-17 03:31:34 UTC
It happens on openoffice compile.

A way to solve first:

Quick and dirty:
Add 'use amd64 && append-flags "-fPIC"' to the hunspell ebuild.

Debian shows a proper way:
http://packages.debian.org/unstable/text/hunspell
http://ftp.debian.org/debian/pool/main/h/hunspell/hunspell_1.1.4-3.diff.gz
(hunspell-1.1.4/debian/patches/01_pic_versions.dpatch - This adds a hunspell_pic.a library next to the non-pic hunspell.a library version.)
http://go-oo.org/patches/src680/static-libs-use-_pic.diff


This is the error a user gets:

Making: ../../../unxlngx6.pro/lib/libspell680lx.so
g++ -Wl,-z,combreloc -Wl,-z,defs -Wl,-rpath,'$ORIGIN' -shared -Wl,-O1 -Wl,--version-script ../../../unxlngx6.pro/misc/spell_spell680lx.map -L../../../unxlngx6.pro/lib -L../lib -L/var/tmp/portage/openoffice-680.169.0/work/ooo-build/build/src680-m169/solenv/unxlngx6/lib -L/var/tmp/portage/openoffice-680.169.0/work/ooo-build/build/src680-m169/solver/680/unxlngx6.pro/lib -L/var/tmp/portage/openoffice-680.169.0/work/ooo-build/build/src680-m169/solenv/unxlngx6/lib -L/opt/gcj-4.1.0/lib64 -L/opt/gcj-4.1.0/jre/lib/amd64 -L/opt/gcj-4.1.0/jre/lib/amd64/server -L/opt/gcj-4.1.0/jre/lib/amd64/native_threads -L/usr/lib64 -L/usr/lib64 -L/usr/lib64/mozilla-firefox ../../../unxlngx6.pro/slo/spell_dflt_version.o ../../../unxlngx6.pro/slo/spell_dflt_description.o -o ../../../unxlngx6.pro/lib/libspell680lx.so ../../../unxlngx6.pro/slo/sprophelp.o ../../../unxlngx6.pro/slo/sreg.o ../../../unxlngx6.pro/slo/sspellimp.o -luno_cppu -luno_cppuhelpergcc3 -lvos3gcc3 -ltl680lx -lsvt680lx -lsvl680lx -lvcl680lx -luno_sal -lucbhelper3gcc3 -lutl680lx -llng680lx -lhunspell -ldl -lpthread -lm -Wl,-Bdynamic -lstlport
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libhunspell.a(dictmgr.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/libhunspell.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

I hope I did not miss something. :)
Comment 1 Kevin F. Quinn (RETIRED) gentoo-dev 2006-05-17 03:47:21 UTC
hmm; hunspell isn't keyworded for amd64 yet, and openoffice is explicitly keyworded -amd64.  What are you building for?
Comment 2 Hanno Zysik (geki) 2006-05-17 04:00:57 UTC
hunspell does fine on amd64.
recent openoffice milestones do fine on amd64.

I maintain an openoffice overlay for these milestones.
With the help of Chaosite (nickname) we get things ready for amd64.

And one thing is to report issues so things do fine when you keyword them amd64 in portage. ;)
Comment 3 Hanno Zysik (geki) 2006-05-17 04:46:17 UTC
Created attachment 86918 [details, diff]
create hunspell_pic.a library
Comment 4 Hanno Zysik (geki) 2006-05-17 04:57:40 UTC
Created attachment 86919 [details, diff]
add diff to ebuild
Comment 5 Kevin F. Quinn (RETIRED) gentoo-dev 2006-05-17 06:00:51 UTC
I've no problem with you reporting; I just need to understand what you're trying to achieve, in order to be confident that fixes are appropriate.

Presumably openoffice is loading the hunspell archive dynamically; I had assumed that it was linked to openoffice at build time (in which case it shouldn't need -fPIC, unless there's something about amd64 that I don't understand).  If it's loading it dynamically, it is odd that it isn't doing it with a shared library (.so)).

openoffice, amd64 teams - any comments?
Comment 6 Hanno Zysik (geki) 2006-05-17 06:06:16 UTC
No problem. ;)

I do not understand it. I just see what Debian and Ubuntu does.
I test right now on x86 that it does not break openoffice.

hunspell just ships a non-pic static library which causes the error on amd64.
Comment 7 Kevin F. Quinn (RETIRED) gentoo-dev 2006-05-17 06:12:20 UTC
Oh I get it - openoffice is making its own shared library from the hunspell archive.

In which case we should always be using the PIC versions in openoffice (regardless of amd64), otherwise we'll end up with TEXTRELs in libspell680lx.so - something to check in the openoffice build.
Comment 8 Andreas Proschofsky (RETIRED) gentoo-dev 2006-05-17 06:15:24 UTC
(In reply to comment #7)
> In which case we should always be using the PIC versions in openoffice
> (regardless of amd64), otherwise we'll end up with TEXTRELs in libspell680lx.so
> - something to check in the openoffice build.
> 

which indeed happens and is bug #126452
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 06:18:04 UTC
Wouldn't be simpler to make hunspell build a shared library at side of the static archive? Like it's done for a52dec and libdts?
Comment 10 Hanno Zysik (geki) 2006-05-17 06:25:52 UTC
True. I can confirm that libspell680li.so has TEXTRELs on x86.

There are issues with libspell680lp.so on ppc. bug 126587.
Could that be sourced from a non-pic version of hunspell.a?

https://bugs.gentoo.org/show_bug.cgi?id=126587#c20 says:
"... all major ppc distributions (Debian for example) has OO 2.0.2 for ppc ready and working."
Comment 11 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 06:54:07 UTC
Having it as .so isn't difficult but it's taking me some time mainly for collisions with the other patch, but I'm almost done.
Comment 12 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 07:17:38 UTC
Created attachment 86925 [details, diff]
hunspell-1.1.4-libtool.patch

This patch make use of libtool for building the libraries, thus installs copies of .so libraries, that are built correctly with -fPIC, which should solve all the problems related to PIC and textrels.

It needs an updated execrename patch I'm going to attach and an ebuild patch that I'm going to attach too.
Comment 13 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 07:18:20 UTC
Created attachment 86926 [details, diff]
hunspell-1.1.4-renameexes.patch
Comment 14 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 07:19:23 UTC
Created attachment 86927 [details, diff]
Ebuild patch

This is the ebuild patch, it adds the patches in the correct order, uses eautoreconf rather than autoreconf, runs elibtoolize for safety, uses make instead of emake for install.
Comment 15 Kevin F. Quinn (RETIRED) gentoo-dev 2006-05-17 08:09:45 UTC
ok; building an so is fine in and of itself, but openoffice builds libspell680lx.so from the hunspell object files _and also_ others (see the log extract in c#1).  So the .so as built isn't useful to openoffice, unless the openoffice build is modified more significantly.  I guess the advantage of libtool is that it builds (or should build ;) ) the right thing on any platform.

I'll do whatever openoffice will require - so over to you, suka ;)  If you want to do the pic archive thing (see patch on go-oo.org referenced in c#1) then I'll bump it to build the _pic.a archives.  Probably easiest in the short term.  In the long term, it would be better for upstream openoffice to publish an API that  spell checkers can adhere to, so spellcheckers can build .so's independently - which leads me to suggest that doing the .so thing should be driven upstream.

(BTW I never saw the textrels in libspell680lx.so because I'm using the hardened compiler, which built the objects PIE, which was PIC enough in this case!)
Comment 16 Hanno Zysik (geki) 2006-05-17 08:29:59 UTC
Just to note:
If you are going to build the _pic.a we just need the hunk to link to hunspell_pic.
I use system agg which fails with the diff from Debian.

@ suka
Is it ok to you that I add a diff to ooo-build for this then?
Comment 17 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 08:46:44 UTC
Kevin I don't understand why it won't work. For what I can see from the error log, openoffice is simply passing -lhunspell, that fails because there's no .so and thus ld takes /usr/lib64/libhunspell.a that is non-PIC.
When the .so is present -lhunspell will take /usr/lib64/libhunspell.so, that is PIC and will go on.
This will allow to link without changes to openoffice buildsystem I think.
Comment 18 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-17 10:10:22 UTC
Hanno can you try to build openoffice with the modified hunspell to build .so libraries and without the hunks from debian patches to use _pic libraries?
That way should build and link libhunspell dynamically, not requiring a rebuild in case of version bump or security issues.
Comment 19 Kevin F. Quinn (RETIRED) gentoo-dev 2006-05-17 10:14:03 UTC
(In reply to comment #17)

Ah; thanks - yet more fog clears.

So if we build the .so, no change to the openoffice build.  Has to be the best solution, you agree suka?
Comment 20 Hanno Zysik (geki) 2006-05-17 10:22:30 UTC
(In reply to comment #18)
> Hanno can you try to build openoffice with the modified hunspell to build .so
> libraries ...

@ Diego
Already on the way for x86.
I will tell Chaosite to test this on amd64.
Latter one may take some time to get a result.
Comment 21 Andreas Proschofsky (RETIRED) gentoo-dev 2006-05-17 22:35:47 UTC
(In reply to comment #19)
> 
> So if we build the .so, no change to the openoffice build.  Has to be the best
> solution, you agree suka?

I naturally always agree that solutions which require no action on my part are the best ;)

Will test it now
Comment 22 Hanno Zysik (geki) 2006-05-18 03:46:11 UTC
On x86:
The library libspell680li.so links to hunspell.so just fine.
The TEXREL vanishes.
Runtime does just fine aswell.

As expected.
Comment 23 Kevin F. Quinn (RETIRED) gentoo-dev 2006-05-18 05:51:00 UTC
ok; in CVS :)

Thanks for the great help, everyone.  I'll mention this change to upstream.

(it's not keyworded ~amd64 yet; Flameeyes will do that)
Comment 24 Andreas Proschofsky (RETIRED) gentoo-dev 2006-05-18 09:05:07 UTC
Just wanted to add, that the TEXTREL also went away with the hunspell update, good job everyone!