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

Building on Windows #52

Open
scottcandy34 opened this issue Feb 9, 2024 · 0 comments
Open

Building on Windows #52

scottcandy34 opened this issue Feb 9, 2024 · 0 comments

Comments

@scottcandy34
Copy link

scottcandy34 commented Feb 9, 2024

So I am simply trying out RoboStack on windows 10; to see if I can use ROS on windows effectively. So far building packages irobot_create_msgs and all packages of create3_examples except for create3_coverage builds without errors. I installed ros2 humble using RoboStack and it works great so far.

The first error is this:

C:\***\irobot_create\src\create3_examples\create3_coverage\src\coverage_state_machine.cpp(214,48): error C2065: 'M_PI': undeclared identifier [C:\***\irobot_create\build\create3_coverage\create3_coverage_core.vcxproj]
C:\***\irobot_create\src\create3_examples\create3_coverage\src\coverage_state_machine.cpp(214,55): error C2065: 'M_PI': undeclared identifier [C:\***\irobot_create\build\create3_coverage\create3_coverage_core.vcxproj]

Which after doing my research is a common windows building issue and is fixable by adding #define _USE_MATH_DEFINES to the top of the file coverage_state_machine.cpp this tells windows cmake that M_PI is defined and not undeclared.

after that is fixed a second error appears:

create3_coverage_core.vcxproj -> C:\***\irobot_create\build\create3_coverage\Release\create3_coverage_core.dll
  Building Custom Rule C:/***/irobot_create/src/create3_examples/create3_coverage/CMakeLists.txt
  main.cpp
LINK : fatal error LNK1181: cannot open input file 'Release\create3_coverage_core.lib' [C:\***\irobot_create\build\create3_coverage\create3_coverage.vcxproj]

This is another very specific building bug. It builds the .dll file just fine but is missing the .lib file which causes this error when it tries to run target_link_libraries(). After endless digging to fine the problem. I added this line (set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)) above the add_library. Once added it builds without errors.

I verify it works by running call install\local_setup.bat in the CMD window for the project directory. Then run this command ros2 run create3_coverage create3_coverage from the readme.

(ros_env) C:\***\irobot_create>ros2 run create3_coverage create3_coverage
[INFO] [1707502413.216754600] [create3_coverage]: Node created!

So it works lol. The point I'm getting at is could you review this 2 changes and possibly add them to the codebase so for those that might wish to run on windows will not have issues building. Of course if necessary add checks so they only get added for windows builds.

I built using this colcon build --cmake-args -DPython3_FIND_VIRTUALENV="ONLY" this forces it to use the specific python from the RoboStack; which is very important.

So far so good I'll be able to control the BOT from windows without much problems now.

@scottcandy34 scottcandy34 changed the title Building on windows Building on Windows Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant