Skip to content

Standalone gz sim executable (Jetty) #2849

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

j-rivero
Copy link
Contributor

@j-rivero j-rivero commented Apr 10, 2025

🎉 New feature

Comes from #2809. Related to gazebosim/gz-tools#7 and #2737.

Summary

This PR introduces a standalone executable for gz sim by following a similar approach to #2724. The new executable is integrated into cmdsim.rb.in, replacing the existing functionality. It is also a step in the direction of decoupling the server from GUI components, allowing us to build gz-sim library without GUI support.

#2809 should give a full context of the work. This PR changes the target branch name to main not to include the work in Ionic but in the upcoming Jetty.

To port #2809 here I made the following commits:

  • 39573e7 is the result of applying the diff from Standalone gz sim executable #2809 almost cleanly
  • 39296e8 adapt the changes to use the unversioned gz-sim Remove major version from package name #2726
  • 31bd100 renamed the executable gz-sim-gui since this new executable in this branch conflicts with the gui component at src/gui in this repository. In the gz-sim9 branch it is known as gz-sim9-gui but now that we are not using version numbers generates a conflict. I choosed gz-sim-gui-client but we can use a better name.

Include here the list of things broken or for testing:

  • Manual testing in Mac [blocker]
  • Initial world selection screen in Windows do not work properly [non-merge-blocker]
  • gz-sim-gui-client displays the world initial selection screen [non-merge-blocker]
  • gz-sim-gui-client input parameters referenced SDF files [non-merge-blocker]
  • Parameters are duplicated between gz-sim-gui-client / gz-sim-main [non-merge-blocker]
  • [updated] Version arguments -v 4 to gz-sim-gui-client says it is not expected.

Signed-off-by: Jose Luis Rivero <[email protected]>
…he gui unversioned component

Signed-off-by: Jose Luis Rivero <[email protected]>
@j-rivero
Copy link
Contributor Author

@osrf-jenkins run tests

@j-rivero
Copy link
Contributor Author

@osrf-jenkins run tests

Signed-off-by: Jose Luis Rivero <[email protected]>
Signed-off-by: Jose Luis Rivero <[email protected]>
@j-rivero
Copy link
Contributor Author

The gz command tests are failing. Need to fix these before merging.
There is a failure in the Mac version also in the command test:

135: [ 50%] Linking CXX executable command_TEST
135: dyld[34618]: Symbol not found: __ZN2gz3sim3v1010components7Factory8InstanceEv
135:   Referenced from: <04E4F5FD-583F-3D32-8098-6E46F747E67F> /private/var/folders/ng/v8gtqrqs1sj3dzz5pvh558mh0000gp/T/gz/temp_dirdaDezq/command_TEST
135:   Expected in:     <no uuid> unknown
135: CMake Error at /usr/local/share/cmake/Modules/GoogleTestAddTests.cmake:132 (message):
135:   Error running test executable.
135: 
135:     Path: '/private/var/folders/ng/v8gtqrqs1sj3dzz5pvh558mh0000gp/T/gz/temp_dirdaDezq/command_TEST'
135:     Working directory: '/private/var/folders/ng/v8gtqrqs1sj3dzz5pvh558mh0000gp/T/gz/temp_dirdaDezq'
135:     Result: Subprocess aborted
135:     Output:
135:       
135: 
135: Call Stack (most recent call first):
135:   /usr/local/share/cmake/Modules/GoogleTestAddTests.cmake:275 (gtest_discover_tests_impl)
135: 
135: 
135: make[3]: *** [command_TEST] Error 1
135: make[3]: *** Deleting file `command_TEST'

@scpeters
Copy link
Member

I'm testing this on a Mac laptop. I first built it in a colcon workspace containing only gz-tools2 and this branch of gz-sim, with all the other dependencies built from brew formulae.

  • I'm able to run in server-only mode with install/libexec/gz/sim10/gz-sim-main -v 4 -s
  • I'm getting dyld[37202]: Library not loaded: @rpath/libgz-sim-gui.10.dylib errors when trying to open the gui in a separate terminal with -g. I'm currently debugging by building this branch through the brew formula (by replacing main on this line of gz-sim10.rb with the name of this pull request's branch). I will keep you updated on my progress

@iche033
Copy link
Contributor

iche033 commented Apr 25, 2025

The gz command tests are failing. Need to fix these before merging. There is a failure in the Mac version also in the command test:

135: [ 50%] Linking CXX executable command_TEST
135: dyld[34618]: Symbol not found: __ZN2gz3sim3v1010components7Factory8InstanceEv
135:   Referenced from: <04E4F5FD-583F-3D32-8098-6E46F747E67F> /private/var/folders/ng/v8gtqrqs1sj3dzz5pvh558mh0000gp/T/gz/temp_dirdaDezq/command_TEST
135:   Expected in:     <no uuid> unknown
135: CMake Error at /usr/local/share/cmake/Modules/GoogleTestAddTests.cmake:132 (message):
135:   Error running test executable.
135: 
135:     Path: '/private/var/folders/ng/v8gtqrqs1sj3dzz5pvh558mh0000gp/T/gz/temp_dirdaDezq/command_TEST'
135:     Working directory: '/private/var/folders/ng/v8gtqrqs1sj3dzz5pvh558mh0000gp/T/gz/temp_dirdaDezq'
135:     Result: Subprocess aborted
135:     Output:
135:       
135: 
135: Call Stack (most recent call first):
135:   /usr/local/share/cmake/Modules/GoogleTestAddTests.cmake:275 (gtest_discover_tests_impl)
135: 
135: 
135: make[3]: *** [command_TEST] Error 1
135: make[3]: *** Deleting file `command_TEST'

