Hi,
Please try
Nvjpeg Cmake and OpenCV frames - #5 by Honey_Patouceul
If the issue persists, would suggest compare the custom environment with Jetson Nano developer kit(either Jetpack 4.6.x). To investigate why libnvjpeg.so cannot be linked in the custom environment.