Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Compile instructions for bsdiff_jni.cc #123

Open
PokeMMO opened this issue Jun 2, 2019 · 8 comments
Open

Compile instructions for bsdiff_jni.cc #123

PokeMMO opened this issue Jun 2, 2019 · 8 comments

Comments

@PokeMMO
Copy link

PokeMMO commented Jun 2, 2019

Would it be possible to get some more information/instructions on how to properly compile the native generator?

https://github.com/google/archive-patcher/blob/v2/generator/src/main/java/com/google/archivepatcher/generator/bsdiff/wrapper/bsdiff_jni.cc

@pspencil
Copy link

pspencil commented Jun 2, 2019 via email

@PokeMMO
Copy link
Author

PokeMMO commented Jun 2, 2019

I managed to get it to compile https://github.com/PokeMMO/archive-patcher/tree/native-lib-build

I've yet to verify it creates bit-for-bit equal results, but it runs.

@pspencil
Copy link

pspencil commented Jun 2, 2019 via email

@PokeMMO
Copy link
Author

PokeMMO commented Jun 6, 2019

Sorry, you also need to install a few packages via package manager.

For debian based apt:

libbz2-dev
libbrotli-dev
libdivsufsort-dev

@pspencil
Copy link

pspencil commented Jun 6, 2019 via email

@PokeMMO
Copy link
Author

PokeMMO commented Jun 6, 2019

Was already in master, but added it to that branch too.

@pspencil
Copy link

pspencil commented Jun 6, 2019 via email

@PokeMMO
Copy link
Author

PokeMMO commented Jun 6, 2019

Maven will have the same issues as gradle. Several projects have done their own custom native loading implementations libgdx and LWJGL3

(Note the differences on archive mapping between libgdx and lwjgl3, libgdx uses a suffix while lwjgl3 now uses an android style arch folder)

These implementations load the .so from the classpath as a resource, extract it to a temporary location on disk, and then invoke System.load

For my custom testing fork, I simply created a subproject with the .so as a jar resource.

And before I want to use it, I call libgdx's new SharedLibraryLoader().load("bsdiff"); (And if it fails, revert back to non-native flag)

Then in your tests, you can just have a @BeforeClass which loads the library.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants