On 25/04/2025 21:53, Mike Krinkin wrote: > Hi There, Hi Mike, Thank you for your bug report! > I hit a weird behaviour when build colm as part of building Envoy proxy. > Cutting through layers of the stack on top of the libtool things here is > what things boil down to: > > 1. we have a project using autogen/configure/libtool that was configured > with `--enable-static` and `--disable-shared` > 2. when I run make on the project one of the linking steps failed with > the following error: > > ``` > ld.lld: error: attempted static link of dynamic object /usr/lib/libstdc++.so > ``` > > There is a lot there, but two things that I believe are particularly > relevant are: `--static` and `-lstdc++` flags. > I believe that libtool next translated it into an actual command to link > the binary and from the logs here is what I saw: > > It's pretty close to what we asked libtool to do with a few differences: > it does not have -lstdc++ flag and instead passes /usr/lib/libstdc++.so > along with other object files as input to the linker which obviously > does not work. > > My understanding is that libtool looked at -lstdc++ flag, found a > corresponding libstdc++.la file and "resolved" it into a shared library. > > What I'm baffled by in this case is why did libtool resolve it to a > shared library instead of a static one, even though it's clearly a > static build? > Moreover, even if we wanted to link against the dynamic library, it > should be done via -l flag, so what libtool looks very weird - we can't > just link shared library as if it was a object file or a static library. > Am I missing something or libtool is completely off the mark here and > trying to do something weird? This issue is similar in some ways to a couple of bugs that have been reported recently [1] [2]. Since you are using clang, '-static-libstc++' is not available, so I think you would need to utilize other libtool flags, either '-static-libtool-libs' or '-all-static'. Here [3] is the section of the manual that explains them, and it would likely require editing your Makefile.am to pass them to libtool. If updating your project configuration fixes this, I will close the bug. Otherwise I will start reviewing the code for a way to fix this behaviour. [1] https://savannah.gnu.org/support/?111184 [2] https://savannah.gnu.org/support/?111202 [3] https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html -- Ileana Dumitrescu GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354