Skip to content

Commit 1de87cc

Browse files
calvarado2004omichelCoolSpy3
authored
Adding compilation support for Fedora 42 (#6780)
* Update linux_compilation_dependencies.sh * Update linux_runtime_dependencies.sh * Update scripts/install/linux_compilation_dependencies.sh Co-authored-by: CoolSpy3 <[email protected]> * add fedora warning and port additional install scripts * remove dependence on lsb-release * fix os version check * fix libfreetype includes * fix Ubuntu 22.04 check * use non-free ffmpeg * fix Makefile UBUNTU_VERSION --------- Co-authored-by: Olivier Michel <[email protected]> Co-authored-by: CoolSpy3 <[email protected]> Co-authored-by: CoolSpy3 <[email protected]>
1 parent 9886dd0 commit 1de87cc

File tree

8 files changed

+255
-58
lines changed

8 files changed

+255
-58
lines changed

resources/Makefile.os.include

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,25 @@ ifeq ($(OSTYPE),Darwin)
5050
OSTYPE = darwin
5151
endif
5252

53-
# determine the OSARCH and UBUNTU_VERSION (linux only)
53+
# determine the OSARCH, OSDIST, and UBUNTU_VERSION (linux only)
5454
ifeq ($(OSTYPE),linux)
5555
ifeq ($(filter x86_64, $(shell uname -a)),)
5656
OSARCH = i386
5757
else
5858
OSARCH = x86_64
5959
endif
60+
OSDIST=$(shell grep ^ID= /etc/os-release | cut -d= -f2)
6061
ifeq ($(OSTYPE),linux)
6162
ifeq ($(SNAP_NAME), webots)
6263
UBUNTU_VERSION=22.04
6364
else
64-
ifneq (, $(shell which lsb_release))
65-
UBUNTU_VERSION:=$(shell lsb_release -sr)
65+
ifneq (, $(wildcard /etc/os-release))
66+
UBUNTU_VERSION:=$(shell grep VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')
6667
endif
6768
endif
6869
endif
70+
else
71+
OSDIST=$(OSTYPE)
6972
endif
7073

7174
# OS specific variables
Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,56 @@
11
#!/bin/bash
22

3-
# exit when any command fails on CI
3+
# Exit when any command fails on CI
44
if [[ ! -z "$CI" ]]; then
5-
set -e
5+
set -e
66
fi
77

88
if [[ $EUID -ne 0 ]]; then
9-
echo "This script must be run as root"
10-
exit 1
9+
echo "This script must be run as root"
10+
exit 1
1111
fi
1212

13-
alias apt='apt --option="APT::Acquire::Retries=3"'
14-
apt update
15-
apt install --yes git lsb-release cmake swig libglu1-mesa-dev libglib2.0-dev libfreeimage3 libfreetype6-dev libxml2-dev libboost-dev libssh-gcrypt-dev libzip-dev libreadline-dev pbzip2 wget zip unzip python3 python3-pip libopenal-dev
16-
17-
UBUNTU_VERSION=$(lsb_release -rs)
18-
if [[ $UBUNTU_VERSION == "22.04" || $UBUNTU_VERSION == "24.04" ]]; then
19-
apt install --yes libzip4 openssl
13+
# Detect the operating system
14+
if [ -f /etc/os-release ]; then
15+
. /etc/os-release
16+
OS=$ID
17+
VERSION_ID=$VERSION_ID
2018
else
21-
echo "Unsupported Linux version: dependencies may not be completely installed. Only the two latest Ubuntu LTS are supported."
19+
echo "Cannot determine the operating system."
20+
exit 1
2221
fi
2322

23+
# Function to install packages on Ubuntu
24+
install_ubuntu_packages() {
25+
alias apt='apt --option="APT::Acquire::Retries=3"'
26+
apt update
27+
apt install --yes git cmake swig libglu1-mesa-dev libglib2.0-dev libfreeimage3 libfreetype6-dev libxml2-dev libboost-dev libssh-gcrypt-dev libzip-dev libreadline-dev pbzip2 wget zip unzip python3 python3-pip libopenal-dev
28+
29+
if [[ $VERSION_ID == "22.04" || $VERSION_ID == "24.04" ]]; then
30+
apt install --yes libzip4 openssl
31+
else
32+
echo "Unsupported Ubuntu version: dependencies may not be completely installed. Only the two latest Ubuntu LTS are supported."
33+
fi
34+
}
35+
36+
# Function to install packages on Fedora
37+
install_fedora_packages() {
38+
dnf install -y git cmake swig mesa-libGLU-devel glib2-devel freeimage freetype-devel.x86_64 freetype-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libxml2-devel boost-devel libssh-devel libzip-devel readline-devel pbzip2 wget zip unzip python3 python3-pip openal-soft-devel glm-devel stb-devel
39+
}
40+
41+
# Determine the operating system and call the appropriate function
42+
case "$OS" in
43+
ubuntu)
44+
install_ubuntu_packages
45+
;;
46+
fedora)
47+
install_fedora_packages
48+
;;
49+
*)
50+
echo "Unsupported operating system: $OS"
51+
exit 1
52+
;;
53+
esac
54+
2455
script_full_path=$(dirname "$0")
2556
$script_full_path/linux_runtime_dependencies.sh

scripts/install/linux_optional_compilation_dependencies.sh

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,60 @@ if [[ $EUID -ne 0 ]]; then
1010
exit 1
1111
fi
1212

13-
# Install add-apt-repository command
14-
alias apt='apt --option="APT::Acquire::Retries=3"'
15-
apt install --yes software-properties-common
16-
add-apt-repository -y ppa:deadsnakes/ppa
17-
apt update
18-
apt install --yes lsb-release curl python3.7-dev python3.8-dev python3.9-dev python3.10-dev dirmngr execstack libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev libssh-dev
19-
20-
UBUNTU_VERSION=$(lsb_release -rs)
21-
if [[ $UBUNTU_VERSION == "22.04" ]]; then
22-
apt install --yes openjdk-18-jdk
23-
elif [[ $UBUNTU_VERSION == "24.04" ]]; then
24-
apt install --yes openjdk-21-jdk
13+
# Detect the operating system
14+
if [ -f /etc/os-release ]; then
15+
. /etc/os-release
16+
OS=$ID
17+
VERSION_ID=$VERSION_ID
2518
else
26-
echo "Unsupported Linux version: dependencies may not be completely installed. Only the two latest Ubuntu LTS versions are supported."
19+
echo "Cannot determine the operating system."
20+
exit 1
2721
fi
2822

23+
# Function to install optional dependencies on Ubuntu
24+
install_ubuntu_optional_compilation_packages() {
25+
# Install add-apt-repository command
26+
alias apt='apt --option="APT::Acquire::Retries=3"'
27+
apt install --yes software-properties-common
28+
add-apt-repository -y ppa:deadsnakes/ppa
29+
apt update
30+
apt install --yes curl python3.7-dev python3.8-dev python3.9-dev python3.10-dev dirmngr execstack libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev libssh-dev
31+
32+
if [[ $VERSION_ID == "22.04" ]]; then
33+
apt install --yes openjdk-18-jdk
34+
elif [[ $VERSION_ID == "24.04" ]]; then
35+
apt install --yes openjdk-21-jdk
36+
else
37+
echo "Unsupported Linux version: dependencies may not be completely installed. Only the two latest Ubuntu LTS versions are supported."
38+
fi
39+
}
40+
41+
# Function to install runtime dependencies on Fedora
42+
install_fedora_optional_compilation_packages() {
43+
dnf install -y curl python3-devel execstack xerces-c-devel fox-devel gdal-devel proj-devel gl2ps-devel libssh-devel
44+
dnf install -y java-21-openjdk-devel
45+
46+
if [[ $VERSION_ID -le 42 ]]; then
47+
dnf install -y gnupg2
48+
else
49+
dnf install -y gnupg2-dirmngr
50+
fi
51+
}
52+
53+
# Determine the operating system and call the appropriate function
54+
case "$OS" in
55+
ubuntu)
56+
install_ubuntu_optional_compilation_packages
57+
;;
58+
fedora)
59+
install_fedora_optional_compilation_packages
60+
;;
61+
*)
62+
echo "Unsupported operating system: $OS"
63+
exit 1
64+
;;
65+
esac
66+
2967
script_full_path=$(dirname "$0")
3068
$script_full_path/linux_test_dependencies.sh --norecurse
3169
$script_full_path/linux_compilation_dependencies.sh
Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,76 @@
11
#!/bin/bash
22

3-
# exit when any command fails on CI
3+
# Exit when any command fails on CI
44
if [[ ! -z "$CI" ]]; then
5-
set -e
5+
set -e
66
fi
77

88
if [[ $EUID -ne 0 ]]; then
9-
echo "This script must be run as root"
10-
exit 1
9+
echo "This script must be run as root"
10+
exit 1
1111
fi
1212

13-
alias apt='apt --option="APT::Acquire::Retries=3"'
14-
apt update
15-
apt install --yes lsb-release g++ make libavcodec-extra libglu1-mesa libegl1 libxkbcommon-x11-dev libxcb-keysyms1 libxcb-image0 libxcb-icccm4 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcomposite-dev libxtst6 libnss3 libxcb-cursor0
16-
if [[ -z "$DISPLAY" ]]; then
17-
apt install --yes xvfb
18-
fi
19-
20-
UBUNTU_VERSION=$(lsb_release -rs)
21-
if [[ $UBUNTU_VERSION == "22.04" || $UBUNTU_VERSION == "24.04" ]]; then
22-
apt install --yes ffmpeg
13+
# Detect the operating system
14+
if [ -f /etc/os-release ]; then
15+
. /etc/os-release
16+
OS=$ID
17+
VERSION_ID=$VERSION_ID
2318
else
24-
echo "Unsupported Linux version: dependencies may not be completely installed. Only the two latest Ubuntu LTS are supported."
19+
echo "Cannot determine the operating system."
20+
exit 1
2521
fi
22+
23+
# Function to install runtime dependencies on Ubuntu
24+
install_ubuntu_runtime_packages() {
25+
alias apt='apt --option="APT::Acquire::Retries=3"'
26+
apt update
27+
apt install --yes g++ make libavcodec-extra libglu1-mesa libegl1 \
28+
libxkbcommon-x11-dev libxcb-keysyms1 libxcb-image0 libxcb-icccm4 libxcb-randr0 \
29+
libxcb-render-util0 libxcb-xinerama0 libxcomposite-dev libxtst6 libnss3 libxcb-cursor0
30+
31+
if [[ -z "$DISPLAY" ]]; then
32+
apt install --yes xvfb
33+
fi
34+
35+
if [[ $VERSION_ID == "22.04" || $VERSION_ID == "24.04" ]]; then
36+
apt install --yes ffmpeg
37+
else
38+
echo "Unsupported Linux version: dependencies may not be completely installed. Only the two latest Ubuntu LTS are supported."
39+
fi
40+
}
41+
42+
# Function to install runtime dependencies on Fedora
43+
install_fedora_runtime_packages() {
44+
dnf install -y gcc-c++ make mesa-libGLU libEGL \
45+
xkeyboard-config libxcb libXcomposite libXtst nss xcb-util xcb-util-image \
46+
xcb-util-keysyms xcb-util-renderutil xcb-util-wm xcb-util-cursor \
47+
48+
if [[ -z "$DISPLAY" ]]; then
49+
dnf install -y xorg-x11-server-Xvfb
50+
fi
51+
52+
# Install ffmpeg (with non-free codecs)
53+
# Enable RPMFusion
54+
dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
55+
if dnf list installed ffmpeg-free &> /dev/null; then
56+
dnf swap -y ffmpeg-free ffmpeg --allowerasing
57+
else
58+
dnf install -y ffmpeg
59+
fi
60+
61+
echo "WARNING: Fedora is not an officially supported OS! Dependencies may not be completely installed. Only the two latest Ubuntu LTS are supported."
62+
}
63+
64+
# Determine the operating system and call the appropriate function
65+
case "$OS" in
66+
ubuntu)
67+
install_ubuntu_runtime_packages
68+
;;
69+
fedora)
70+
install_fedora_runtime_packages
71+
;;
72+
*)
73+
echo "Unsupported operating system: $OS"
74+
exit 1
75+
;;
76+
esac

scripts/install/linux_test_dependencies.sh

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,49 @@
22

33
# exit when any command fails on CI
44
if [[ ! -z "$CI" ]]; then
5-
set -e
5+
set -e
66
fi
77

88
if [[ $EUID -ne 0 ]]; then
9-
echo "This script must be run as root"
10-
exit 1
9+
echo "This script must be run as root"
10+
exit 1
1111
fi
1212

