Building fails on Debian jessie when using python3.4

Create issue
Issue #3 resolved
Johannes Ranke created an issue

When I try to use Python 3 on Debian jessie, I get

me@tux:~/git$ export USESPECIALPYTHONVERSION="python3.4"
me@tux:~/git$ R CMD build pythoninr                     
* checking for file pythoninr/DESCRIPTION ... OK
* preparing PythonInR’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running cleanup
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building PythonInR_0.1-1.tar.gz

me@tux:~/git$ R CMD INSTALL PythonInR_0.1-1.tar.gz      
* installing to library /usr/local/lib/R/site-library
* installing *source* package PythonInR ...
use special version
3.4
/usr/bin
0

python version is > 3

Makevars:
PKG_LIBS=-L/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu -L/usr/lib -lpython3.4m -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
PKG_CFLAGS=-I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING

** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c CToR.c -o CToR.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c CastPyObjects.c -o CastPyObjects.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c CastRObjects.c -o CastRObjects.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c GetPyObjects.c -o GetPyObjects.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c PyCall.c -o PyCall.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c PyRunString.c -o PyRunString.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c PythonFunctions.c -o PythonFunctions.o
PythonFunctions.c: In function python_in_r_init_methods’:
PythonFunctions.c:111:5: warning: implicit declaration of function Py_InitModule [-Wimplicit-function-declaration]
     (void) Py_InitModule("PythonInR", PythonInRMethods);
     ^
PythonFunctions.c:112:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c PythonInR.c -o PythonInR.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c Python_Explicit_Linking.c -o Python_Explicit_Linking.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -I/usr/include/python3.4m -I/usr/include/python3.4m -Wno-unused-result -g -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -pedantic -D PYTHONLIBXY=libpython3.4m.so -D PYTHON_IN_R_NO_EXPLICIT_LINKING -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c SetPyObjects.c -o SetPyObjects.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o PythonInR.so CToR.o CastPyObjects.o CastRObjects.o GetPyObjects.o PyCall.o PyRunString.o PythonFunctions.o PythonInR.o Python_Explicit_Linking.o SetPyObjects.o -L/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu -L/usr/lib -lpython3.4m -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/PythonInR/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  kann shared object '/usr/local/lib/R/site-library/PythonInR/libs/PythonInR.so' nicht laden:
  /usr/local/lib/R/site-library/PythonInR/libs/PythonInR.so: undefined symbol: Py_InitModule
Fehler: Laden fehlgeschlagen
Ausführung angehalten
ERROR: loading failed
* removing /usr/local/lib/R/site-library/PythonInR
* restoring previous /usr/local/lib/R/site-library/PythonInR

Comments (3)

  1. Florian Schwendinger repo owner

    Thank you! Fixed it.

    Sys.setenv(USESPECIALPYTHONVERSION="python3.4")
    require(devtools)
    install_bitbucket("Floooo/PythonInR")
    
  2. Johannes Ranke reporter

    Ah great, I forgot that devtools supports installing from bitbucket! Thanks for the hint. Works over here as well.

  3. Log in to comment