Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linux build script #1525

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions scripts/build/opensim-gui-linux-build-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,27 @@ echo

# Install dependencies from package manager.
echo "LOG: INSTALLING DEPENDENCIES..."
sudo apt-get update && sudo apt-get install --yes build-essential cmake autotools-dev autoconf pkg-config automake libopenblas-dev liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3 python3-dev python3-numpy python3-setuptools libpcre3 libpcre3-dev libpcre2-dev byacc git gfortran libtool libssl-dev libffi-dev ninja-build patchelf || ( echo "Installation of dependencies using apt-get failed." && exit )
sudo apt-get update && sudo apt-get install --yes build-essential cmake autotools-dev autoconf pkg-config automake libopenblas-dev liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3 python3-dev python3-numpy python3-setuptools git libssl-dev libpcre3 libpcre3-dev libpcre2-dev libtool gfortran ninja-build patchelf libffi-dev byacc || ( echo "Installation of dependencies using apt-get failed." && exit )
echo

# If byacc available, install it (issue #3578)
if apt-cache show byacc &> /dev/null; then
echo "byacc is available. Installing..."
sudo apt-get update
sudo apt-get install -y byacc
else
echo "byacc is not available for installation."
fi

# Check if 'bison' is available for install (issue #3578)
if apt-cache show bison &> /dev/null; then
echo "bison is available. Installing..."
sudo apt-get update
sudo apt-get install -y bison
else
echo "bison is not available for installation."
fi

# Debian does not have openjdk-8-jdk available, so install from temurin repo.
echo "LOG: INSTALLING JDK 8..."
if [[ $OS_NAME == *"Debian"* ]]; then
Expand Down Expand Up @@ -118,7 +136,7 @@ cmake_minor_less=$(( ${cmake_version_split[1]} < ${min_cmake_version_split[1]} )
if [[ $cmake_major_less == 1 ]] || $( [[ $cmake_major_equal == 1 ]] && [[ $cmake_minor_less == 1 ]] ); then
mkdir ~/opensim-workspace/cmake-3.23.3-source || true
cd ~/opensim-workspace/cmake-3.23.3-source
wget -nc -q --show-progress https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3.tar.gz
wget -nc -q --show-progress https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3.tar.gz
tar -zxvf cmake-3.23.3.tar.gz
cd ~/opensim-workspace/cmake-3.23.3-source/cmake-3.23.3
./bootstrap
Expand Down Expand Up @@ -159,7 +177,7 @@ mkdir -p ~/opensim-workspace/swig-source || true && cd ~/opensim-workspace/swig-
wget -nc -q --show-progress https://github.com/swig/swig/archive/refs/tags/v4.1.1.tar.gz
tar xzf v4.1.1.tar.gz && cd swig-4.1.1
sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache
make && make -j$NUM_JOBS install
make && make -j$NUM_JOBS install
echo

# Download and install NetBeans 12.3.
Expand Down Expand Up @@ -190,10 +208,24 @@ echo
echo "LOG: BUILDING OPENSIM-CORE..."
mkdir -p ~/opensim-workspace/opensim-core-build || true
cd ~/opensim-workspace/opensim-core-build
cmake ~/opensim-workspace/opensim-core-source -G"$GENERATOR" -DOPENSIM_DEPENDENCIES_DIR=~/opensim-workspace/opensim-core-dependencies-install/ -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=~/opensim-core -DOPENSIM_INSTALL_UNIX_FHS=off -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig
cmake ~/opensim-workspace/opensim-core-source -G"$GENERATOR" -DOPENSIM_DEPENDENCIES_DIR=~/opensim-workspace/opensim-core-dependencies-install/ -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=~/opensim-core -DOPENSIM_INSTALL_UNIX_FHS=off -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig -DOPENSIM_WITH_CASADI=$MOCO -DOPENSIM_WITH_TROPTER=$MOCO
cmake . -LAH
cmake --build . --config $DEBUG_TYPE -j$NUM_JOBS
echo

# Test opensim-core.
echo "LOG: TESTING OPENSIM-CORE..."
cd ~/opensim-workspace/opensim-core-build
# TODO: Temporary for python to find Simbody libraries.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim-workspace/opensim-core-dependencies-install/simbody/lib
ctest --parallel $NUM_JOBS --output-on-failure

# Install opensim-core.
echo "LOG: INSTALL OPENSIM-CORE..."
cd ~/opensim-workspace/opensim-core-build
cmake --install .
echo 'export PATH=~/opensim-core/bin:$PATH' >> ~/.bashrc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend invoking the opensim install script instead.

Copy link
Author

@ksomml ksomml Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opensim-core was always installed in the GUI script before, I just updated it to the latest changes from the opensim-core linux build script. All latest changes in lines are essentially just copied over.
Or did you mean that specific line marked in your post?

If it would be up to me, I would suggest the improvements mentioned above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm actually I'm not sure that whole block (lines 223-229) is necessary. The opensim-core build outputs are copied/installed with the OpenSim GUI by default, and the bash script at

calls the ./opensim-install-command-line.sh script that installs a link to opensim-cmd in /usr/local/bin. I think as it stands, this build/install script is double installing opensim-core (one copy at the default install prefix, and another copy within the opensim GUI directory).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be the case. I haven't had a look into that INSTALL script yet and won't be able to until Friday. Generally I hope this PR could be used to get some attention on the overdue refactor of the linux build scripts.

source ~/.bashrc
echo

# Get opensim-gui.
Expand All @@ -217,4 +249,4 @@ echo
echo "LOG: INSTALLING OPENSIM-GUI..."
cd ~/opensim-workspace/opensim-gui-source/Gui/opensim/dist/installer/opensim
bash INSTALL
echo
echo