Downgrade libstdc++ so we can run inside old glibc environments#4567
Downgrade libstdc++ so we can run inside old glibc environments#4567
Conversation
|
Ugh. So, I've tried building against I've also tried using which is affecting I've run out of time today to dig any deeper on this one. @oxidase or @springmeyer, if you have any great ideas during EU time, I'm all ears. /cc @TheMarex in case you know a quick way to re-write |
|
Not sure downgrading to libstdc++-4.8 makes sense; it's the stdlib which shipped with gcc in 2013. We're not only missing out on C++14 stdlib support but four years of bug fixes and improvements. Also you might need to re-build our dependencies in mason - or are all our current dependencies built against libstdc++4.8 already? What about building a statically linked fat binary instead? |
|
Ah, also noting: the underlying problem isn't the C++ stdlib but the available libc version. You could build the latest stdlib against an old libc version, and then ship this stdlib to your environment. |
Boost 1.64 and 1.65 in mason are built against 4.8 to enable working on lambda/older systems. See https://github.com/mapbox/mason/blob/master/scripts/boost_libdate_time/1.64.0/.travis.yml#L15. I see that OSRM is currently using 1.63, so if you switch to 64/65 then the GLIBXX dep I think should drop from |
|
@danpat what about statically linking?
|
|
Linking stdlibc++ statically by default has the downsides that security fixes to stdlibc++ would mean we need to roll patch releases. Maybe we could publish a variant Polyfill code has the added maintenance overhead and breaks easy ("oh shiny a new C++14 API") so it would be great if we could avoid that. |
|
With the addition of boost 1.65, this PR works as expected - the OSRM node module can be used inside the AWS Lambda environment, which was the original goal. So, now to the static-vs-dynamic+hacks debate. There is no perfect solution here - either approach has compromises. We either:
I'm inclined to vote for (2), because:
I acknowledge that:
My hope is that AWS will update their NodeJS environment at some point (last update was in 2015), and we can simply remove this change. I think being able to run OSRM inside the AWS Lambda environment is important enough to warrant downgrading to libstdc++-4.9. The changes that landed with libstdc++-5 don't look important enough that we can't afford to downgrade: https://gcc.gnu.org/onlinedocs/libstdc++/manual/api.html#api.rel_50. |
|
Can't you ship a more recent stdlib to AWS Lambda environment separately? The problem of an old stdlib available in the environment conceptually has nothing to do with how we build OSRM, no? What about not touching OSRM and putting a workaround for AWS Lambda in place in your deployment code which replaces the system-default old stdlib with a more recent one? The stdlib then only has to be compatible with AWS Lambda's libc, no? The benefit would be
with the downsides that you have to upgrade the AWS Lambda stdlib manually until they do it themselves. But that's fair and should put pressure on AWS. |
Yes, |
TheMarex
left a comment
There was a problem hiding this comment.
It's a bad solution but at least one that is rather contained and easily removed. Guess we are now enterprise ready.
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "name": "osrm", | |||
| "version": "5.12.0-roundaboutexits.1", | |||
There was a problem hiding this comment.
This needs to be the same value as master. Would conflict with the actual 5.13 version bump in #4571
| @@ -0,0 +1,31 @@ | |||
| #ifdef GLIBC_WORKAROUND | |||
There was a problem hiding this comment.
Not a great solution but at least it's a contained change. Yay CentOS support.
…we can run inside old environments (CentOS, AWS Linux, AWS Lambda, etc)
426b027 to
8862dc1
Compare
|
Before merging this I would recommend testing again without the |
|
@springmeyer ja, I confirmed this - the workaround is still required. Here's the symbol version dump with GLIBC_WORKAROUND turned off: |
|
Thanks for confirming @danpat 👍 |
Issue
When trying to use the published OSRM node modules inside some environments (i.e. AWS Lambda), we get errors like:
This PR downgrades us to
libstdc++-4.9-dev, and adds an override for a libstdc++ internal symbol that we don't use (but which causes a dependency on GLIBCXX_3.9.20, which is higher than we want).The goal is to only use symbols from GLIBCXX_3.4.19 or below, allowing us to run on environments with libstdc++-4.8 (which is quite a lot of them). We can't build directly against libstdc++-4.8 any more (we use newer language features), but we can effectively cross-compile for it, which is what this PR does.
Tasklist