Public bug reported: The default use of --as-needed with ld in oneiric breaks some implicit rules used by make. These rules invoke cc with command line in which $(LDFLAGS) appears before the source file being compiled or object file being linked, and that order is preserved when cc invokes ld. As a result, ld thinks the libraries listed in LDFLAGS aren't needed and doesn't link them.
For example, consider a C source file, example.c: #include "zlib.h" int main() { inflateInit(0); } and a Makefile: LDFLAGS = -lz example: example.o Running make invokes make's implicit rule for linking a single object file ("$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)"), and produces the following output: cc -c -o example.o example.c cc -lz example.o -o example /tmp/ccovHoBb.o: In function `main': example.c:(.text+0x14): undefined reference to `inflateInit_' collect2: ld returned 1 exit status make: *** [example] Error 1 Behind the scenes, ld is being run as "ld --as-needed ... -lz example.o ...". When ld processes libz, it doesn't know about any of the references from example.o, so it doesn't include it. This problem seems to have prevented at least one package (sawfish- pager) from being included in oneiric because it would no longer compile, and I worry that there may be others. I'm not sure what the best solution would be. One possibility would be patching make to change its implicit rules, but that could have serious consequences elsewhere. At the very least, it would necessitate patching other programs that run UNIX makefiles, such as remake and pmake. ** Affects: ubuntu Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/874588 Title: ld --as-needed breaks implicit rules in make To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+bug/874588/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs