I am trying to build llvm within OpenWrt again (which is a buildroot derivative build system) on an ARM system. Again, I don’t know if it’s something I’m doing wrong or something not being passed down the chain, but the build is failing because libstdc++ isn’t being linked:
The issue here is that either -lstdc++ has to be specified explicitly, or else g++ rather than gcc has to be invoked to link it. I don’t know the ins and outs of building llvm that well, in fact I have no real experience with ninja at all. Does anyone know if this is an issue in llvm’s build?
I don’t have control over the way OpenWrt builds llvm (I only partially understand llvm’s buildroot system), but this appears to be the options given to llvm when it’s built:
Up until the point where clang-fuzzer-dictionary fails to link, many other tools are successfully compiled and linked and I see in the log that g++ is used extensively, so it’s definitely not a case where gcc is being used solely.
Could it be that llvm is making the wrong decision on gcc vs g++ when linking clang-fuzzer-dictionary on this platform?
Thank-you, trying it out now. It’ll take some time, as this is actually being built on a router.
Question, though, if this is the case, how is it building now? Does invoking gcc as gcc rather than g++ still cause libstdc++ to get linked in on some platforms?
Oh wait - you use shared library linking, then it’s even more curious, libLLVM-15.so should already link libstdc++?
I tried this locally on my machine, and it worked both in static and shared configuration, and if I run ldd on lib/libLLVM-17git.so it shows that it links to libstdc++.
Sorry to take so long to get to this.
The device I’m using to test needed a heatsink I had to wait on.
I don’t think it’s universal that if libA links against libB that linking an executable against libA only will cause the linker to allow symbols in the executable from libB.
In any case, the solution you suggested worked. I made a patch out of it and had the OpenWrt build system apply it and llvm now builds correctly.