1 diff --git a/src/ldcache.c b/src/ldcache.c
2 index 38bab05..e1abc89 100644
5 @@ -108,40 +108,27 @@ ldcache_close(struct ldcache *ctx)
8 ldcache_resolve(struct ldcache *ctx, uint32_t arch, const char *root, const char * const libs[],
9 - char *paths[], size_t size, ldcache_select_fn select, void *select_ctx)
10 + char *paths[], size_t size, const char* version)
13 - struct header_libc6 *h;
18 - h = (struct header_libc6 *)ctx->ptr;
19 memset(paths, 0, size * sizeof(*paths));
21 - for (uint32_t i = 0; i < h->nlibs; ++i) {
22 - int32_t flags = h->libs[i].flags;
23 - char *key = (char *)ctx->ptr + h->libs[i].key;
24 - char *value = (char *)ctx->ptr + h->libs[i].value;
26 - if (!(flags & LD_ELF) || (flags & LD_ARCH_MASK) != arch)
27 + for (size_t j = 0; j < size; ++j) {
28 + snprintf(dir, 100, "/run/opengl-driver%s/lib",
29 + arch == LD_I386_LIB32 ? "-32" : "");
30 + if (!strncmp(libs[j], "libvdpau_nvidia.so", 100))
31 + strcat(dir, "/vdpau");
32 + snprintf(lib, 100, "%s/%s.%s", dir, libs[j], version);
33 + if (path_resolve_full(ctx->err, path, "/", lib) < 0)
35 + if (!file_exists(ctx->err, path))
38 - for (size_t j = 0; j < size; ++j) {
39 - if (!str_has_prefix(key, libs[j]))
41 - if (path_resolve(ctx->err, path, root, value) < 0)
43 - if (paths[j] != NULL && str_equal(paths[j], path))
45 - if ((override = select(ctx->err, select_ctx, root, paths[j], path)) < 0)
49 - paths[j] = xstrdup(ctx->err, path);
50 - if (paths[j] == NULL)
55 + paths[j] = xstrdup(ctx->err, path);
56 + if (paths[j] == NULL)
61 diff --git a/src/ldcache.h b/src/ldcache.h
62 index 33d78dd..2b087db 100644
65 @@ -50,6 +50,6 @@ void ldcache_init(struct ldcache *, struct error *, const char *);
66 int ldcache_open(struct ldcache *);
67 int ldcache_close(struct ldcache *);
68 int ldcache_resolve(struct ldcache *, uint32_t, const char *, const char * const [],
69 - char *[], size_t, ldcache_select_fn, void *);
70 + char *[], size_t, const char*);
72 #endif /* HEADER_LDCACHE_H */
73 diff --git a/src/nvc_info.c b/src/nvc_info.c
74 index 30e3cfd..6d12a50 100644
77 @@ -167,15 +167,13 @@ find_library_paths(struct error *err, struct nvc_driver_info *info, const char *
78 if (path_resolve_full(err, path, root, ldcache) < 0)
80 ldcache_init(&ld, err, path);
81 - if (ldcache_open(&ld) < 0)
85 info->libs = array_new(err, size);
86 if (info->libs == NULL)
88 if (ldcache_resolve(&ld, LIB_ARCH, root, libs,
89 - info->libs, info->nlibs, select_libraries_fn, info) < 0)
90 + info->libs, info->nlibs, info->nvrm_version) < 0)
94 @@ -183,13 +181,11 @@ find_library_paths(struct error *err, struct nvc_driver_info *info, const char *
95 if (info->libs32 == NULL)
97 if (ldcache_resolve(&ld, LIB32_ARCH, root, libs,
98 - info->libs32, info->nlibs32, select_libraries_fn, info) < 0)
99 + info->libs32, info->nlibs32, info->nvrm_version) < 0)
104 - if (ldcache_close(&ld) < 0)
109 @@ -203,7 +199,7 @@ find_binary_paths(struct error *err, struct nvc_driver_info *info, const char *r
113 - if ((env = secure_getenv("PATH")) == NULL) {
114 + if ((env = "/run/nvidia-docker/bin:/run/nvidia-docker/extras/bin") == NULL) {
115 error_setx(err, "environment variable PATH not found");
118 diff --git a/src/nvc_ldcache.c b/src/nvc_ldcache.c
119 index 6ff380f..cbe6a69 100644
120 --- a/src/nvc_ldcache.c
121 +++ b/src/nvc_ldcache.c
122 @@ -340,7 +340,7 @@ nvc_ldcache_update(struct nvc_context *ctx, const struct nvc_container *cnt)
123 if (validate_args(ctx, cnt != NULL) < 0)
126 - argv = (char * []){cnt->cfg.ldconfig, cnt->cfg.libs_dir, cnt->cfg.libs32_dir, NULL};
127 + argv = (char * []){cnt->cfg.ldconfig, "-f", "/tmp/ld.so.conf.nvidia-host", "-C", "/tmp/ld.so.cache.nvidia-host", cnt->cfg.libs_dir, cnt->cfg.libs32_dir, NULL};
128 if (*argv[0] == '@') {
130 * We treat this path specially to be relative to the host filesystem.