Attention is currently required from: laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-remsim/+/39020?usp=email )
Change subject: Makefile:am: Improve formatting and order of CFLAGS and LIBS ......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Let me have a deeper look, maybe I did it the wrong way.
It seems in general the linker searches from left to right, and notes unresolved symbols as it goes. So libs should be placed so that the library that needs symbols must be first, then the library that resolves the symbol. This is actually more important for static libraries than shared libraries, see: https://praveenv253.github.io/logs/2014/03/15/log-message-1.html https://stackoverflow.com/questions/45135/why-does-the-order-in-which-librar...
Some distros like debian and ubuntu started passing -Wl,--as-needed by default, which then require the object files to be passed before the libraries. According to https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed "Importance of linking order" this is not much of a problem with autoamke since we properly use LDADD instead of LDFLAGS.
See also: https://wiki.ubuntu.com/OneiricOcelot/ReleaseNotes#GCC_4.6_Toolchain https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed https://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries
So I think the problem is actually those places where we pass .o objects in LDADD. There, we need to put the .o files first, and then the libraries in the order mentioned above.
I think it's good to always follow the same order always everywhere to avoid potential problems though.