locaal-ai / obs-localvocal

OBS plugin for local speech recognition and captioning using AI
https://obsproject.com/forum/resources/localvocal-live-stream-ai-assistant.1769/
GNU General Public License v2.0
545 stars 42 forks source link

build scripts configured for zsh, not bash? #116

Open twilwa opened 5 months ago

twilwa commented 5 months ago

hey, not sure if i'm missing something -- it looks to me like the scripts are only built for zsh rather than bash in the .github folder. I replaced a few of the variables but I'm still getting errors -- is there a for-bash-not-zsh script somewhere or is the script intended to handle both types of shell?

twilwa commented 5 months ago

Did some rerigging, script i'm working with currently is:


#!/usr/bin/env bash

set -e
set -u
set -o pipefail

## Enable for script debugging
# set -x

SCRIPT_HOME=$(dirname "$(realpath "$0")")
CMAKE_PREFIX_PATH=~/Qt/6.7.2/gcc_64

function trap_exit {
  local return_value=$?
  if [[ -n ${CI:-} ]]; then unset NSUnbufferedIO; fi
  return ${return_value}
}
trap trap_exit EXIT

function trap_err {
  echo "Script execution error occurred!" >&2
  echo "Callstack:" >&2
  for line in "${BASH_SOURCE[@]}"; do
    echo "$line" >&2
  done
  exit 2
}
trap trap_err ERR

function check_linux {
  echo "Checking Linux dependencies..."
  if ! command -v ninja &> /dev/null; then
    echo "Ninja build system is not installed. Installing..."
    sudo apt-get update && sudo apt-get install -y ninja-build
  fi
  if ! command -v gcc &> /dev/null; then
    echo "GCC compiler is not installed. Installing..."
    sudo apt-get update && sudo apt-get install -y build-essential
  fi
  if ! dpkg -l | grep -q libobs-dev; then
    echo "libobs-dev is not installed. Installing..."
    sudo apt-get update && sudo apt-get install -y libobs-dev
  fi
  if ! dpkg -l | grep -q qtbase5-dev; then
    echo "Qt base development packages are not installed. Installing..."
    sudo apt-get update && sudo apt-get install -y qtbase5-dev qt5-qmake qttools5-dev-tools
  fi
}

function setup_ccache {
  echo "Setting up ccache..."
  if ! command -v ccache &> /dev/null; then
    echo "ccache is not installed. Installing..."
    sudo apt-get update && sudo apt-get install -y ccache
  fi
}

function build {
  local host_os=$(uname | tr '[:upper:]' '[:lower:]')
  local project_root=$(dirname "$(dirname "$SCRIPT_HOME")")
  local buildspec_file="${project_root}/buildspec.json"

  if [[ ! -r "$buildspec_file" ]]; then
    echo 'No buildspec.json found. Please create a build specification for your project.' >&2
    return 2
  fi

  local target="${host_os}-${HOSTTYPE}"
  local config='RelWithDebInfo'
  local verbosity=1

  check_linux
  setup_ccache

  if [[ ! -d "$CMAKE_PREFIX_PATH/include/QtWidgets" ]]; then
    echo "QtWidgets not found. Please verify your Qt installation." >&2
    exit 2
  fi

  local build_dir="${project_root}/build"

  mkdir -p "$build_dir"

  pushd "$project_root"
  echo "Configuring project..."

  local cmake_args=(
    -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH"
    -DCMAKE_BUILD_TYPE="$config"
    -G "Ninja"
  )

  echo "CMake arguments: ${cmake_args[*]}"

  cmake -S "$project_root" -B "$build_dir" "${cmake_args[@]}"

  echo "Building project..."
  cmake --build "$build_dir"

  echo "Installing project..."
  cmake --install "$build_dir"

  popd
}

build "$@"

image

is the current error, i beleive i got a different one on one run of the script but it seems to have landed here. will tweak it a bit more later, but i'm presuming i'm missing something about the bash/zsh thing that may save me much more trouble lol

twilwa commented 5 months ago

Ended up installing zsh -- I'm still failing on Pop! OS with the following error: image which now occurs after re-running the script, the first script erroring out on the GPG key step:

image

royshil commented 5 months ago

i'm using the build scripts from https://github.com/obsproject/obs-plugintemplate they use zsh but zsh should be available or installable in all *nix OSs frankly

i don't have capacity to translate to bash. unfortunately