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

Default CUDA library name is incorrect for linux #884

Closed
DJtheRedstoner opened this issue May 6, 2023 · 3 comments
Closed

Default CUDA library name is incorrect for linux #884

DJtheRedstoner opened this issue May 6, 2023 · 3 comments

Comments

@DJtheRedstoner
Copy link

DJtheRedstoner commented May 6, 2023

Version

3.3.2

Platform

Linux x64

JDK

openjdk version "17.0.6" (Ubuntu package)

Module

CUDA

Bug description

The default library name for CUDA is set to nvcuda, which is correct for Windows but on Linux the library name is just cuda.

private static final SharedLibrary NVCUDA = Library.loadNative(CU.class, "org.lwjgl.cuda", Configuration.CUDA_LIBRARY_NAME, "nvcuda");

Setting -Dorg.lwjgl.cuda.libname=cuda fixes this problem.

Stacktrace or crash log output

[LWJGL] Failed to load a library. Possible solutions:
	a) Install the library or the driver that provides the library.
	b) Ensure that the library is accessible from the system library paths.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: libnvcuda.so
	at org.lwjgl.system.Library.loadNative(Library.java:346)
	at org.lwjgl.system.Library.loadNative(Library.java:236)
	at org.lwjgl.system.Library.loadNative(Library.java:217)
	at org.lwjgl.system.Library.loadNative(Library.java:431)
	at org.lwjgl.system.Library.loadNative(Library.java:402)
	at org.lwjgl.cuda.CU.<clinit>(CU.java:34)
	at me.djtheredstoner.gitvanity.cuda.CUDATest.main(CUDATest.java:33)
======== Error: Application returned non-zero code 1
@Spasi
Copy link
Member

Spasi commented May 18, 2023

Thanks @DJtheRedstoner, will be fixed in the first 3.3.3 snapshot.

@Ealrann
Copy link

Ealrann commented Feb 7, 2024

Hello,
I'm trying to run the HelloCuda, and I encounter exactly the same problem on the v3.3.3 :

[LWJGL] Failed to load a library. Possible solutions:
        a) Install the library or the driver that provides the library.
        b) Ensure that the library is accessible from the system library paths.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: libnvcuda.so
        at org.lwjgl@3.3.3+5/org.lwjgl.system.Library.loadNative(Library.java:346)
        at org.lwjgl@3.3.3+5/org.lwjgl.system.Library.loadNative(Library.java:236)
        at org.lwjgl@3.3.3+5/org.lwjgl.system.Library.loadNative(Library.java:217)
        at org.lwjgl@3.3.3+5/org.lwjgl.system.Library.loadNative(Library.java:431)
        at org.lwjgl@3.3.3+5/org.lwjgl.system.Library.loadNative(Library.java:402)
        at org.lwjgl.cuda@3.3.3+5/org.lwjgl.cuda.CUDA.isPerThreadDefaultStreamSupported(CUDA.java:76)
        at org.nyaneer/org.xyz.CudaTest.run(CudaTest.java:94)
        at org.nyaneer/org.xyz.XYZApplicationLauncher.main(XYZApplicationLauncher.java:26)

I'm on Archlinux, with cuda package installed. It looks like the library is named "libcuda.so" there

# find / -name "*cuda.so" -type f 2>/dev/null
/opt/cuda/targets/x86_64-linux/lib/stubs/libcuda.so

@Ealrann
Copy link

Ealrann commented Feb 7, 2024

Ok, I got it working, but there is still a problem.

On Archlinux, libcuda.so is located in the package nvidia-utils (and not in package cuda)

But LWJGL 3.3.3 is still looking for a lib named libnvcuda.so.
As a workaround, I made a symbolic link:
ln -s /usr/lib/libcuda.so /usr/lib/libnvcuda.so

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

No branches or pull requests

3 participants