Conflict between and when using opencv and encodeFromFd interface in the same program

When I used encodeFromFd interface to do jpeg encode, the program crashed and the printing was as follows:JPEG parameter struct mismatch: library thinks size is 584, caller expects 728.After troubleshooting,I found that library that opencv depends on and library that encodeFromFd interface depends on conflict due to the existence of functions with the same name.I tried to use compile options “-Wl,rpath=dynamic library path” to specify library path when using encodeFromFd interface, but it didn’t work.My program needs to use opencv and encodeFromFd interface.Do you have any good solutions?

This conflict is known and we don’t support this use-case. Please check explanation in
OpenCV with libnvjpeg - #5 by DaneLLL

We would suggest use in OpenCV.