Skip to content

Commit ce6853e

Browse files
Add explicitLibs list to libs discovery
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent 38d7faf commit ce6853e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

pkg/nvcdi/driver-nvml.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,39 @@ func getVersionLibs(logger logger.Interface, driver *root.Driver, version string
235235
return nil, "", fmt.Errorf("failed to locate libraries for driver version %v: %v", version, err)
236236
}
237237

238+
// List of explicit libraries to locate
239+
// TODO(ArangoGutierrez): we should load the version of the libraries from
240+
// the sandboxutils-filelist.
241+
explicitLibraryNames := []string{
242+
"libEGL.so.1.1.0",
243+
"libGL.so.1.7.0",
244+
"libGLESv1_CM.so.1.2.0",
245+
"libGLESv2.so.2.1.0",
246+
"libGLX.so.0",
247+
"libGLdispatch.so.0",
248+
"libOpenCL.so.1.0.0",
249+
"libOpenGL.so.0",
250+
"libnvidia-api.so.1",
251+
"libnvidia-egl-xcb.so.1.0.0",
252+
"libnvidia-egl-xlib.so.1.0.0",
253+
}
254+
255+
// Locate each explicit library
256+
var explicitLibs []string
257+
for _, libName := range explicitLibraryNames {
258+
found, _ := libraries.Locate(libName)
259+
// Since we are using WithOptional, we don't expect an error, but we still
260+
// log a warning if the library is not found.:q
261+
if len(found) == 0 {
262+
// Log warning when library is not found (but no error due to WithOptional)
263+
logger.Warningf("library %s not found in search paths", libName)
264+
}
265+
explicitLibs = append(explicitLibs, found...)
266+
}
267+
268+
// Append explicit libraries to the main libs list
269+
libs = append(libs, explicitLibs...)
270+
238271
if driver.Root == "/" || driver.Root == "" {
239272
return libs, libCudaDirectoryPath, nil
240273
}

0 commit comments

Comments
 (0)