3

I was trying to cross-compile dlib for Raspberry Pi, using the arm-linux-gnueabihf compiler.

After successful runs of cmake and make -j4, I ran python setup.py bdist_wheel --repackage, which created the necessary .so files which I later copied to my Pi's /usr/lib using scp.

Now when I run import dlib in IDLE, I get the following error:

ImportError: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by dlib/dlib.so)

Here's the ouput of strings /usr/lib/libstdc++.so.6 | grep GLIBCXX:

GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_3.4.20

This means that the error is legitimate, but my libstdc++ is already at its newest version on the Pi. What can I do to get that 3.4.22 version installed on the Pi? Or maybe, if it's possible, to compile it again against 3.4.20? How can I set a compiler flag for that?

Note: I posted this on the RaspberryPi SE site, but was suggested to ask it here. libstdc++ Error

code
  • 2,115
  • 1
  • 22
  • 46

1 Answers1

4

One option is to use -static-libstdc++ when linking, see https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options

aleb
  • 2,490
  • 1
  • 28
  • 46