I have an ARM device with an non-upgradable linux kernel running on it. I want to run some C++11 programs on it, however, the system libstdc++.so.6
and libc.so.6
are too old to support C++11 at runtime. I have copies of the newer libraries, but I'm not sure how I can tell my program to use the new ones and not the old ones. I created a new directory called /tmp/newlibs
, and I put copies of the new shared objects in there. Then, I compiled with the following flags:
g++ -std=c++11 -Wl,-rpath,/tmp/newlibs test.cpp -o test
But when I attempt to execute the file, I get the following error:
/test: /lib/libc.so.6: version `GLIBC_2.17' not found (required by /tmp/newlibs/libstdc++.so.6)
So clearly, the rpath
flag worked for libstdc++
, but it looks like it didn't work for the newer version of libc.so.6
. Is there something I'm missing here? Does libstdc++.so.6
have a hard-coded path in it that I can't change?
I feel like this is a very similar problem to this question, except in my case it isn't fully utilizing my new glibc directory:
Multiple glibc libraries on a single host
Edit: it seems like the dynamic linker might be skipping over my new libc for some reason. Because when I try to preload libc.so.6
using LD_PRELOAD
, I get:
ERROR: ld.so: object '/tmp/newlibs/libc.so.6' from LD_PRELOAD cannot be preloaded: ignored.