0

Background: I have AWS Lambda running nodejs 6.10. For my code i need to have a C Library to run algorithms. Which is compiled by node-gyp on my machine.

My buildserver was an outdated ubuntu 14.04, on which i was running my node-gyp compiled code and everything was working as expected.

Now, i have updated my ubuntu to 17.04 version. Which seems to giving me issues with Version of GLIBCXX

I have gathered the versions of GLIBCXX in different environments by running

  1. /sbin/ldconfig -p | grep stdc++
  2. (using the path from 1) strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX

Here you can see that on Ubuntu 17.04 GLIBCXX is available from v3.4 to 3.4.22, where as the other environments have it only upto 3.4.19.

My code compiled on Ubuntu 17.04 is looking for GLIBCXX_3.4.21 which is not available on the running environments and results in the following error

"errorMessage": "/var/lang/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /var/task/addon.node)",

Request: Is there any method by which (other than using custom dockers / going back to older versions of ubuntu etc) where i can set the compiler to use GLIBCXX_3.4.19, which i can eventually change when the environments (AWS lambda supports the latest version?). Ideally i am looking for a compiler flag that i can set permanently on the machine or via node-gyp that i can pass on so that i use the right version.

Observation: even though I have GLIBCXX_3.4.22 it is only linkling GLIBCXX_3.4.21 ( or they are backward compatible? )

agfkhj11
  • 11
  • 1
  • 5
  • related posts : https://stackoverflow.com/questions/38446439/linux-running-executable-error-glibcxx-3-4-21-not-found?noredirect=1&lq=1 – agfkhj11 Jul 11 '17 at 13:18
  • related posts : https://stackoverflow.com/questions/4133674/glibcxx-versions – agfkhj11 Jul 11 '17 at 13:19
  • found this information https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths which helps you to set LD path, but totally unsure of how to use this with node-gyp – agfkhj11 Jul 11 '17 at 14:25
  • 1
    Just use docker. It's what everyone does when they are making Linux release binaries. For example, see [conda-forge](https://github.com/conda-forge). – ostrokach Jul 11 '17 at 14:26

1 Answers1

0

Is there any method by which (other than using custom dockers / going back to older versions of ubuntu etc) where i can set the compiler to use GLIBCXX_3.4.19, which i can eventually change when the environments (AWS lambda supports the latest version?). Ideally i am looking for a compiler flag that i can set permanently on the machine or via node-gyp that i can pass on so that i use the right version.

You can install an earlier version of g++ on Ubuntu 17.04 and use that toolchain to compile your software. g++-4.7 could work, but I don't know for sure. Check the version that's on your current build machine. You could even stuff this older compiler in a container if you'd like, but it's not necessary.

even though I have GLIBCXX_3.4.22 it is only linkling GLIBCXX_3.4.21 ( or they are backward compatible? )

The whole point of these symbols is to have a well-defined way of designating ABI incompatibility. You just happen to not use any changes introduced by GLIBCXX_3.4.22, but do use changes introduced by GLIBCXX_3.4.21 (when compiled by whatever compiler you are using).

ldav1s
  • 15,885
  • 2
  • 53
  • 56