https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121667

--- Comment #8 from Yi Qingliang <niqingliang2003 at gmail dot com> ---
(In reply to Andrew Pinski from comment #7)
> (In reply to Yi Qingliang from comment #4)
> > (In reply to Andrew Pinski from comment #3)
> > > For me it is :
> > > /usr/bin/ld: /home/apinski/src/upstream-cross-aarch64/pr121667/libb.so:
> > > undefined reference to `std::ios_base_library_init()@GLIBCXX_3.4.32'
> > > 
> > > Also it is not just with -W,--exclude-libs,ALL but in general.
> > 
> > (In reply to Andrew Pinski from comment #2)
> > > This is not a bug since you do -W,--exclude-libs,ALL .
> > > 
> > > Basically if you link against a library which depends on the shared 
> > > library
> > > version of one library; you can't link your main program just against the
> > > static library with `-W,--exclude-libs,ALL`.
> > > elf does NOT have multi-namespaces while linking (loading is a different
> > > story).
> > 
> > so what I should do?
> > indeed, in my case, I have a 3rd library depends on lower version
> > libstdc++.so (only binary).
> > my library depends on it, and also depends on a higher version libstdc++.so.
> > I should distribute my shared lib (binary) to others, But I must ensure it
> > can run on most linux distributions, I don't know any other method except
> > static linking libstdc++.
> > 
> > liba.so depens on: higher version libstdc++.so, libb.so
> > libb.so dpens on: lower version libstdc++.so
> > 
> > so I want liba.so not depends on higher version libstdc++.so, what can I do?
> 
> There is no way to support this with elf linkining.

I removed libstdc++.so/libgcc_s.so in the 3rd library dependency using
patchelf, but it looks like no luck.

Reply via email to