mfazliazran / skipfish

Automatically exported from code.google.com/p/skipfish
Apache License 2.0
0 stars 0 forks source link

Use LIBS instead of LDFLAGS (and respect LDFLAGS from env.) for libraries #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Can't use LDFLAGS to pass -l<ibraries> to linker, because with
-Wl,--as-needed it will break, objects need to come before libraries.

Explained here, http://www.gentoo.org/proj/en/qa/asneeded.xml

Section: "Importance of linking order"

Attached patch fixes the issue

Original issue reported on code.google.com by ssuomi...@unk.fi on 23 Mar 2010 at 7:12

Attachments:

GoogleCodeExporter commented 8 years ago
The Makefile currently passes LDFLAGS at the end of the $(CC) line, so I do not 
see 
the problem in the context of that doc? 

Your patch just renames LDFLAGS to LIBS.

Original comment by lcam...@gmail.com on 23 Mar 2010 at 7:20

GoogleCodeExporter commented 8 years ago
I mean, you could just as easily keep LDFLAGS named as-is, and include env 
ADD_LDFLAGS 
for your needs, but I don't understand what this is trying to accomplish - if 
something distro-specific, why not just apply a patch to add the options you 
want?

Original comment by lcam...@gmail.com on 23 Mar 2010 at 7:23

GoogleCodeExporter commented 8 years ago
[And for what it's worth, I'm pretty sure that --as-needed makes absolutely no 
difference for skipfish, as it does not come with any elaborate linking 
dependencies.]

Original comment by lcam...@gmail.com on 23 Mar 2010 at 7:25

GoogleCodeExporter commented 8 years ago
The general part:

It makes sense to respect standard environment variables and when you can add 
+= and
?= operators to Makefile, it's also easy... there's no need to "invent" more 
names
for them.

The distro specific part:

The LDFLAGS come from the /etc/make.conf gentoo-distro specific file to the 
package
manager (Portage, in this case) and gets exported to environment for 
build-time. So
when I have LDFLAGS="-Wl,--as-needed" in /etc/make.conf, I expect every single
package to use it.

That said, there's likely not much gain for you as upstream to add this feature 
to
skipfish, but I'm asking you still do, just to make it compatible with Gentoo's
standards and we can easily include your software :)

Thanks!

Original comment by ssuomi...@unk.fi on 23 Mar 2010 at 9:45

GoogleCodeExporter commented 8 years ago
Just some example,

http://sources.redhat.com/automake/automake.html#Standard-Configuration-Variable
s

e.g. -D flags go to CPPFLAGS += -Dsomething
optimization flags for CC go as CFLAGS += -O3 -g -ggdb
extra LDFLAGS go as LDFLAGS += -Wl,-something
default CC goes as something like CC ?= gcc

Then

$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) $(objects-variable) $(libs-variable)

Original comment by ssuomi...@unk.fi on 23 Mar 2010 at 9:52

GoogleCodeExporter commented 8 years ago
Some references to similar fixing,

http://blog.flameeyes.eu/2008/10/15/fixing-cflags-ldflags-handling-with-a-single
-boilerplate-makefile
http://www.mail-archive.com/libvir-list@redhat.com/msg19082.html

Original comment by ssuomi...@unk.fi on 23 Mar 2010 at 9:58

GoogleCodeExporter commented 8 years ago
Ok, thanks for the explanation. The upcoming version will honor external 
CFLAGS, 
LDFLAGS, just pending some other bugfixes.

Original comment by lcam...@gmail.com on 23 Mar 2010 at 5:03

GoogleCodeExporter commented 8 years ago
thanks :)

meanwhile, i've packaged skipfish

http://packages.gentoo.org/package/dev-util/skipfish

Original comment by ssuomi...@unk.fi on 23 Mar 2010 at 6:39