node.jsを makeしていたら...
$ cd node-v0.12.2 $ ./configure : $ make : Traceback (most recent call last): File "../../tools/js2c.py", line 37, in <module> import bz2 ImportError: No module named bz2 make[1]: *** [/home/endo/tmp/node-v0.12.2/out/Release/obj/gen/libraries.cc] Error 1 make[1]: Leaving directory `/home/endo/tmp/node-v0.12.2/out' make: *** [node] Error 2 $
と言われたので、python 2.7.9を makeするが bz2 (bzip2)でエラー。
$ cd Python-2.7.9 $ ./configure $ make : running build running build_ext building dbm using gdbm INFO: Can't locate Tcl/Tk libs and/or headers building 'bz2' extension gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/local/include -I/home/endo/tmp/Python-2.7.9/Include -I/home/endo/tmp/Python-2.7.9 -c /home/endo/tmp/Python-2.7.9/Modules/bz2module.c -o build/temp.linux-x86_64-2.7/home/endo/tmp/Python-2.7.9/Modules/bz2module.o gcc -pthread -shared build/temp.linux-x86_64-2.7/home/endo/tmp/Python-2.7.9/Modules/bz2module.o -L/usr/local/lib -lbz2 -o build/lib.linux-x86_64-2.7/bz2.so /usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libbz2.a: could not read symbols: Bad value collect2: ld returned 1 exit status Python build finished, but the necessary bits to build these modules were not found: _tkinter bsddb185 dl imageop readline sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: bz2 running build_scripts $
pythonのmakeメッセージをよく見ると、「recompile with -fPIC」とあるので
bzip2のMakefileに-fPICを付けre-compile。
$ tar -zxvf bzip2-1.0.6.tar.gz $ cd bzip2-1.0.6 $ vi Makefile old) CC=gcc new) CC=gcc -fPIC $ vi Makefile-libbz2_so old) CC=gcc new) CC=gcc -fPIC $ make $ make -f Makefile-libbz2_so $ su # make install
で解決。