Monthly Archives: November 2016

Using Eclipse CDT with MSYS2

MSYS2 is a relatively new distribution to support the MinGW compiler on Windows. It’s actually grown beyond that and has a pretty rich set of packages that include CMake, clang and gcc, and a huge set of libraries including Qt and SDL. It’s kept reasonably up-to-date and I’m sure if we can grow the community even more, we could get things even faster (e.g. Qt is one minor release behind).

On Windows, the CDT loves MinGW and MSYS. As Eclipse is a native application, it really expects things like path names and such to be native Windows things. Cygwin, being a Linux emulation layer, and the recent Bash for Windows are actually hard for CDT to integrate with because they hide away the native.

For Eclipse Neon, CDT has added support for automatically detecting the MinGW compilers in an MSYS2 installation. This article will give a quick guide on how to set up MSYS2 with the proper set of packages to start building C++ projects on Windows.

First a quick rant about their choice of package manager, pacman. I’m sure people who use Arch Linux love pacman. It’s pretty powerful. But I worry that it’s a tough fit for Windows users. The problem gets worse as there are actually three sets of packages, msys (common), mingw32 (for 32-bit tools), and mingw64 (for 64-bit tools) and some packages are in multiple of those. pacman makes you pick each time you install a package. And it gets worse installing the toolchain since mingw32 and mingw64 each have toolchains that target 32-bit and 64-bit. Now you’re up to five combinations.

But it’s what we got so we’ll have to make due. Hopefully we can simplify this a bit.

First, most people are on 64-bit Windows these days and for that, just select the mingw64 packages and the x86_64 toolchains. If you are on 32-bit Windows, go mingw32 and i686 toolchain. If you are targeting both 32 and 64 bit, simply add the other toolchain. But also make sure you add all the libraries for that architecture too.

MSYS2 starts with a pretty decent installer. It’s available from https://msys2.github.io/. The instructions on that page are a good description on how to do the initial setup. After finishing that, you still have no toolchains or libraries. To set up your development environment, run the following command. This gives you gcc and make, enough to build a hello world project.

pacman -S make mingw64/mingw-w64-x86_64-gcc

A couple of quick notes on that. The toolchain comes from the mingw-w64 project which produces both 32-bit and 64-bit compilers. Confusing? Yes. Also, pick the make from the default package set since it’s a more full featured make than the mingw32-make that comes with the mingw64 package set.

That should be enough to get started. Feel free to poke around and add library packages you’d like to use. Qt projects should just work with CDT’s new (and still very young) Qt plug-ins.

More later as we figure out the right configuration for CMake and for other libraries.

EclipseCon Europe 2016 So Glad to be Back

I spent a good chunk of the week trying to figure out the last time I was at EclipseCon Europe. The last thing I remember was spending a night in the Nestor bar until 5 a.m. with a handful of attendees, including Torkild, with the honored presence of Dave Thomas, the spiritual founder of Eclipse. That was 2008! It’s been eight years! I’ve missed so much. But I’m so glad that things in my life have cleared up to enable me to attend and I don’t expect I’ll miss another one for a while.

My biggest take away from the conference is simply the diversity of the people interested in Eclipse and the diversity of things happening at Eclipse. There’s still a large chunk of it related to the RCP platform and the IDE we build on top of it. But there’s really cool things happening with the Science and IoT groups as well. And the OSGi lego train display was mesmerizing but really showed off OSGi’s roots in the industrial space.

The week started with the CDT Summit on Monday. We had a good representation from different companies who build tools based on the CDT. We had a mini demo camp where they had the opportunity to show off what they’re doing. There’s some really cool stuff happening. It’s great to see them trying to make the complex world of embedded development simpler to understand through some great visualizations. We also noticed a couple of areas where the different vendors are building the same functionality. Those are great opportunities to collaborate in the open and the CDT project is very welcoming to new things. Finally it was very interesting to see how all the vendors really rely on our managed build GUI to simplify compiler and other build settings for users. That’s something we’ll need to carry forward into the new Core Build system (which I still need to blog about, stay tuned for that).

On Tuesday, I had my talk where I showed off Eclipse for embedded. It’s really a showcase of all the hard work we’ve done to simplify CDT for embedded development and to support open frameworks that users are using today, including Arduino, Qt, CMake, ESP8266, etc. It also shows why Eclipse is so important to us in the embedded world. IoT is a marketing buzzword, but it’s also an architecture that many of us have used in the past and which is growing thanks to accessible cloud platforms. These days, you need to program both your Arduino and your cloud service and Eclipse lets you do those things with a single IDE.

The rest of the week was spent chatting with my open source collegues, building relationships, getting a feel for the current state of the Eclipse IDE and where we need to go in the future. The Visual Studio Code keynote from Dirk Baeumer we very eye opening. I’ve been studying VS.Code for a few months trying to get a sense of what it’s appeal is and whether a desktop IDE based on a Web frontend is the new modern way of building IDEs. Now VS.Code isn’t an IDE, or at least it’s not as much an IDE as the Eclipse IDE is. We have a lot of tools that render different sorts of data visually in Eclipse and those high value things need to carry forward in any new world. But it’s food for thought and I’m going to invest some time to see what can be done there.

As Mike loves to say in his keynotes, Eclipse is many things. I think first and foremost, it’s a community. Technologies come and go, and individual people come and go, but there always seems to be a great energy when we come together. The task for us is to carry that energy forward into our day-to-day work and keep momentum going on all the great things we talked about. It’s not easy, but it’s why we need to be there.