Skip to content

Commit 4b381d3

Browse files
Fix CUDA installation for cross-compilation and bash syntax in version check
Co-authored-by: ReenigneArcher <[email protected]>
1 parent 7c12a73 commit 4b381d3

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

scripts/linux_build.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ function add_fedora_deps() {
400400
}
401401

402402
function install_cuda() {
403+
# Skip CUDA installation for cross-compilation
404+
if [ "$cross_compile" == 1 ]; then
405+
echo "Skipping CUDA installation for cross-compilation"
406+
return 0
407+
fi
408+
403409
# Check if CUDA is already available
404410
if detect_nvcc_path > /dev/null 2>&1; then
405411
return
@@ -482,14 +488,16 @@ function check_version() {
482488
return 1
483489
fi
484490

485-
if [[ "$(printf '%s\n' "$installed_version" "$min_version" | sort -V | head -n1)" = "$min_version" ]] && \
486-
[[ "$(printf '%s\n' "$installed_version" "$max_version" | sort -V | head -n1)" = "$installed_version" ]]; then
487-
echo "Installed version is within range"
488-
return 0
489-
else
490-
echo "$package_name version $installed_version is out of range"
491-
return 1
491+
# Simplified version comparison using sort -V
492+
if [ "$(printf '%s\n' "$installed_version" "$min_version" | sort -V | head -n1)" = "$min_version" ]; then
493+
if [ "$max_version" = "inf" ] || [ "$(printf '%s\n' "$installed_version" "$max_version" | sort -V | head -n1)" = "$installed_version" ]; then
494+
echo "Installed version is within range"
495+
return 0
496+
fi
492497
fi
498+
499+
echo "$package_name version $installed_version is out of range"
500+
return 1
493501
}
494502

495503
function run_step_deps() {

0 commit comments

Comments
 (0)