0
votes

I am trying to install readline using the command "python setup.py install" by navigating to the directory where i untarred readline 6.2.4.1. ncurses-6.0 is currently installed in the server. I have tried recompiling with -fPIC but that also doesnt seem to solve the problem

Command: sudo CFLAGS="-fPIC" python setup.py install

Error Log:

building 'readline' extension gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -fPIC -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/home/roaming/i332346/opt/Python-local/include/python2.7 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.7/Modules/2.x/readline.o -Wno-strict-prototypes In file included from /home/roaming/i332346/opt/Python-local/include/python2.7/Python.h:126:0, from Modules/2.x/readline.c:8: /home/roaming/i332346/opt/Python-local/include/python2.7/modsupport.h:27:1: warning: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Wformat=] PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3); ^ gcc -pthread -shared -fPIC build/temp.linux-x86_64-2.7/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -lncurses -o build/lib.linux-x86_64-2.7/readline.so /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /usr/lib/libncurses.a(lib_termcap.o): relocation R_X86_64_32 against `_nc_globals' can not be used when making a shared object; recompile with -fPIC /usr/lib/libncurses.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1

1
The issue is not -fPIC within the library you are building but instead on how the libncurses.a was build (without -fPIC). Either prefer libncurses.so or rebuild libncurses.a with -fPICmalat
How do i rebuild libncurses.a? should i configure ncurses with --shared-enabled which should handle this indirectly?prabesh

1 Answers

1
votes

I tried the following and it worked.

Navigate to ncurses directory that contains configure and run the following ./configure --with-shared --without-debug make make install

Then install readline again. The error desappeared. The module was successfully installed.