restrain-jit
restrain-jit copied to clipboard
Cython RTS files should be compiled via corresponding c++ compiler instead the c compiler
For instance, conda python uses its own GCC compiler, and we should g++ in this toolchain.
The Cython extension always sets language="c++"
.
The reason why:
- restrain_hotspot.pyx, is written in cython with STL, and importing this without using "language=c++" causes:
tree = Parsing.p_module(s, pxd, full_module_name)
RestrainJIT_m.c:622:10: fatal error: ios: No such file or directory
#include "ios"
^~~~~
compilation terminated.
-
The RTS files, including the corresponding
.c
,.h
and.cpp
files, are likely to produce a name mangling issue when usinggcc
to compile:
ImportError: /tmp/tmpjnapmslp/RestrainJIT_m.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _Z8ptrtointPv # should be ptrtoint
It seems cython with language=c++
needs a mangled name, and mustn't get unmangled.