Comments (3)
Hi,
Good news! I've prepared a simple patch that almost works with nvenc. Here my dirty patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fa8620..aa75df1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,8 @@ project(nvlax CXX)
include(ExternalProject)
include(cmake/FetchCPM.cmake)
-CPMAddPackage("gh:zyantific/zydis#master")
+#CPMAddPackage("gh:zyantific/zydis#master")
+CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5")
CPMAddPackage(
NAME LIEF_SRC
diff --git a/src/lax_encode.cc b/src/lax_encode.cc
index 0967a6c..64b194c 100644
--- a/src/lax_encode.cc
+++ b/src/lax_encode.cc
@@ -28,7 +28,10 @@ patch_linux (LIEF::ELF::Binary *bin)
{
using namespace LIEF::ELF;
- PPK_ASSERT_ERROR(bin->imported_libraries().at(0) == "libnvcuvid.so.1");
+// In WSL2 we can't use this to check the library binary.
+// The "libnvcuvid.so.1" is no listed with the 'ldd' command,
+// but it works 'strings /usr/lib/wsl/lib/libnvidia-encode.so.1 | grep libnvcuvid.so.1'
+// PPK_ASSERT_ERROR(bin->imported_libraries().at(0) == "libnvcuvid.so.1");
std::cout << "[+] libnvidia-encode.so\n";
@@ -67,6 +70,7 @@ patch_linux (LIEF::ELF::Binary *bin)
}
PPK_ASSERT_ERROR(found);
+ std::cout << "[+] Section 1 OK\n";
found = false;
{
@@ -83,7 +87,7 @@ patch_linux (LIEF::ELF::Binary *bin)
if (instr.mnemonic == ZYDIS_MNEMONIC_TEST &&
instr.operands[0].reg.value == ZYDIS_REGISTER_EAX &&
instr.operands[1].reg.value == ZYDIS_REGISTER_EAX &&
- (++n) > 1)
+ (++n) > 0)
{
offset += (data - v_func_bytes.data());
found = true;
@@ -96,6 +100,7 @@ patch_linux (LIEF::ELF::Binary *bin)
}
PPK_ASSERT_ERROR(found);
+ std::cout << "[+] Section 2 OK\n";
// test eax, eax -> xor eax, eax
bin->patch_address(offset, 0x31, 0x1);
Feel free to add it to the repository! You only need to add some parameter to enable for WSL.
Regards.
from nvlax.
Hi,
My updated patch to apply the last fixes from @tytan652:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fa8620..a013971 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,11 +16,13 @@ project(nvlax CXX)
include(ExternalProject)
include(cmake/FetchCPM.cmake)
-CPMAddPackage("gh:zyantific/zydis#master")
+#CPMAddPackage("gh:zyantific/zydis#master")
+CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5")
CPMAddPackage(
NAME LIEF_SRC
- GIT_TAG master
+# GIT_TAG master
+ GIT_TAG b65e7cca03ec4cd91f1d7125e717d01635ea81ba
GITHUB_REPOSITORY lief-project/LIEF
DOWNLOAD_ONLY YES
)
@@ -59,7 +61,8 @@ message(STATUS "LIEF library: ${LIEF_LIBRARIES}")
CPMAddPackage(
NAME PPK_ASSERT
- GIT_TAG master
+# GIT_TAG master
+ GIT_TAG 833b8b7ea49aea540a49f07ad08bf0bae1faac32
GITHUB_REPOSITORY gpakosz/PPK_ASSERT
DOWNLOAD_ONLY YES
)
diff --git a/src/lax_encode.cc b/src/lax_encode.cc
index 0967a6c..64b194c 100644
--- a/src/lax_encode.cc
+++ b/src/lax_encode.cc
@@ -28,7 +28,10 @@ patch_linux (LIEF::ELF::Binary *bin)
{
using namespace LIEF::ELF;
- PPK_ASSERT_ERROR(bin->imported_libraries().at(0) == "libnvcuvid.so.1");
+// In WSL2 we can't use this to check the library binary.
+// The "libnvcuvid.so.1" is no listed with the 'ldd' command,
+// but it works 'strings /usr/lib/wsl/lib/libnvidia-encode.so.1 | grep libnvcuvid.so.1'
+// PPK_ASSERT_ERROR(bin->imported_libraries().at(0) == "libnvcuvid.so.1");
std::cout << "[+] libnvidia-encode.so\n";
@@ -67,6 +70,7 @@ patch_linux (LIEF::ELF::Binary *bin)
}
PPK_ASSERT_ERROR(found);
+ std::cout << "[+] Section 1 OK\n";
found = false;
{
@@ -83,7 +87,7 @@ patch_linux (LIEF::ELF::Binary *bin)
if (instr.mnemonic == ZYDIS_MNEMONIC_TEST &&
instr.operands[0].reg.value == ZYDIS_REGISTER_EAX &&
And I confirm that with a recent (Jun'23) driver like 515.65.01 it works in WSL2 with Win10 22H2 (without patching at all the stock Windows driver).
from nvlax.
@lars18th Did you cut off the last few lines of that git patch? It's complaining about being corrupt.
from nvlax.
Related Issues (16)
- Can't compile on Ubuntu 21.10 HOT 5
- Nvlax can no longer be built because Zydis has made breaking changes HOT 6
- ABEND while trying to patch 470.103.1 drivers HOT 1
- is this patch works with latest Nvidia driver version 511.65? HOT 1
- Nvlax doesn't build even with Zydis patch HOT 1
- Add patch to fix NvFBC not requesting proper Vulkan API version HOT 1
- Please can you merge the pull request by ParhamBandarchi HOT 1
- Errors while building HOT 4
- Bypassing other limitations HOT 11
- Can't encode multiple stream on version 460.106.00 & 460.73.01 HOT 2
- nvlax_encode: command not found (Windows 10 / WSL2) HOT 3
- Patch appears successful but has no affect (Windows / 496.49) HOT 5
- Error running nvlax_encode HOT 5
- .so file?
- Cannot perform NvFBC patch on 495.44 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvlax.