0

I have a Cython extension which I've compiled on Ubuntu 14 and uploaded as an Anaconda package. I'm trying to install the package on another machine which is running Scientific Linux (6?) which ships with an older version of glibc. When I try to import the module I get an error that looks (something like) this:

./myprogram: /lib/libc.so.6: version `GLIBC_2.14' not found (required by ./myprogram)

When I say "something like" - the "myprogram" is actually the .so name of the extension.

From what I understand this error is because I have a newer version of glibc on the build system which has an updated version of the memcpy function.

This page has a good description of the problem, and some rather impractical solutions: http://www.lightofdawn.org/wiki/wiki.cgi/NewAppsOnOldGlibc

There is also a much simpler answer proposed here: How can I link to a specific glibc version?

My question is: how to I apply this solution to my Cython extension? Assuming the __asm__ solution works (as given in the second link) what's the best way to get it into the C generated by Cython?

Also, more generally, how to other modules avoid this issue in the first place? For example, I installed and ran a pre-built copy of numpy without any issues.

Snorfalorpagus
  • 3,348
  • 2
  • 29
  • 51

1 Answers1

0

This turned out to be quite simple.

Create the following header, glibc_fix.h: __asm__(".symver memcpy,memcpy@GLIBC_2.2.5")

Then include it by using CFLAGS="-include glibc_fix.h". This can be set as an environment variable, or defined in setup.py.

Additionally, it turns out numpy doesn't do anything special in this regard. if I compile it myself it links with the newer version on my system.

Snorfalorpagus
  • 3,348
  • 2
  • 29
  • 51