diff --git a/llm/generate/gen_common.sh b/llm/generate/gen_common.sh index 703cb1d4..5cb237da 100644 --- a/llm/generate/gen_common.sh +++ b/llm/generate/gen_common.sh @@ -84,7 +84,7 @@ compress_libs() { echo "Compressing payloads to reduce overall binary size..." pids="" for lib in ${BUILD_DIR}/lib/*.${LIB_EXT}* ; do - bzip2 -v9 ${lib} & + gzip --best ${lib} & pids+=" $!" done echo diff --git a/llm/generate/gen_windows.ps1 b/llm/generate/gen_windows.ps1 index dc0992f5..e5d99f37 100644 --- a/llm/generate/gen_windows.ps1 +++ b/llm/generate/gen_windows.ps1 @@ -23,7 +23,7 @@ function init_vars { } else { $script:CUDA_LIB_DIR=$env:CUDA_LIB_DIR } - $script:BZIP2=(get-command -ea 'silentlycontinue' bzip2).path + $script:GZIP=(get-command -ea 'silentlycontinue' gzip).path $script:DUMPBIN=(get-command -ea 'silentlycontinue' dumpbin).path } @@ -69,14 +69,14 @@ function install { } function compress_libs { - if ($script:BZIP2 -eq $null) { - write-host "bzip2 not installed, not compressing files" + if ($script:GZIP -eq $null) { + write-host "gzip not installed, not compressing files" return } write-host "Compressing dlls..." $libs = dir "${script:buildDir}/lib/*.dll" foreach ($file in $libs) { - & "$script:BZIP2" -v9 $file + & "$script:GZIP" --best $file } } diff --git a/llm/payload_common.go b/llm/payload_common.go index 70610322..d0218979 100644 --- a/llm/payload_common.go +++ b/llm/payload_common.go @@ -1,7 +1,7 @@ package llm import ( - "compress/bzip2" + "compress/gzip" "errors" "fmt" "io" @@ -182,9 +182,12 @@ func extractDynamicLibs(workDir, glob string) ([]string, error) { } src := io.Reader(srcFile) filename := file - if strings.HasSuffix(file, ".bz2") { - src = bzip2.NewReader(src) - filename = strings.TrimSuffix(filename, ".bz2") + if strings.HasSuffix(file, ".gz") { + src, err = gzip.NewReader(src) + if err != nil { + return fmt.Errorf("decompress payload %s: %v", file, err) + } + filename = strings.TrimSuffix(filename, ".gz") } destFile := filepath.Join(targetDir, filepath.Base(filename)) @@ -229,9 +232,12 @@ func extractPayloadFiles(workDir, glob string) error { } src := io.Reader(srcFile) filename := file - if strings.HasSuffix(file, ".bz2") { - src = bzip2.NewReader(src) - filename = strings.TrimSuffix(filename, ".bz2") + if strings.HasSuffix(file, ".gz") { + src, err = gzip.NewReader(src) + if err != nil { + return fmt.Errorf("decompress payload %s: %v", file, err) + } + filename = strings.TrimSuffix(filename, ".gz") } destFile := filepath.Join(workDir, filepath.Base(filename)) diff --git a/scripts/rh_linux_deps.sh b/scripts/rh_linux_deps.sh index 1d5b181c..ec6b20a0 100644 --- a/scripts/rh_linux_deps.sh +++ b/scripts/rh_linux_deps.sh @@ -28,7 +28,6 @@ fi if [ -n "${CMAKE_VERSION}" ]; then curl -s -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz | tar -zx -C /usr --strip-components 1 - dnf install -y bzip2 fi if [ -n "${GOLANG_VERSION}" ]; then