Nvjpeg 12.3.5.92 segfault on nvjpegCreateSimple

basically what the topic says, started after updating the cuda toolkit with nvjpeg 12.3.5.92

minimal example:


#include <opencv2/cudaarithm.hpp>
#include <nvjpeg.h>
#include <stdexcept>
#include <cstring>
#include <iostream>
#include <fstream>
#include <string>


inline void nvjpegCheck(nvjpegStatus_t status, const char* msg)
{
	if (status != NVJPEG_STATUS_SUCCESS) {
		throw std::runtime_error(std::string("nvJPEG error: ") + msg + " (" + std::to_string(status) + ")");
	}
}


int main(int argc, char* argv[]) {
    try {
        cudaSetDevice(0);
        cudaFree(0); // forces context creation

    		cudaStream_t m_stream;

    		// All these are created in the constructor and destroyed in the destructor
    		nvjpegHandle_t          m_nvjpegHandle   = NULL;
    		nvjpegJpegState_t       m_jpegState      = NULL;
    		nvjpegEncoderState_t    m_encoderState   = NULL;
    		nvjpegEncoderParams_t   m_encoderParams  = NULL;

    	// Initialize CUDA stream
    	cudaStreamCreate(&m_stream);

    	// 1. Create nvJPEG handle with custom allocator
    	nvjpegCheck(
					nvjpegCreateSimple(&m_nvjpegHandle),
					"nvjpegCreate"
			);
    }
    catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << std::endl;
        return 1;
    }
}

I tried both CUDA 12.2 and CUDA 12.8.1

I removed the unnecessary include:

I compiled the remaining code with:

nvcc -o test test.cu -lnvjpeg

Then I ran the code:

./test

I did not have any seg fault on either CUDA 12.2 or CUDA 12.8.