I noticed this homebrew test failure recently and it's also happening in other builds as well, e.g. in #2870. May or may not be related

@iche033
Copy link
Contributor

iche033 commented Apr 25, 2025

  • I'm getting dyld[37202]: Library not loaded: @rpath/libgz-sim-gui.10.dylib errors when trying to open the gui in a separate terminal with -g. I'm currently debugging by building this branch through the brew formula (by replacing main on this line of gz-sim10.rb with the name of this pull request's branch). I will keep you updated on my progress

I get the same error with all gz packages built from source in a colcon workspace.

  • I tried setting DYLD_LIBRARY_PATH and using popen instead of std::system to launch the gui process but the result is the same. Looks like it doesn't launch the exe with the same environment.
  • Note I built the packages with -DCMAKE_MACOSX_RPATH=FALSE
    • here's my otool output:
      otool -L ./install/libexec/gz/sim10/gz-sim-main | grep gz-sim`
      ./install/libexec/gz/sim10/gz-sim-main:
         libgz-sim-gui.10.dylib (compatibility version 10.0.0, current version 10.0.0)
         libgz-sim.10.dylib (compatibility version 10.0.0, current version 10.0.0)
      

Other notes:

  • Running gz-sim-gui-client with an existing server works but it brings up the quick start dialog (the dialog for selecting what world to launch)
  • I couldn't pass the -v 4 arg to gz-sim-gui-client. It says arg was not expected.

@scpeters
Copy link
Member

I'm testing this on a Mac laptop. I first built it in a colcon workspace containing only gz-tools2 and this branch of gz-sim, with all the other dependencies built from brew formulae.

  • I'm able to run in server-only mode with install/libexec/gz/sim10/gz-sim-main -v 4 -s
  • I'm getting dyld[37202]: Library not loaded: @rpath/libgz-sim-gui.10.dylib errors when trying to open the gui in a separate terminal with -g. I'm currently debugging by building this branch through the brew formula (by replacing main on this line of gz-sim10.rb with the name of this pull request's branch). I will keep you updated on my progress

I am able to run gz-sim-main -s and gz-sim-main -g in separate terminals after compiling with brew and adding an additional rpath configuration in osrf/homebrew-simulation#3025 (and changing the target branch from main to this branch). Out of curiosity, I tried launching gz-sim-main without -s or -g to see if it could launch both server and gui at the same time, but it didn't work in my limited testing. This didn't work before either, but I was just curious to see if it was fixed

@j-rivero
Copy link
Contributor Author

Thanks for the test !

  • Running gz-sim-gui-client with an existing server works but it brings up the quick start dialog (the dialog for selecting what world to launch)

I think we already captured this problem in the description.

* I couldn't pass the `-v 4` arg to `gz-sim-gui-client`. It says arg was not expected.

Oh this is new, to be fixed IMHO without being a blocker for the PR.

I tried launching gz-sim-main without -s or -g to see if it could launch both server and gui at the same time, but it didn't work in my limited testing. This didn't work before either, but I was just curious to see if it was fixed

Iit works on Linux and Windows as far as I can tell. Seems like we will need more work on Mac. Not a blocker since we are not introducing a regression.

@traversaro traversaro mentioned this pull request Apr 26, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪵 jetty Gazebo Jetty
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

3 participants