Skip to content

Commit

Permalink
Fix path detection in ubuntu like systems (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi authored Nov 24, 2023
1 parent 22b78e6 commit b1cac2b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/discovery/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function find_rocm_library(lib::String, dirs::Vector{String}, ext::String = dlex
isempty(path) || return Libdl.dlpath(path)

for dir in dirs
dir = joinpath(dir, Sys.islinux() ? "lib" : "bin")
files = readdir(dir)
for file in files
matched = startswith(basename(file), lib * ".$ext")
Expand Down Expand Up @@ -96,20 +97,22 @@ end
function find_ld_lld(rocm_paths::Vector{String})
lld_name = "ld.lld" * (Sys.iswindows() ? ".exe" : "")
for path in rocm_paths
exp_ld_path = joinpath(path, lld_name)
if ispath(exp_ld_path)
try
tmpfile = tempname(;cleanup=false)
run(pipeline(`$exp_ld_path -v`; stdout=tmpfile))
vstr = read(tmpfile, String)
rm(tmpfile)
vstr = replace(vstr, "AMD " => "")
vstr_splits = split(vstr, ' ')
if VersionNumber(vstr_splits[2]) >= v"6.0.0"
return exp_ld_path
for subdir in (joinpath("llvm", "bin"), "bin")
exp_ld_path = joinpath(path, subdir, lld_name)
if ispath(exp_ld_path)
try
tmpfile = tempname(;cleanup=false)
run(pipeline(`$exp_ld_path -v`; stdout=tmpfile))
vstr = read(tmpfile, String)
rm(tmpfile)
vstr = replace(vstr, "AMD " => "")
vstr_splits = split(vstr, ' ')
if VersionNumber(vstr_splits[2]) >= v"6.0.0"
return exp_ld_path
end
catch
@debug "bindeps: Failed running ld.lld in $exp_ld_path"
end
catch
@debug "bindeps: Failed running ld.lld in $exp_ld_path"
end
end
end
Expand Down

0 comments on commit b1cac2b

Please sign in to comment.