The latest node refused to build on my headless dev machine. The problem was that Python fell over when trying to load the bz2 module. This wasn't immediately obvious, as node reports it as a scons error:
(To be fair the line before indicates Python as the culprit, and yes scons is Python, but I was being dim)
It turns out that I'd installed a broken Python 2.7 to begin with. bz2 hadn't compiled and I'd missed it. So I downloaded the latest libbz2 and Python, recompiled and...Python failed to build bz2 again. The issue is that Python is expecting libbz2 to be compiled with position independent code and by default it isn't.
The fix is detailed here: change the Makefile for bzip2 to send the -fPIC flag to the C compiler:
From
To
make clean && make && make install in bzip2
make && make install in Python
make && make install in node
All sorted
scons: Reading SConscript files ...
ImportError: No module named bz2:
(To be fair the line before indicates Python as the culprit, and yes scons is Python, but I was being dim)
It turns out that I'd installed a broken Python 2.7 to begin with. bz2 hadn't compiled and I'd missed it. So I downloaded the latest libbz2 and Python, recompiled and...Python failed to build bz2 again. The issue is that Python is expecting libbz2 to be compiled with position independent code and by default it isn't.
The fix is detailed here: change the Makefile for bzip2 to send the -fPIC flag to the C compiler:
From
CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
To
CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) -fPIC
make clean && make && make install in bzip2
make && make install in Python
make && make install in node
All sorted
thanks a lot for your help! :)
ReplyDelete