panda-re / panda

Platform for Architecture-Neutral Dynamic Analysis
https://panda.re
Other
2.48k stars 479 forks source link

pyperipheral3 breaking libpanda-mipsel build #893

Closed lacraig2 closed 3 years ago

lacraig2 commented 3 years ago
  LINK    mipsel-softmmu/libpanda-mipsel.so
/usr/bin/ld: /home/luke/.pyenv/versions/3.9.0/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a(_warnings.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' 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
Makefile:235: recipe for target 'libpanda-mipsel.so' failed
make[1]: *** [libpanda-mipsel.so] Error 1
Makefile:357: recipe for target 'subdir-mipsel-softmmu' failed
make: *** [subdir-mipsel-softmmu] Error 2

This happens when pyperipheral3 is enabled. Not sure why it's just MIPSEL.

AndrewFasano commented 3 years ago

Could we just rewrite the PyPeripheral to use the pypanda interface instead of linking in a second Python interpreter. @mariusmue do you think that would be a reasonable change?

mariusmue commented 3 years ago

I already added a pyperipheral compability layer for PyPanda, which allows inclusion from the same python instance as the main analysis script: https://github.com/panda-re/panda/blob/master/panda/python/core/pandare/panda.py#L1605

The "legacy" pyperipheral which embeds a python interpreter is mostly useful when PANDA is run the classic way (i.e., not in library-mode). That being said, I rarely do so these days - so removing it would be fine by me.

In any case, I have no idea where this error may come from, however, I did not test the pyperipheral implementation with Python 3.9.

lacraig2 commented 3 years ago

It's odd. Though it breaks on more than just Python 3.9 (also 3.6). I have issued a PR to close this. Thanks.