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

MSBuild not supported? #134

Open
jporcher opened this issue Oct 25, 2023 · 3 comments
Open

MSBuild not supported? #134

jporcher opened this issue Oct 25, 2023 · 3 comments

Comments

@jporcher
Copy link

I'm trying to run colcon build with MSBuild command line tools (free) rather than Visual Studio (licenced). I'm trying to compile ROS2/Humble.

I could force this compiler to be used by adding --cmake-args "-GNMake Makefiles" -DCMAKE_BUILD_TYPE=Release, however, I encounter issues mainly because colcon code checks if 'Visual Studio' in generator: and if false code considers we are using MAkefile generator, while here it's NMake, which should be treated as 'Visual Studio'.

Is it intended that MSBuild is not supported? Why do we need the whole Visual Studio IDE to compile a project?

@traversaro
Copy link

Which specific issues are encountering? Did you try to use Ninja instead of NMake Makefiles?
Furthermore, note that it should be perfectly fine to use msbuild to build the .sln files generated by the Visual Studio CMake generators.

@jporcher
Copy link
Author

I did not try Ninja.

When I set "-GNMake Makefiles" -DCMAKE_BUILD_TYPE=Release, the error I get is NMAKE : fatal error U1065: option 'j' non valide
I suspect it's because of some tests like if 'Visual Studio' in generator: in site-packages\colcon_cmake\task\cmake\build.py. _get_make_arguments ends up adding -j20 to build parameters, while this is not a valid NMake parameter.

Furthermore, note that it should be perfectly fine to use msbuild to build the .sln files generated by the Visual Studio CMake generators.
But CMake is unable to generate .sln files using Visual Studio generator if Visual Studio is not installed. It reports "Generator Visual Studio 17 2022 could not find any instance of Visual Studio." Even if I sourced MSBuild environment before running colcon build.

@cottsay cottsay transferred this issue from colcon/colcon-core Nov 30, 2023
@AndreasGronlund
Copy link

AndreasGronlund commented Oct 4, 2024

Any news on this matter? Usually flutter will make colcon find Visual Studio but not this time. Is stuck and cannot understand why. Have two almost identical setups, one works but not the other. If I manually compile the node with CMake it works but not when using colcon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants