gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.17k stars 477 forks source link

Gazebo on Windows: vcpkg installation #3202

Open j-rivero opened 2 years ago

j-rivero commented 2 years ago

The vcpkg project has available a port for Gazebo11. The Goal of the ticket is to evaluate if this installation is stable enough to go into our documentation.

Help wanted: We are interested in knowing if our users on Windows can install and use it without problems. If you want to help, please follow vcpkg instructions to bootstrap vcpkg, try to compile Gazebo and try to run a basic simulation on it. Please comment in the issue with details about Windows version, problems/not-problems found, graphic card drivers installed and other information you find useful. You are also welcome to comment and help with other people's problem.

Windows specific: check https://github.com/osrf/gazebo/issues/2901 for the list of configurations, problems or issues on Windows.

j-rivero commented 2 years ago

First of all, thanks so much @Ace314159 for the work done to bring Gazebo to vcpkg. Really cool work.

I was able to use my Windows10 to install the Gazebo port without problems in the compilation of all the dependencies and gazebo itself (well, limiting the compilation threads for Gazebo using VCPKG_MAX_CONCURRENCY variable).

Playing with vcpkg directories (buildtress, installed and packages) I was wondering, what is the way of invoking Gazebo? Are there some instructions about how to run it?

Thanks!

Ace314159 commented 2 years ago

@j-rivero I'm glad you were able to build successfully with that minor tweak!

The buildtrees folder has intermediates used while building and can be deleted. Both the packages and installed folder contain the same files, just organized differently. Due to how vcpkg builds are done, by default gazebo loads the built-in models from the packages folder, so both the installed and packages folders are recommended to keep.

In order to run gazebo, you need to set the HOME environment variable to your users directory (i.e. C:\Users\{name}). Then, you can just double click the gazebo executable in the installed/x64-windows/tools/gazebo folder.

You can also run the the executable through cmd or Powershell (with the HOME environment variable set), but I have noticed that using ctrl+c to kill it sometimes doesn't kill the gzclient and gzserver child processes. I have made https://github.com/osrf/gazebo/pull/3167 to attempt to fix this, and it seems to work for me.

traversaro commented 1 year ago

I am not sure, but I think that https://github.com/microsoft/vcpkg/pull/27107 broke gazebo on vcpkg, at least when using the default version of the libraries at it bumped ogre from 1.12.9 to 13.4.4 .

Indeed, I was quite curious about why the vcpkg CI did not catched the gazebo failure, and it seems that gazebo was skipped in CI as apparently VS 2022 Update 3 broke its compilation (see https://github.com/microsoft/vcpkg/pull/26283#issuecomment-1218636710) and so it was removed from the CI.

talregev commented 1 year ago

I already did a PR that try to solve the cmake issue there. Also I revive it recently. I can make a PR again, and help will apricate. Now day vcpkg support ogre 13.6.2 that was break the api of the previous one. Can you help me patch gazebo that it will compile with the new ogre?

If some one is want to help, please comment here, and I will share a link for the new attempt to compile gazebo in vcpkg.

traversaro commented 1 year ago

Can you help me patch gazebo that it will compile with the new ogre?

There is a relaed issue in https://github.com/gazebosim/gazebo-classic/issues/2700, unfortunatly I am afraid it will not be trivial.

talregev commented 1 year ago

@traversaro I try to compile gazebo with the new ogre lib. But gazebo using private headers that vcpkg don't export. I discuss it here https://github.com/OGRECave/ogre/issues/2813 https://github.com/microsoft/vcpkg/issues/30376

Anybody can help me?

talregev commented 1 year ago

I made a PR of gazebo in here. It still not fully compile, but It start to build. It need patch gazebo to fit the new ogre that vcpkg is using. https://github.com/microsoft/vcpkg/pull/30424

If you can help, please common on the vcpkg PR. Thank you.

talregev commented 1 year ago

I was able to compile Gazebo on windows with my fix PR with ogre 1.12.9 and qwt 6.1.5 and graphviz 2.49.1. Please before your compile MAKE SURE your visual studio is the latest update. It have an atomic error bug in the middle versions. Also I did this for overcome the bug. Not sure if that help: For compile on windows I did this for atomic error I had: https://stackoverflow.com/questions/67732065/why-does-vs2019-pro-have-compile-errors-with-xutility-xmemory-and-atomic-when

For compiling:

git clone https://github.com/talregev/vcpkg -b TalR/fix_gazebo2
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install  --x-manifest-root=ports/gazebo/ --x-install-root=installed --triplet=x64-windows-release --host-triplet=x64-windows-release --clean-after-build
vcpkg install gazebo[tools,plugins] --triplet=x64-windows-release --host-triplet=x64-windows-release

This compile gazebo but I didn't succeeded to run it. Can you help me to understand how to run it? I also can compile gazebo with ogre 1.11.x if needed. Write me on the comment, and I will make one.

Also vcpkg tool can help you to compile your 3rd libraries for windows and linux. Maybe for mac with extra work.

talregev commented 1 year ago

I made a PR that compile gazebo in windows. https://github.com/gazebosim/gazebo-classic/pull/3312