-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make better dependency management #142
Comments
I actually thought about that for a while (and I had implemented it even), but I decided not to implement it simply because you can't ship the whole repository to |
I completely understand the reasons. I still think that having a ready to go E.g.
Or you can go about it this other way with these other steps, and install it globally to make it easy on yourself later, with this other build script which is simple and hardcoded (One bonus the former one has is when it comes to github actions builds, which can also be cached, though I should note that github actions will fail to build this unless you set (I got this building on github actions, and it's quite convenient) By the way, thanks for your library and the hard work you put into it! It's really nice! 😄 |
I'm working on other projects right now, but I see that this is definitely something to worry about. I'll pin this issue so (hopefully) I don't forget. Thanks for your suggestion 👍 |
About pre-built binaries, I've made a repo that creates them for multiple platforms (the script can be used standalone or via GitHub Actions to create GitHub Releases): https://github.com/nathan818fr/libmem-build There is one difference regarding linux: it provide the static libraries independently (so it use liblibmem_partial.a instead of the one created by makebundle.sh). This makes the artifacts more similar between Windows and Linux. PS: Thanks for libmem |
@nathan818fr |
Yes, with my way, all libraries must be linked to the target program. It's true that it's probably simpler to distribute just one big static binary (probably easier for users, etc.). Are you OK with the current artifact structure?
I will submit a PR soon. |
@nathan818fr IIRC, MSVC is able to ship all the libraries into one without any additional steps, so that's why the |
Maybe I'm missing something, but when I build with MSVC I don't get all shipped into one library. I get:
And if I try to compile a demo that uses libmem build logs
test compile logs (non-working + working)
#include <libmem/libmem.h>
#pragma comment(lib, "shell32.lib")
void a() { printf("a\n"); }
void b() { printf("b\n"); }
int main(int argc, char **argv) {
LM_HookCode((lm_address_t) &a, (lm_address_t) &b, 0);
a();
return 0;
} It don't compile when I only link libmem.lib:
It compile when I link libmem.lib, capstone.lib, keystone.lib and llvm.lib (LIEF.lid and injector.lib not required here):
Edit: OP also link with all libraries: Edit 2: It works well when also bundling libraries manually on Windows: nathan818fr@d4314b5 |
@nathan818fr That's interesting. I really thought MSVC resolved the linking problems for me, apparently not. Good to know. |
In Python, the |
Now both Python and Rust dynamically fetch the library, avoiding annoyances from building and linking libmem. |
I just want to contribute here, (don't want to go through a PR rn), you can automate building the dependency in Rust using the
cmake
build dependency, and thisbuild.rs
. (Also, clonelibmem
repo and its submodules to a subfolder in your project)Feel free to take this code anyone. Specifically, it's for Windows and a static build. Enjoy 😄
Code
The text was updated successfully, but these errors were encountered: