illnyang / nvlax

Future-proof NvENC & NvFBC patcher (Linux/Windows)
GNU General Public License v3.0
159 stars 18 forks source link

Nvlax can no longer be built because Zydis has made breaking changes #11

Open tytan652 opened 2 years ago

tytan652 commented 2 years ago

Zydis as introduces breaking changes that prevent nvlax from being compiled.

For the time being, you could use CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5") or CPMAddPackage("gh:zyantific/zydis#v3.2.1") with some regression changes needed, rather than CPMAddPackage("gh:zyantific/zydis#master") or make the needed changes to nvlax.

gardotd426 commented 2 years ago

Can confirm editing CMakeLists.txt with

CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5")

on line 19 allows the project to build.

lars18th commented 2 years ago

Can confirm editing CMakeLists.txt with

CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5")

on line 19 allows the project to build.

Please @gardotd426 provide a PR to update the master. Then almost until someone will update the code the tool will compile. Thank you for the tip!

lars18th commented 2 years ago

PR waiting to merge: #14

ConstBur commented 2 years ago

nvlax can't be built anymore even with this patch, here are the logs:

[ 95%] Building CXX object CMakeFiles/nvlax_encode.dir/src/lax_encode.cc.o
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_fbc.cc: In function ‘int main(int, char**)’:
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_fbc.cc:40:27: error: request for member ‘virtual_address’ in ‘s_rodata’, which is of pointer type ‘LIEF::ELF::Section*’ (maybe you meant to use ‘->’ ?)
   40 |         offset = s_rodata.virtual_address() + s_rodata.search("This hardware does not support NvFBC");
      |                           ^~~~~~~~~~~~~~~
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_fbc.cc:40:56: error: request for member ‘search’ in ‘s_rodata’, which is of pointer type ‘LIEF::ELF::Section*’ (maybe you meant to use ‘->’ ?)
   40 |         offset = s_rodata.virtual_address() + s_rodata.search("This hardware does not support NvFBC");
      |                                                        ^~~~~~
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_fbc.cc:52:38: error: request for member ‘content’ in ‘s_text’, which is of pointer type ‘LIEF::ELF::Section*’ (maybe you meant to use ‘->’ ?)
   52 |         auto v_text_content = s_text.content();
      |                                      ^~~~~~~
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_fbc.cc:61:38: error: request for member ‘virtual_address’ in ‘s_text’, which is of pointer type ‘LIEF::ELF::Section*’ (maybe you meant to use ‘->’ ?)
   61 |                 size_t temp = s_text.virtual_address() +
      |                                      ^~~~~~~~~~~~~~~
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_fbc.cc:67:37: error: request for member ‘virtual_address’ in ‘s_text’, which is of pointer type ‘LIEF::ELF::Section*’ (maybe you meant to use ‘->’ ?)
   67 |                     offset = s_text.virtual_address() + data - v_text_content.data();
      |                                     ^~~~~~~~~~~~~~~
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_encode.cc: In function ‘void patch_linux(LIEF::ELF::Binary*)’:
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_encode.cc:45:78: error: request for member ‘value’ in ‘f_nvenc_ci’, which is of pointer type ‘LIEF::Symbol*’ (maybe you meant to use ‘->’ ?)
   45 |         auto v_func_bytes = bin->get_content_from_virtual_address(f_nvenc_ci.value(), 0x260);
      |                                                                              ^~~~~
/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/src/lax_encode.cc:53:37: error: request for member ‘value’ in ‘f_nvenc_ci’, which is of pointer type ‘LIEF::Symbol*’ (maybe you meant to use ‘->’ ?)
   53 |                 offset = f_nvenc_ci.value() +
      |                                     ^~~~~
make[2]: *** [CMakeFiles/nvlax_fbc.dir/build.make:90: CMakeFiles/nvlax_fbc.dir/src/lax_fbc.cc.o] Error 1
make[2]: Leaving directory '/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/build'
make[1]: *** [CMakeFiles/Makefile2:219: CMakeFiles/nvlax_fbc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/nvlax_encode.dir/build.make:90: CMakeFiles/nvlax_encode.dir/src/lax_encode.cc.o] Error 1
make[2]: Leaving directory '/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/build'
make[1]: *** [CMakeFiles/Makefile2:190: CMakeFiles/nvlax_encode.dir/all] Error 2
make[1]: Leaving directory '/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/build'
make: *** [Makefile:136: all] Error 2
make: Leaving directory '/var/tmp/pamac-build-constbur/nvlax-git/src/nvlax/build'
==> ERROR: A failure occurred in build().
    Aborting...

This occurs both with any nvlax AUR package/utility and compiling directly from source with the patch in the PR above. Edit: made a separate issue for this: #16

tytan652 commented 2 years ago

Patch to replace each master branch call

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fa8620..ee2f230 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,11 +16,11 @@ project(nvlax CXX)
 include(ExternalProject)
 include(cmake/FetchCPM.cmake)

-CPMAddPackage("gh:zyantific/zydis#master")
+CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5")

 CPMAddPackage(
         NAME LIEF_SRC
-        GIT_TAG master
+        GIT_TAG b65e7cca03ec4cd91f1d7125e717d01635ea81ba
         GITHUB_REPOSITORY lief-project/LIEF
         DOWNLOAD_ONLY YES
 )
@@ -59,7 +59,7 @@ message(STATUS "LIEF library: ${LIEF_LIBRARIES}")

 CPMAddPackage(
         NAME PPK_ASSERT
-        GIT_TAG master
+        GIT_TAG 833b8b7ea49aea540a49f07ad08bf0bae1faac32
         GITHUB_REPOSITORY gpakosz/PPK_ASSERT
         DOWNLOAD_ONLY YES
 )
ConstBur commented 2 years ago

Nice, that fixed it, thank you! :smile: