Bug 190

Summary: need of explicit LDFLAGS in Makefile for Mageia
Product: LinuxSampler Reporter: PhilippeDidier <philippedidier>
Component: otherAssignee: Christian Schoenebeck <cuse>
Status: CLOSED FIXED    
Severity: enhancement CC: andreas56
Priority: P5    
Version: SVN Trunk   
Hardware: PC   
OS: Linux   
Attachments: patch to modify the LDFLAGS in one makefile (adding explicit links)
patch to modify the LDFLAGS in two makefiles for svn2372 (adding explicit links)
patch to add explicit LDFLAGS in /src/makefile.am for svn2372

Description PhilippeDidier 2012-10-01 18:46:23 CEST
Created attachment 57 [details]
patch to modify the LDFLAGS in one makefile (adding explicit links)

Hello !

I used to use Linuxsampler in a Mandriva distribution (a rpm was built for it)

I tried to import Linuxsampler into Mageia (a Mandriva fork) and to build a rpm but I encountered a little problem :

Samely as in some other distributions, Mageia developpers choosed to disable the --as needed option by default in LDFLAGS to prevent from overlinking or underlinking
so :

when I "make" I get error messages complaining for undefined references

1°)
I first used the official linuxsampler-1.0.0.tar.bz2 and applied a patch file
that I add as attachment just below :
It adds explicit LDFLAGS -lpthread -ldl into ./src/Makefile.in

2°)
I then used the last svn tar for each part of the linuxsampler project (gig, gigedit, liblscp, qsampler)

I have to command first : make -f Makefile.cvs (or make -f Makefile.svn ) with the downloaded svn tree (to create the Makefile.in in each directory)

then I need to add these explicit LDFLAGS -lpthread -ldl -llscp -ly
in ./src/Makefile.in and in ./src/network/Makefile.in
(I will provide the patch file in the next comment)


I didn't find an other way to add these LDFLAGS only in these two Makefiles

(I could for instance type %make LDFLAGS="-lpthread" but I will do overlinking)

There's perhaps something you can modify somewhere in the source to protect the packagers from this link problem...

Hope this will help
Regards
Philippe
Comment 1 PhilippeDidier 2012-10-01 18:47:56 CEST
Created attachment 58 [details]
patch to modify the LDFLAGS in two makefiles for svn2372 (adding explicit links)
Comment 2 PhilippeDidier 2012-10-01 19:02:37 CEST
Nota Bene :
This patch is only needed for Linuxsampler ... neither for gig, nor gigedit, nor liblscp ,nor qsampler
Comment 3 Andreas Persson 2012-10-24 19:05:50 CEST
I tried to reproduce this error, by setting LDFLAGS="-Wl,--as-needed" in my configure command for libgig and linuxsampler, but I failed. Everything built without errors.

What are the steps to reproduce the problem? It shouldn't be necessary to build an rpm should it?

I'm using Mageia 2.
Comment 4 Andreas Persson 2012-10-24 19:30:49 CEST
OK, it's not the --as-needed linker option that causes the problem, it's --no-undefined. (And Mageia's rpm system uses both). With

LDFLAGS="-Wl,--no-undefined"

I got a lot of undefined reference errors to pthreads and dl.
Comment 5 Andreas Persson 2012-10-24 20:11:47 CEST
I don't understand why you needed to add more libs just because you moved from 1.0.0 to svn. The lscp lib isn't used at all by linuxsampler, and liby has never been required I think.

At least the problem I could reproduce (and I'm using svn latest) is fixed by simply appending "-lpthread -ldl" to liblinuxsampler_la_LIBADD in src/Makefile.am. Can you please try if that solves your problem too?
Comment 6 PhilippeDidier 2012-10-25 20:35:33 CEST
(En réponse au commentaire 5)
> I don't understand why you needed to add more libs just because you moved from
> 1.0.0 to svn. The lscp lib isn't used at all by linuxsampler, and liby has
> never been required I think.
> 
> At least the problem I could reproduce (and I'm using svn latest) is fixed by
> simply appending "-lpthread -ldl" to liblinuxsampler_la_LIBADD in
> src/Makefile.am. Can you please try if that solves your problem too?

Hello Andreas

You're absolutely right ... 
and twice right :
1) it's indeed --no-undefined option that causes the problem (--as-needed allows to know what library is needed when --no-undefined option is used... but not to use them...) 


2) I just added "-lpthread -ldl" to liblinuxsampler_la_LIBADD in
 src/Makefile.am 
and everything works fine with the svn version (no need for ly nor llscp)

I just add the modified patch for svn

Thanks
Comment 7 PhilippeDidier 2012-10-25 20:39:21 CEST
Created attachment 59 [details]
patch to add explicit LDFLAGS in /src/makefile.am for svn2372
Comment 8 PhilippeDidier 2012-11-04 15:30:05 CET
Thanks for the modification in /src/makefile.am (svn 2378) it's OK now !
No problem in Mageia...
Reagards 
Philippe