Skip to content

patchpkg: improve CUDA shared library search #2306

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

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Sep 27, 2024

Consolidate the shared library search logic into patchpkg. Search in more directories (notably /var/lib/*/lib) and do a better job of detecting the various library names. This allows Devbox to find libcuda inside Devspace containers.

The new patchpkg types and functions are:

type SharedLibrary struct {
	*os.File

	LinkerName string
	Soname     string
	RealName   string
}

func OpenSharedLibrary(name string) (SharedLibrary, error)

func FindSharedLibrary(name string, searchPath ...string) iter.Seq[SharedLibrary]

func (lib SharedLibrary) CopyAndLink(dir string) error

Consolidate the shared library search logic into patchpkg. Search in
more directories (notably `/var/lib/*/lib`) and do a better job of
detecting the various [library names]. This allows Devbox to find
libcuda inside Devspace containers.

[library names]: https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

The new patchpkg types and functions are:

	type SharedLibrary struct {
		*os.File

		LinkerName string
		Soname     string
		RealName   string
	}

	func OpenSharedLibrary(name string) (SharedLibrary, error)

	func FindSharedLibrary(name string, searchPath ...string) iter.Seq[SharedLibrary]

	func (lib SharedLibrary) CopyAndLink(dir string) error
@gcurtis gcurtis requested review from mikeland73 and savil September 27, 2024 17:19
lib, err := OpenSharedLibrary(name)
if err == nil {
yield(lib)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print some warning about the error?

@gcurtis gcurtis merged commit 8ca1f75 into main Sep 30, 2024
28 checks passed
@gcurtis gcurtis deleted the gcurtis/better-lib-search branch September 30, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants