Hi,
I am adding hardware acceleration (nvenc) to webrtc native but am stucked in compiling webrtc with cuda.
I have created a new rtc_library called 'nvenc_h264' to replace 'webrtc_h264'. The BUILD.gn looks like following:
rtc_library("nvenc_h264") {
visibility = [ "*" ]
sources = [
"/usr/local/cuda/include/cuda.h",
"codecs/h264/h264_nvenc_encoder.cc",
"codecs/h264/h264_nvenc_encoder.h",
"codecs/h264/h264_nvenc_decoder.cc",
"codecs/h264/h264_nvenc_decoder.h",
"codecs/h264/nvEncodeAPI.h",
"codecs/h264/NvEncoder.cc",
"codecs/h264/NvEncoder.h",
"codecs/h264/NvEncoderCuda.cc",
"codecs/h264/NvEncoderCuda.h",
]
defines = []
lib_dirs = [
"/home/lix16/Workspace/webrtc/src/build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu"
]
libs = [
"cuda",
]
deps = [
":video_codec_interface",
":video_coding_utility",
"../../api/video:video_frame",
"../../api/video:video_frame_i010",
"../../api/video:video_rtp_headers",
"../../api/video_codecs:scalability_mode",
"../../api/video_codecs:video_codecs_api",
"../../common_video",
"../../media:rtc_media_base",
"../../rtc_base",
"../../rtc_base:checks",
"../../rtc_base:event_tracer",
"../../rtc_base:logging",
"../../rtc_base:timeutils",
"../../rtc_base/system:rtc_export",
"../../system_wrappers:field_trial",
"../../system_wrappers:metrics",
"//third_party/libyuv",
]
absl_deps = [
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types: optional",
]
}
I have manually copied libcuda.so.1 from my home system to /home/lix16/Workspace/webrtc/src/build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu. However, the ld still complains about not finding cuda:
ld.lld: error: unable to find library -lcuda
Any idea of solving this issue? If I am adding cuda in a wrong way, please give me insights on a better solution.
Thanks a lot.
Regards,
Xuebing