albertz/pydbattach

Ubuntu 13.04 - python 3.3

mathben opened this issue · 2 comments

Hi, i try to compile on Ubuntu 13.04 with python3-dev

Do you have any idea?

Thanks

Cmd: gcc -g -I /usr/include/python3.3m/ -L /usr/local/lib/ -lpython3.3m -dynamiclib pyinjectcode.c -o pyinjectcode.so

cc1: warning: unrecognized gcc debugging option: y [enabled by default]
cc1: warning: unrecognized gcc debugging option: n [enabled by default]
cc1: warning: unrecognized gcc debugging option: m [enabled by default]
cc1: warning: unrecognized gcc debugging option: i [enabled by default]
cc1: warning: unrecognized gcc debugging option: c [enabled by default]
cc1: warning: unrecognized gcc debugging option: l [enabled by default]
cc1: warning: unrecognized gcc debugging option: i [enabled by default]
cc1: warning: unrecognized gcc debugging option: b [enabled by default]
pyinjectcode.c: In function ‘runPythonFile’:
pyinjectcode.c:76:2: warning: passing argument 1 of ‘PyEval_EvalCode’ from incompatible pointer type [enabled by default]
In file included from /usr/include/python3.3m/Python.h:123:0,
from pyinjectcode.c:10:
/usr/include/python3.3m/eval.h:10:24: note: expected ‘struct PyObject *’ but argument is of type ‘struct PyCodeObject *’
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference tomain'
/tmp/ccUcovVl.o: In function parse_source_module': /root/lib_driver/pydbattach/pyinjectcode.c:37: undefined reference toPyArena_New'
/root/lib_driver/pydbattach/pyinjectcode.c:43: undefined reference to PyParser_ASTFromFile' /root/lib_driver/pydbattach/pyinjectcode.c:51: undefined reference toPyAST_CompileEx'
/root/lib_driver/pydbattach/pyinjectcode.c:53: undefined reference to PyArena_Free' /tmp/ccUcovVl.o: In functionrunPythonFile':
/root/lib_driver/pydbattach/pyinjectcode.c:66: undefined reference to PyDict_New' /root/lib_driver/pydbattach/pyinjectcode.c:68: undefined reference toPyEval_GetBuiltins'
/root/lib_driver/pydbattach/pyinjectcode.c:68: undefined reference to PyDict_SetItemString' /root/lib_driver/pydbattach/pyinjectcode.c:72: undefined reference toPyUnicode_FromString'
/root/lib_driver/pydbattach/pyinjectcode.c:72: undefined reference to PyDict_SetItemString' /root/lib_driver/pydbattach/pyinjectcode.c:76: undefined reference toPyEval_EvalCode'
/tmp/ccUcovVl.o: In function builtin_execfile': /root/lib_driver/pydbattach/pyinjectcode.c:129: undefined reference toPyEval_SaveThread'
/root/lib_driver/pydbattach/pyinjectcode.c:131: undefined reference to PyEval_RestoreThread' /root/lib_driver/pydbattach/pyinjectcode.c:139: undefined reference toPyExc_IOError'
/root/lib_driver/pydbattach/pyinjectcode.c:139: undefined reference to PyErr_SetFromErrnoWithFilename' /tmp/ccUcovVl.o: In functiont_bootstrap':
/root/lib_driver/pydbattach/pyinjectcode.c:156: undefined reference to PyThreadState_New' /root/lib_driver/pydbattach/pyinjectcode.c:159: undefined reference toPySys_WriteStderr'
/root/lib_driver/pydbattach/pyinjectcode.c:160: undefined reference to PyErr_PrintEx' /root/lib_driver/pydbattach/pyinjectcode.c:164: undefined reference toPyEval_AcquireThread'
/root/lib_driver/pydbattach/pyinjectcode.c:166: undefined reference to PySys_WriteStderr' /root/lib_driver/pydbattach/pyinjectcode.c:169: undefined reference toPyExc_SystemExit'
/root/lib_driver/pydbattach/pyinjectcode.c:169: undefined reference to PyErr_ExceptionMatches' /root/lib_driver/pydbattach/pyinjectcode.c:170: undefined reference toPyErr_Clear'
/root/lib_driver/pydbattach/pyinjectcode.c:172: undefined reference to PySys_WriteStderr' /root/lib_driver/pydbattach/pyinjectcode.c:173: undefined reference toPyErr_PrintEx'
/root/lib_driver/pydbattach/pyinjectcode.c:174: undefined reference to PyErr_Clear' /root/lib_driver/pydbattach/pyinjectcode.c:180: undefined reference toPySys_WriteStderr'
/root/lib_driver/pydbattach/pyinjectcode.c:183: undefined reference to PyThreadState_Clear' /root/lib_driver/pydbattach/pyinjectcode.c:184: undefined reference toPyThreadState_DeleteCurrent'
/root/lib_driver/pydbattach/pyinjectcode.c:186: undefined reference to PyThread_exit_thread' /tmp/ccUcovVl.o: In functionstartthread':
/root/lib_driver/pydbattach/pyinjectcode.c:196: undefined reference to PySys_WriteStderr' /root/lib_driver/pydbattach/pyinjectcode.c:197: undefined reference toPyErr_PrintEx'
/root/lib_driver/pydbattach/pyinjectcode.c:201: undefined reference to PyThread_init_thread' /root/lib_driver/pydbattach/pyinjectcode.c:202: undefined reference toPyEval_InitThreads'
/root/lib_driver/pydbattach/pyinjectcode.c:204: undefined reference to PyGILState_Ensure' /root/lib_driver/pydbattach/pyinjectcode.c:206: undefined reference toPyThreadState_Get'
/root/lib_driver/pydbattach/pyinjectcode.c:207: undefined reference to PyThread_start_new_thread' /root/lib_driver/pydbattach/pyinjectcode.c:209: undefined reference toPyGILState_Release'
/root/lib_driver/pydbattach/pyinjectcode.c:213: undefined reference to PySys_WriteStderr' /root/lib_driver/pydbattach/pyinjectcode.c:214: undefined reference toPyErr_PrintEx'
/tmp/ccUcovVl.o: In function injected_PyEval_SetTraceEx': /root/lib_driver/pydbattach/pyinjectcode.c:230: undefined reference toPyGILState_Ensure'
/root/lib_driver/pydbattach/pyinjectcode.c:248: undefined reference to `PyGILState_Release'
collect2: error: ld returned 1 exit status

I only tested it on MacOSX. You need to modify the compile command. I would guess it would be like this:

cc -shared -g -lc -I /usr/include/python3.3m/ -L /usr/local/lib/ pyinjectcode.c -o pyinjectcode.so

Your command works, thanks.