[pypy-issue] Issue #2593: distutil's runtime_library_dirs is broken (pypy/pypy)

Antonio Cuni issues-reply at bitbucket.org
Thu Jun 22 12:45:08 EDT 2017


New issue 2593: distutil's runtime_library_dirs is broken
https://bitbucket.org/pypy/pypy/issues/2593/distutils-runtime_library_dirs-is-broken

Antonio Cuni:

Currently, the `runtime_library_dirs` options seems to be broken:
```
$ cat bug.py
from cffi import FFI
ffibuilder = FFI()
ffibuilder.set_source("foo", '', runtime_library_dirs = ['/tmp'])
ffibuilder.cdef("")
ffibuilder.compile(verbose=True)

$ pypy bug.py 
generating ./foo.c
the current directory is '/home/antocuni/tmp/pypybug'
running build_ext
building 'foo' extension
cc -pthread -DNDEBUG -O2 -fPIC -I/home/antocuni/pypy/default/include -c foo.c -o ./foo.o
cc -pthread -shared ./foo.o -R/tmp -o ./foo.pypy-41.so
cc: error: unrecognized command line option ‘-R’; did you mean ‘-R’?
...
```

The problem is in `distutils/unixccompiler.py:231`: if the value of `compiler` seems to be a gcc, it inserts the option `-Wl,-R` (which is correct). If not, it inserts `-R` (which causes the error).
The value of `sysconfig.get_config_var('CC')` is defined in `distutils/sysconfig_pypy.py` and it's hard-coded to `'cc'`.
If I manually change it to `gcc`, the program above works ok.

I don't know what is the best way to fix this, though; if we simply hardcode `gcc`, we risk to break setups in which the only way to invoke the compiler is actually `cc`.




More information about the pypy-issue mailing list