Skip to content
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

debug libnpu_driver_compiler is not copied to "build/lib" and build error reported #66

Open
zxue2 opened this issue Jan 9, 2025 · 2 comments

Comments

@zxue2
Copy link

zxue2 commented Jan 9, 2025

Steps as below. Please have a check.

(1) Pull npu driver according to [linux-npu-driver/docs/overview.md at main · intel/linux-npu-driver](https://github.com/intel/linux-npu-driver/blob/main/docs/overview.md)

(2)Change npu_compiler_build.cmake.

diff --git a/compiler/npu_compiler_build.cmake b/compiler/npu_compiler_build.cmake
index d61018f..9941dd0 100644
--- a/compiler/npu_compiler_build.cmake
+++ b/compiler/npu_compiler_build.cmake
@@ -27,7 +27,9 @@ list(APPEND NPU_COMPILER_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOO
list(APPEND NPU_COMPILER_CMAKE_FLAGS -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM})
list(APPEND NPU_COMPILER_CMAKE_FLAGS -DBUILD_COMPILER_FOR_DRIVER=ON)
list(APPEND NPU_COMPILER_CMAKE_FLAGS -DBUILD_SHARED_LIBS=OFF)
-list(APPEND NPU_COMPILER_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Release)
+list(APPEND NPU_COMPILER_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug)
+#list(APPEND NPU_COMPILER_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUG="-O1")
+list(APPEND NPU_COMPILER_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUG="-g")
list(APPEND NPU_COMPILER_CMAKE_FLAGS -DENABLE_CLANG_FORMAT=OFF)
list(APPEND NPU_COMPILER_CMAKE_FLAGS -DENABLE_GAPI_PREPROCESSING=OFF)
list(APPEND NPU_COMPILER_CMAKE_FLAGS -DENABLE_HETERO=OFF)

(3) Compile npu driver with compiler as below

cmake -B build -S .  -DENABLE_NPU_COMPILER_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG="-g -O0"

cmake --build build --parallel  $(nproc)   

(4) Error compilation log snippet

[100%] Linking CXX shared library ../../../../../../bin/intel64/Debug/libnpu_driver_compiler.so
[100%] Built target npu_driver_compiler
[ 65%] Performing install step for 'npu_compiler_build'
cp: cannot stat '/root/npu/linux-npu-driver/build/third_party/npu_plugin/build-cid/bin/intel64/Release/libnpu_driver_compiler.so': No sule or directory
gmake[2]: *** [compiler/CMakeFiles/npu_compiler_build.dir/build.make:105: third_party/openvino/src/npu_compiler_build-stamp/npu_compilerd-install] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1375: compiler/CMakeFiles/npu_compiler_build.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

(4) Find the debug lib under linux-npu-driver/build/third_party/npu_plugin/build-cid/bin/intel64/Debug

@jwludzik
Copy link
Contributor

jwludzik commented Jan 9, 2025

You need to change "Release" to "Debug" in the

cp ${NPU_COMPILER_BINARY_DIR}/bin/intel64/Release/libnpu_driver_compiler.so

@zxue2
Copy link
Author

zxue2 commented Jan 13, 2025

Thanks Jozef. It would be great if how to enable debug info for compiler can be added to README or somewhere, because we can't simply enable it by adding CMAKE_BUILD_TYPE & CMAKE_CXX_FLAGS_DEBUG in the cmake build command directly.

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

No branches or pull requests

2 participants