Qt development on jetson uses nvml to report an error

#include <stdint.h>
#include </usr/local/cuda-11.4/targets/aarch64-linux/include/nvml.h>
//#include <hwloc/nvml.h>
#include <QDebug>

#pragma  comment(lib, "\\usr\\local\\cuda-11.4\\targets\\aarch64-linux\\lib\\stubs\\libnvidia-ml.so")

Cuda::Cuda()
{
    nvmlReturn_t  result;
    uint32_t device_count;

    result = nvmlInit();

    result = nvmlDeviceGetCount(&device_count);
    if (NVML_SUCCESS != result)
    {
        //qDebug() << "Failed to query device count: " << nvmlErrorString(result);
    }
}

The above code reports an error

error: undefined reference to `nvmlInit_v2'
undefined reference to `nvmlDeviceGetCount_v2'
:-1: error: collect2: error: ld returned 1 exit status

JETPACK 5.0.2
May I ask why this error is, and why #include <hwloc/nvml.h> does not work

Hi,
Does it work if you link it in make command like:

-L/usr/local/cuda-11.4/targets/aarch64-linux/lib/stubs/ -lnvidia-ml

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.