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

Link failure with ld.gold, -Wl,--as-needed and --enable-libaria2 #707

Closed
mgorny opened this issue Jul 16, 2016 · 1 comment
Closed

Link failure with ld.gold, -Wl,--as-needed and --enable-libaria2 #707

mgorny opened this issue Jul 16, 2016 · 1 comment
Milestone

Comments

@mgorny
Copy link
Contributor

mgorny commented Jul 16, 2016

When aria2 is built with --enable-libaria2 most of the relevant code is built into the shared library. However, src/Makefile.am puts almost all linked dependency libraries into LDADD which applies to executables only. Therefore, most of the NEEDED entries land in the executable rather than the library.

This has two consequences:

  1. The library lacks proper dependencies and therefore can't be used by a program unless it links to all its dependency libraries directly.
  2. If aria2c is linked using ld.gold (the new binutils linker) with -Wl,--as-needed, the linker detects that aria2c executable does not use most of the passed -l libraries and removes them. As a result, aria2c is broken since neither the program nor the library links to necessary dependency libraries.

I think the correct solution here is to move all the dependency libraries from LDADD to libaria2_la_LIBADD.

@tatsuhiro-t
Copy link
Collaborator

Thank you. I made a commit as you suggested. See 3220989

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

2 participants