I have been trying to install a Python library called Polyglot, which in turn requires PyICU, the source of my woes. After a wild goose chase of errors, I was able to install PyICU on my EC2 instance. However, when running Polyglot, and in turn PyICU, I get the following error:
Traceback (most recent call last):
File "/mnt/data/anaconda3/bin/polyglot", line 11, in <module>
load_entry_point('polyglot==16.7.4', 'console_scripts', 'polyglot')()
File "/mnt/data/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/mnt/data/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
return ep.load()
File "/mnt/data/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2346, in load
return self.resolve()
File "/mnt/data/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2352, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/mnt/data/anaconda3/lib/python3.6/site-packages/polyglot/__main__.py", line 16, in <module>
from icu import Locale
File "/mnt/data/anaconda3/lib/python3.6/site-packages/icu/__init__.py", line 37, in <module>
from _icu import *
ImportError: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/linuxbrew/.linuxbrew/lib/libstdc++.so.6)
To resolve the above issue, I performed the following steps:
mkdir ~/glibc_install; cd ~/glibc_install
wget http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
make install
export LD_LIBRARY_PATH=/opt/glibc-2.18/lib
But then when I simply ran Python, I got an immediate segmentation fault.
Note that I am using Red Hat 7.1.2-2 on an AWS EC2.
Any help at all would be most appreciated!
If you just want to experiment, you could use the beta of Red Hat Enterprise Linux 8, which comes with glibc 2.28 and therefore provides the GLIBC_2.18
symbols.
The segmentation fault will go away if you run Python with an explicitly loader invocation (such as /opt/glibc-2.18/lib64/ld-linux-x86-64.so.2 python …
). If you want go into this direction, you should really use a more recent version of glibc still maintained upstream (such as glibc 2.28 at this time), and ideally a release branch from Git because it has many backports to fix various bugs.
But the next problem is that you are trying to replace the system libstdc++ library with a custom copy. This can break system software and third-party applications.
You should try to get a copy of the software you are trying to install that has been built for Red Hat Enterprise Linux 7 (or even Red Hat Enterprise Linux 6). It will be much easier to use, and avoid all these issues. If the software is written using a newer C++ standard than C++98, you can use Developer Toolset. It has a hybrid linking model, statically linking support code needed for newer C++ standard, while still using the system libstdc++ for the rest, to maximize interoperability.