From djelinski1 at gmail.com Thu Dec 30 21:35:14 2021 From: djelinski1 at gmail.com (=?UTF-8?Q?Daniel_Jeli=C5=84ski?=) Date: Thu, 30 Dec 2021 22:35:14 +0100 Subject: Windows IDE for native code Message-ID: Hi all, I'm trying to set up an IDE for native code development under Windows. I started with https://github.com/openjdk/jdk/blob/master/doc/ide.md, and got mixed results; I thought I'd share them here. I'm running a Windows 11 + Cygwin + VS 2019 community edition. I'm experimenting with enabling W4 compiler warnings, and I'd like to be able to navigate to them in the IDE. First I attempted to create VS config using the documented command `make ide-project`. This failed fast, complaining that `ide-project` is not a known target. Quick search revealed that we only have a `hotspot-ide-project` target, which kind of works. The generated project can be imported in VS, but can not be built. In order to build the project from VS I needed to make 2 more changes: - add c:\cygwin64\bin to PATH - edit the path to `make` in the vcxproj file; it was c:\cygwin64\usr\bin\make, and no such file exists. Our fixpath script maps /usr/bin to c:\cygwin64\usr\bin, which is incorrect; cygpath correctly maps it to c:\cygwin64\bin. After these changes I was able to compile the project and inspect warnings (both compiler and IntelliSense), which is what I wanted. Unfortunately, this only covers hotspot itself, and modules (like java.base) are left out. The code to generate VS project files looks pretty complex, so I decided that instead of trying to make it work with java.base I'd try VSCode first. The recommended `make vscode-project` command worked fine; it emitted a few `/usr/bin/bash: -c: line 0: syntax error near unexpected token `('` messages, but in the end the necessary project file was created. My first attempt to open it in VSCode resulted in an error: backslashes were not escaped in the generated JSON files. After I added the necessary escapes to `CreateVSCodeProject.gmk` and regenerated the project, I could open it in VSCode. The project was still not buildable because the path to make was incorrect again. I fixed it manually in the generated `tasks.json` file. VSCode build was unable to find some of the Cygwin tools - the build output contained lines like `make: rm: No such file or directory`. Adding Cygwin's bin directory to the system path did not help this time. The errors were not fatal, and the IDE was still able to compile and run Java. This was my first contact with VSCode, so I may be doing something wrong, but I couldn't find IntelliSense warnings anywhere. Compilation warnings were only found in the Terminal window and not in Problems. I'd be very interested in your thoughts on how I could put the IDEs to better use. Also, I can create a PR with my changes to the JSON generator if you're interested. Thanks, Daniel