Skip to content

Ubuntu install_dependencies: detect the version without lsb_release - #8606

Merged
danoli3 merged 1 commit into
openframeworks:masterfrom
danoli3:ubuntu-version-detect
Oct 25, 2026
Merged

danoli3 merged 1 commit into
openframeworks:masterfrom
danoli3:ubuntu-version-detect

Conversation

@danoli3

@danoli3 danoli3 commented Oct 25, 2026

Copy link
Copy Markdown
Member

scripts/linux/ubuntu/install_dependencies.sh got the Ubuntu version from lsb_release -r. Minimal installs don't have lsb_release (Docker ubuntu:22.04 / ubuntu:24.04, some cloud images). There the version came out empty, the -lt 12/13/14 checks misfired, and the script took the Ubuntu 12/14 branch (CXX_VER=-4.9, the toolchain PPA). apt then failed on g++-4.9, nothing else was installed, and the core build stopped at the pkg-config checks.

Before, on stock ubuntu:24.04:

./install_dependencies.sh: line 76: lsb_release: command not found
Running on ubuntu .
E: Unable to locate package g++-4.9

Changes

  • Ubuntu: VERSION_ID from /etc/os-release, which the script already sources.
  • elementary (Ubuntu base): lsb_release -r -s -u when present, then /etc/upstream-release/lsb-release, then UBUNTU_CODENAME (bionic, focal, jammy, noble). The fallbacks matter: elementary 7's Docker image has lsb_release, but lsb_release -u returns nothing there.
  • Linux Mint: unchanged (/etc/upstream-release/lsb-release).
  • The version is validated as numeric. If it can't be found, the script exits with an error instead of falling into the 4.9 branch:
    Couldn't detect the Ubuntu version (got '').
    Check VERSION_ID in /etc/os-release, or install lsb-release: sudo apt-get install lsb-release
    
  • The minor version's leading zero is stripped after the "Running on ubuntu 24.04" message, so 04 isn't read as octal in the numeric tests.

No other script under scripts/linux/ uses lsb_release.

Tested (Docker, arm64). Each run: install_dependencies.sh -y, then scripts/linux/download_libs.sh, then make -C libs/openFrameworksCompiled/project Release.

Image lsb-release Detected install_dependencies download_libs core build
ubuntu:24.04 not installed 24.04 ✅ all packages ✅ ✅ Done!, no pkg-config errors
ubuntu:24.04 installed 24.04 ✅ ✅ ✅
ubuntu:22.04 not installed 22.04 ✅ ✅ ✅
ubuntu:22.04 installed 22.04 ✅ ✅ ✅

No g++-4.9 or missing-package lines in any run.

Version detection only:

Image Result
linuxmintd/mint22-amd64 Running on ubuntu 24.04 (this image reports ID=ubuntu, so it takes the Ubuntu path, not the Mint one)
elementary/docker:stable (elementary 7, with lsb_release) Running on ubuntu 22.04
elementary/docker:stable without lsb_release Running on ubuntu 22.04 (codename)
ubuntu:24.04 with VERSION_ID removed the error above, exit 1

bash -n passes. shellcheck (koalaman/shellcheck:stable) reports nothing on the changed lines.

@danoli3
danoli3 merged commit 64f4b87 into openframeworks:master Oct 25, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant