Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Dec 7, 2015 · 8 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Added labels: Priority-Low
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

[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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant