I got an error in R when building the rPython package, specifically the part that links against libpython2.7:
gcc -std=gnu99 -I/foo/bar/R-3.1.1/lib64/R/include -DNDEBUG -I/usr/local/include \
-I/foo/bar/Python-2.7.6/include/python2.7 -I/foo/bar/Python-2.7.6/include/python2.7 \
-D PYTHONLIBFILE=libpython2.7.so -fpic -g -O2 -c pycall.c -o pycall.o
gcc -std=gnu99 -shared -L/usr/local/lib64 -o rPython.so pycall.o \
-lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic
/usr/bin/ld: error: cannot find -lpython2.7
The problem seems to be that while R (or rPython) understood which -I rules to compile with my Python installation, it did not add the corresponding linker flags. I don't know why, suppose it's a bug.
I fixed it using information from here: http://carlo-hamalainen.net/blog/2012/5/11/r-makeflags-rpath-and-building-packages
Before running R to do install.packages('rPython')
, do this:
export MAKEFLAGS='LDFLAGS=-L/foo/bar/Python-2.7.6/lib\ -Wl,-rpath\ /foo/bar/Python-2.7.6/lib'
Note the backslash-escaped spaces. Now you can run R and install rPython. Once it's installed you don't need MAKEFLAGS anymore.