23.09.2012 16:19, PhilippeDidier skrev:
Olivier Blin a écrit :
PhilippeDidier <[email protected]> writes:

indeed the configured Makefile contains
LDFLAGS  option --as-needed htat worked for Mandriva !!!

I need now to write a patch for the makefiles...
to fix it in a better way than overriding LDFLAGS

May we now suppress the --as-needed option for LDFLAGS in every makefile ?

No, you should not remove this option, this is the intended behavior.
It just exposed a missing -l flag in the software you are packaging.

The proper fix, as Thomas said, is to patch the Makefile to add the
-lpthread flag where appropriate.

Hello !
Some news :
Indeed it was more difficult than I thought :
There were 21 different Makefile.in in 21 directories to modify :
I wrote a patch that replaces
-LDFLAGS = @LDFLAGS@
by
+LDFLAGS = @LDFLAGS@ -lpthread
in each of them...


And now you are overlinking :)

You only need to patch the Makefile(s) that is responsible for
building the code that relies on pthread


Now each Makefile contains :
LDFLAGS =  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1
-Wl,--build-id -Wl,--enable-new-dtags -lpthread


And I discover that my first workaround was indeed bad :
I used
%build
%configure2_5x
%make LDFLAGS="-lpthread"

instead of
%build
%configure2_5x
%make

this allowed to package and I felt happy ;) ... but wrongly happy :(


Now that I use a correct LDFLAGS I got new errors about other undefined
references (thanks to --as-needed option)
... and I feel sad :(

There came now undefined references to 'dlopen' 'dlerror' 'dlclose'

I had to add -ldl to each Makefile.in


And overlinking again :)

And now it's OK

Thanks to all of you ! I'm now less ignorant than I was ...

But packaging for Mageia will need more skill and more time than for
Mandriva ... and more patches ! (hope it's worth of it)


Of course it is worth it...
By finding and fixing issues like this (and also send the fix upstream)
the quality of the code is improving...

I will provide my spec and patch files to anyone (perhaps through
bugzilla with a package request)


--

Thomas


Reply via email to