-
Notifications
You must be signed in to change notification settings - Fork 60
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
"Lib.exe: command not found" when reassembling PE binaries #56
Comments
Hi @mattr555-r, gtirb-pprinter generates new binaries by generating an assembly file and then calling an off-the-self assembler and linker to produce a new binary.
Both It usually amounts to running the corresponding .bat file (see https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#developer_command_file_locations). For 64 bit it's In linux there are a couple of options you can try: Option 1: Use wineWe often use https://github.com/mstorsjo/msvc-wine as follows: Build a docker image
Create scripts to redirect Create a script called
and a
Then, you can do:
Option2: use uasm+mingw+llvmdlltoolYou can use uasm to reassemble programs into object files (see https://git.grammatech.com/rewriting/ddisasm/-/blob/main/.ci/Dockerfile.ubuntu20#L86 for how to build it) and use mingw for linking (use package https://git.grammatech.com/rewriting/ddisasm/-/blob/main/.ci/Dockerfile.ubuntu20#L141). You can run the pprinter as follows:
This will fail to generate a binary, but it will generate an assembly file
Then you can use uasm to generate a new object file:
And use mingw for linking:
The arguments to the linker will vary depending on your program, but you can see the (failed) call to ml64 in the pprinter output and use that as a starting point. E.g. all lib files generated with llvm-dlltool should be passed to mingw. Hopefully this helps! |
(Ran on Ubuntu 18.04, and also ran the test on Windows 11)
After running any PE binary (32 or 64 bit) through ddisasm, and getting the resulting .gtirb, I go to use gtirb-pprinter to reassemble the .exe but always get the same error: "lib.exe: command not found". Additionally I also get "ml64.exe: command not found". Is this a related issue?
How do I fix this?
The text was updated successfully, but these errors were encountered: