radareorg / radare2-rlang

Writing Radare2 plugins in various languages
16 stars 8 forks source link

Python directory does not compile #38

Closed cryptax closed 1 year ago

cryptax commented 1 year ago

I did:

git clone https://github.com/radareorg/radare2-rlang
cd radare2-rlang/
./configure --prefix=/usr
cd python
make

and I get this error:

cc python.c python/*.c -I/usr/local/include/libr -DPREFIX=\"/usr\" -I/usr/local/include/python3.10 -I/usr/local/include/python3.10 -DPYVER=3 -lpython3.10 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu -L/usr/local/lib -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/local/lib -lr_core -lr_io -lr_util -shared -lr_asm \
-I/usr/local/include/libr -L/usr/local/lib -lr_core -lssl -lcrypto -lr_config -lr_debug -lr_bin -lr_anal -lr_bp -lr_egg -lr_asm -lr_lang -lr_flag -lr_search -lr_syscall -lr_fs -lr_io -lr_socket -lr_magic -lr_crypto -lr_arch -lr_esil -lr_reg -lr_cons -lr_util -ldl \
 -L/usr/local/lib -lr_core -lr_io -lr_util -shared -lr_asm -fPIC -o lang_python.so
/usr/bin/ld: /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.a(object.o): warning: relocation against `PyDictKeys_Type' in read-only section `.text'
/usr/bin/ld: /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [build.mk:16: lang_python.so] Error 1

NB. I have an up to date radare2 and r2pipe. I am on Linux Mint, and I am using Python 3.10.4.

cryptax commented 1 year ago

Fixed. This was an issue with my personal version of Python 3.10.4 I compiled from sources. There are many options when you compile Python to support this or that feature, and I probably left one off. Using distribution packages solves the problem.