pythonc++wrapperlibrsync

Writing a python wrapper for librsync with ctypes. How should I compile librsync to work on all systems?


So I'm writing an application in python which requires librsync for more efficient file transfers. I want my librsync wrapper to work so that if librsync is already installed on the system it will use that, but otherwise try to use a version shipped with my application. The wrapper currently works on linux with librsync already installed and I also managed to compile librsync to a DLL that works with the wrapper on windows. When I compile it on linux to a .so file I can move it to other linux systems and it will work, but when I try to use it on FreeBSD I get an "invalid file layout" error.

I'm wondering, is it possible to compile librsync to a library file that would work cross-platform? (or only on all *NIX systems) Also if you think there's a better way to do this please let me know.


Solution

  • Generally, no, it's not possible to build a C library that will work smoothly across platforms.

    Some BSD systems can run Linux applications (and maybe vice versa) so you could build the whole thing in that way, but it would require shipping a Linux Python.