Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM installs libdrmaa.so in /usr/lib64, but sets DRMAA_LIBRARY_PATH to /usr/lib/ #53

Open
kcgthb opened this issue May 14, 2021 · 1 comment

Comments

@kcgthb
Copy link
Contributor

kcgthb commented May 14, 2021

Hi!

Using the provided SPEC file (CentOS 7.x, x86_64), it looks like the generated RPM installs libdrmaa.so in /usr/lib64:

$ rpm -ql slurm-drmaa
/usr/bin/drmaa-run
/usr/bin/drmaa-run-bulk
/usr/bin/hpc-bash
/usr/include/drmaa.h
/usr/lib64/libdrmaa.a
/usr/lib64/libdrmaa.la
/usr/lib64/libdrmaa.so
/usr/lib64/libdrmaa.so.1
/usr/lib64/libdrmaa.so.1.0.8
/usr/share/doc/slurm-drmaa-1.1.2
/usr/share/doc/slurm-drmaa-1.1.2/COPYING
/usr/share/doc/slurm-drmaa-1.1.2/NEWS
/usr/share/doc/slurm-drmaa-1.1.2/README.md
/usr/share/doc/slurm-drmaa-1.1.2/slurm_drmaa.conf.example

But DRMAA_LIBRARY_PATH defaults to /usr/lib/libdrmaa.so:

$ drmaa-run
F #1d7bd [     0.00]  * Could not load DRMAA library (DRMAA_LIBRARY_PATH=/usr/lib/libdrmaa.so)
F #1d7bd [     0.00]  * Error

and:

$ strace -e open drmaa-run
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libdrmaa.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
F #1d7c5 [     0.00]  * Could not load DRMAA library (DRMAA_LIBRARY_PATH=/usr/lib/libdrmaa.so)
F #1d7c5 [     0.00]  * Error
+++ exited with 255 +++

Would there be a way to make the default DRMAA_LIBRARY_PATH consistent with the RPM installation?

@richc-admin-gcai
Copy link

richc-admin-gcai commented Jan 5, 2022

I think this just needs another #if #else branch to check if the machine is 64 or 32 bit.

Internally I've applied the following patches which fixes this at compile time on CentOS, but it might make more sense to check at runtime for number of bits and is file exists, as Ubuntu uses /usr/lib and CentOS uses /usr/lib64.

Alternatively the spec file could patch in the the pre stage as then you know its CentOS.

--- slurm-drmaa-1.1.3/drmaa_utils/drmaa_utils/drmaa_run_bulk.c	2021-10-07 19:29:41.000000000 +0100
+++ drmaa_run_bulk.c	2022-01-05 11:17:45.109079264 +0000
@@ -149,9 +149,18 @@
 
 	if (!path_to_drmaa) {
 #ifdef __APPLE__
-		path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.dylib";
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.dylib";
 #else
-		path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+
+#if __GNUC__
+#if __x86_64__ || __ppc64__
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib64/libdrmaa.so";
+#else
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+#endif
+#else
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+#endif
 #endif
 	}
--- slurm-drmaa-1.1.3/drmaa_utils/drmaa_utils/drmaa_run.c	2021-10-07 19:29:41.000000000 +0100
+++ drmaa_run.c	2022-01-05 11:17:52.967210135 +0000
@@ -149,8 +149,17 @@
 #ifdef __APPLE__
 		path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.dylib";
 #else
+
+#if __GNUC__
+#if __x86_64__ || __ppc64__
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib64/libdrmaa.so";
+#else
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+#endif
+#else
 		path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
 #endif
+#endif
 	}
 
 	api.handle = dlopen(path_to_drmaa, RTLD_LAZY | RTLD_GLOBAL);
--- slurm-drmaa-1.1.3/drmaa_utils/drmaa_utils/drmaa_job_ps.c	2021-10-07 19:29:41.000000000 +0100
+++ drmaa_job_ps.c	2022-01-05 11:17:59.938326234 +0000
@@ -139,9 +139,18 @@
 
 	if (!path_to_drmaa) {
 #ifdef __APPLE__
-		path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.dylib";
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.dylib";
 #else
-		path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+
+#if __GNUC__
+#if __x86_64__ || __ppc64__
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib64/libdrmaa.so";
+#else
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+#endif
+#else
+                path_to_drmaa = DRMAA_DIR_PREFIX"/lib/libdrmaa.so";
+#endif
 #endif
 	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants