How to correctly locate libstdc++.so.* used to compile an autotools project, in order to bundle it with the distribution?
After our team switched to C++11, we need to bundle the new libstdc++.so.6 with every distribution of our software, but how to correctly find the library?
- Cygwin:
/lib/gcc/x86_64-pc-cygwin/5.2.0 - Linux:
/usr/lib64 - Custom install:
/usr/local/gcc-5.2.0/lib64
I already tried:
install-exec-local:
cp $(shell dirname $(shell which ${CXX}))/../lib64/libstdc++.so.6 ${prefix}/lib
(instead of make dist, we make install into a configured prefix and then bundle the prefix)
And this works, but not for Cygwin, and I'm not sure it will work on other platforms, thus my question.
Edit
See this question for a rationale of bundling libstdc++.so with the software. It works very well. We also use dlopen to load .sos that depend on libstdc++.so so it's harder to link statically than it sounds.
The only issue is locating the libstdc++.so.6 at make dist time (or our equivalent thereof), so that I can cp it to our distribution's ${prefix}/lib directory, before tar-gzipping it and delivering it to the customer. Ideally, I'm looking for something like g++ --print-path-to-libstdc++.so.
The target system, where the software is run, has an older libstdc++.so, that's the whole reason for bundling our own.