restrain-jit icon indicating copy to clipboard operation
restrain-jit copied to clipboard

Cython RTS files should be compiled via corresponding c++ compiler instead the c compiler

Open thautwarm opened this issue 5 years ago • 1 comments

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 using gcc to compile:
ImportError: /tmp/tmpjnapmslp/RestrainJIT_m.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _Z8ptrtointPv # should be ptrtoint

thautwarm avatar Oct 23 '19 15:10 thautwarm

It seems cython with language=c++ needs a mangled name, and mustn't get unmangled.

thautwarm avatar Oct 23 '19 15:10 thautwarm