opensim-org / opensim-gui

SimTK OpenSim graphical user interface and distribution.
Apache License 2.0
65 stars 35 forks source link

Build Script Issues [Linux] #1522

Open alexbeattie42 opened 1 month ago

alexbeattie42 commented 1 month ago

Problem

There are a couple of problems with the Linux build script for the GUI that create friction for newcomers to the project.

  1. The script reinstall Netbeans 12.3 and SWIG every time it is run
  2. The script uses 4 processor cores instead of defaulting to the number of cores available on the system
  3. You cannot choose an alternative directory for ~/opensim-workspace to create multiple build environments
  4. The install step of opensim-core installs to ~/opensim-core which is then used by the GUI build. If you build a different/incompatible version of the core, the install step in cmake DOES NOT clean the install folder so that the stale SWIG bindings remain, which then causes the GUI build to fail.

Steps to reproduce

To reproduce step 4 you can checkout a branch from opensim-core that is incompatible with the GUI, run the script (the build will fail), then checkout main again for opensim-core and the build will still fail.

It is also notable that these types of problems will not happen on CI because when the CI pipeline runs it should have a clean filesystem in which there are no stale installs or states.

Expected result

When using current versions of main for opensim-core and opensim-gui the build should pass

Actual result

The build fails

Proposed Changes

I am happy to make changes to the build script to address these problems if it would be beneficial. My proposal to address the problems is:

  1. Check to see if the correct SWIG and Netbeans versions is already installed before attempting to install it again
  2. Default the number of processors to the value returned by nproc --all on Linux
  3. Parameterize (as a variable and flag) the value for opensim-workspace
  4. Introduce a clean flag to the script that will clear everything and rebuild. Additionally add a "clean prior to install" step if the gui build will rely on the installed version of opensim-core during the GUI build. Another option would be to use the built version of the core within the workspace instead of the "installed version"

Environment and GUI version

aymanhab commented 1 month ago

All these are good additions to make the build script more robust. 👍 Please feel free to submit PRs.
While these scripts were provided to help users build the GUI, we don't use them to build on regular basis and ci starts from a fresh environment anyways and that may explain why these didn't come up earlier but thanks for the find and the offer. Looking forward to your contributions.