Skip to content

Instantly share code, notes, and snippets.

@ymelois
Created December 6, 2022 18:37
Show Gist options
  • Select an option

  • Save ymelois/15fdb4aac40f720122fd51c0443937eb to your computer and use it in GitHub Desktop.

Select an option

Save ymelois/15fdb4aac40f720122fd51c0443937eb to your computer and use it in GitHub Desktop.
Install STM32 CubeIDE on Fedora 37
#!/bin/bash
# This script is used to install the STM32CubeIDE on Fedora 37 which does not have
# ncurse 5 libraries. The script installs the libraries and then runs the installer.
#
# Before running this script, download the rpm_bundle installer from the ST website
# and either extract it to the current directory or go to the directory where it the
# installer is located.
#
# This script needs to in the same directory as the rpm_bundle installer.
function ncurses5Install() {
if [ -f /usr/local/lib/libncurses.so.5 ] && [ -f /usr/local/lib/libtinfo.so.5 ]; then
return
fi
wget "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz"
tar -xvf ncurses-6.3.tar.gz
cd ncurses-6.3
# args taken from `https://src.fedoraproject.org/rpms/ncurses/blob/f36/f/STAGE2-ncurses`
./configure --prefix=/usr/local \
--with-shared --without-ada --with-ospeed=unsigned \
--with-terminfo-dirs=/etc/terminfo:/usr/share/terminfo \
--enable-hard-tabs --enable-xmc-glitch --enable-colorfgbg \
--enable-overwrite \
--enable-pc-files \
--disable-wattr-macros \
--with-termlib=tinfo \
--with-chtype=long \
--with-ticlib \
--with-abi-version=5 # ABI version 5 produces `libncurses.so.5`
make
sudo make install
# cleanup
cd ..
rm -rf ncurses-6.3
rm ncurses-6.3.tar.gz
# link libncurses.so.5 to /usr/lib
sudo ln /usr/local/lib/libncurses.so.5 /usr/lib/libncurses.so.5
sudo ln /usr/local/lib/libncurses.so.5.9 /usr/lib/libncurses.so.5.9
# link libtinfo.so.5 to /usr/lib
sudo ln /usr/local/lib/libtinfo.so.5 /usr/lib/libtinfo.so.5
sudo ln /usr/local/lib/libtinfo.so.5.9 /usr/lib/libtinfo.so.5.9
# reload ldconfig
sudo ldconfig
}
mkdir stm32cubeide
# extract the script compacted by Makeself in the directory
sh st-stm32cubeide_1.11.0_13638_20221122_1308_amd64.rpm_bundle.sh --tar xf --directory=stm32cubeide
cd stm32cubeide
# install ncurses5
ncurses5Install
# replace yum install with rpm to avoid dependency check for st-stm32cubeide rpm package
sed -i 's/yum -y install .\/$pkg || yum -y update .\/$pkg|| return 1/rpm -Uhv $pkg --nodeps || true/g' setup.sh
# remove cleanup from setup.sh to avoid deleting the extracted files
# sed -i 's/$thisdir\/cleanup.sh//g' setup.sh
# run setup.sh
sudo ./setup.sh
@ymelois
Copy link
Copy Markdown
Author

ymelois commented Dec 6, 2022

Got the ncurses5Install part from flxzt comment in this post on community.st.com which works like a workaround at the moment.

@ymelois
Copy link
Copy Markdown
Author

ymelois commented Dec 6, 2022

Note:
Only tested for CubeIDE version 1.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment