Compile Cython Error: bits/libc-header-start.h: No such file or directory

When compiling a Cython file using following command, I encountered the error 'error while loading shared libraries: libmpfr.so.4'. I link libmpfr.so.4 to libmpfr.so.6 as shown here. After the link, I got the error 'bits/libc-header-start.h: No such file or directory'.

>>>python setup.py build_ext --inplace
>>>building '_online_lda' extension
gcc -pthread -B /home/rmi/anaconda2/envs/ana36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/rmi/anaconda2/envs/ana36/lib/python3.6/site-packages/numpy/core/include -I/home/rmi/anaconda2/envs/ana36/include/python3.6m -c _online_lda.c -o build/temp.linux-x86_64-3.6/_online_lda.o
/home/rmi/anaconda2/envs/ana36/libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
error: command 'gcc' failed with exit status 1

What's inside setup.py is

from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup( ext_modules = cythonize("_online_lda.pyx"), include_dirs = [numpy.get_include()]
)

Then I link libmpfr.so.4 to libmpfr.so.6 using following command.

sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4

Running the python setup.py again gives following error message.

>>>python setup.py build_ext --inplace
>>>running build_ext
building '_online_lda' extension
gcc -pthread -B /home/rmi/anaconda2/envs/ana36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/rmi/anaconda2/envs/ana36/lib/python3.6/site-packages/numpy/core/include -I/home/rmi/anaconda2/envs/ana36/include/python3.6m -c _online_lda.c -o build/temp.linux-x86_64-3.6/_online_lda.o
In file included from /home/rmi/anaconda2/envs/ana36/include/python3.6m/pyport.h:194:0, from /home/rmi/anaconda2/envs/ana36/include/python3.6m/Python.h:53, from _online_lda.c:4:
/usr/include/math.h:27:36: fatal error: bits/libc-header-start.h: No such file or directory #include <bits/libc-header-start.h> ^
compilation terminated.
error: command 'gcc' failed with exit status 1

My Ubuntu version is 18.04.3 LTS. OS type is 64-bit.

1 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like