13-
alias apt='apt --option="APT::Acquire::Retries=3"'
14-
apt install liburdfdom-tools -y
13+
# Detect the operating system
14+
if [ -f /etc/os-release ]; then
15+
. /etc/os-release
16+
OS=$ID
17+
VERSION_ID=$VERSION_ID
18+
else
19+
echo "Cannot determine the operating system."
20+
exit 1
21+
fi
22+
23+
install_ubuntu_test_packages() {
24+
alias apt='apt --option="APT::Acquire::Retries=3"'
25+
apt install liburdfdom-tools -y
26+
}
27+
28+
install_fedora_test_packages() {
29+
dnf install -y urdfdom-devel
30+
}
31+
32+
# Determine the operating system and call the appropriate function
33+
case "$OS" in
34+
ubuntu)
35+
install_ubuntu_test_packages
36+
;;
37+
fedora)
38+
install_fedora_test_packages
39+
;;
40+
*)
41+
echo "Unsupported operating system: $OS"
42+
exit 1
43+
;;
44+
esac
1545

1646
if [[ $@ != *"--norecurse"* ]]; then
17-
echo "Installing runtime dependencies"
18-
script_full_path=$(dirname "$0")
19-
$script_full_path/linux_runtime_dependencies.sh
47+
echo "Installing runtime dependencies"
48+
script_full_path=$(dirname "$0")
49+
$script_full_path/linux_runtime_dependencies.sh
2050
fi

scripts/install/linux_web_viewer_dependencies.sh

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,42 @@ if [[ $EUID -ne 0 ]]; then
1010
exit 1
1111
fi
1212

13-
alias apt='apt --option="APT::Acquire::Retries=3"'
14-
apt install python3-pip python3-setuptools -y
13+
# Detect the operating system
14+
if [ -f /etc/os-release ]; then
15+
. /etc/os-release
16+
OS=$ID
17+
VERSION_ID=$VERSION_ID
18+
else
19+
echo "Cannot determine the operating system."
20+
exit 1
21+
fi
22+
23+
install_ubuntu_web_viewer_packages() {
24+
alias apt='apt --option="APT::Acquire::Retries=3"'
25+
apt install python3-pip python3-setuptools -y
26+
}
27+
28+
install_fedora_web_viewer_packages() {
29+
dnf install -y python3-pip python3-setuptools
30+
}
31+
32+
# Determine the operating system and call the appropriate function
33+
case "$OS" in
34+
ubuntu)
35+
install_ubuntu_web_viewer_packages
36+
;;
37+
fedora)
38+
install_fedora_web_viewer_packages
39+
;;
40+
*)
41+
echo "Unsupported operating system: $OS"
42+
exit 1
43+
;;
44+
esac
45+
1546
pip3 install --upgrade pip
1647
pip3 install pyclibrary
1748

18-
1949
git clone https://github.com/emscripten-core/emsdk.git dependencies/emsdk
2050

2151
USER=$(env | grep SUDO_USER | cut -d '=' -f 2-)
@@ -26,3 +56,7 @@ chown -R $USER dependencies/emsdk
2656

2757
WEBOTS_HOME=$(pwd)
2858
echo 'source "'$WEBOTS_HOME'/dependencies/emsdk/emsdk_env.sh" >/dev/null 2>&1' >> /home/$USER/.bashrc
59+
60+
if [[ "$OS" == "fedora" ]]; then
61+
echo "WARNING: Fedora is not an officially supported OS! Dependencies may not be completely installed. Only the two latest Ubuntu LTS are supported."
62+
fi

src/wren/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ ifeq ($(OSTYPE),darwin)
3030
INCLUDE += -I$(WEBOTS_DEPENDENCY_PATH)/freetype2 -I$(WEBOTS_DEPENDENCY_PATH)/assimp/include
3131
else ifeq ($(OSTYPE),linux)
3232
INCLUDE += -I/usr/include/freetype2 -I$(WEBOTS_HOME_PATH)/include/libassimp/include
33+
ifeq ($(OSDIST), fedora)
34+
INCLUDE += -idirafter/usr/include
35+
endif
3336
else ifeq ($(OSTYPE),windows)
3437
INCLUDE += -I/mingw64/include/freetype2 -I/mingw64/include -I$(WEBOTS_DEPENDENCY_PATH)
3538
endif

0 commit comments

Comments
 (0)