I tried to find an IDE to code on Rock Pi 4. My first 2 choices are Atom and Sublime, unfortunately none of them supports ARM/ARM64. Fortunately, Visual Studio, which I use on a daily basis, is capable to do it – remotely from Windows PC. It took me hours to make it work, I’m posting my experiences here so you don’t have to repeat my mistakes.
Microsoft Visual Studio Community Edition is free, and has all the features I need so far. When you install it, check Workloads/Linux development with C++, plus Optional Cmake and Linus.
My first 2 bummers are on the Rock Pi 4 side:
- openssh-server doesn’t work on Rock Pi ARM64 build (following the official instructions) out of the box, you need to purge then reinstall it.
- sudo apt-get install rsync
Now, on Windows side, create a Raspberry Pi project, connect to your Rock Pi 4. The sample code needs wiringPi so it won’t work, clean up the code and write something else, like the code in my screenshot, and set architecture to ARM64 (in case you are running Debian ARM64 or Ubuntu). I didn’t do this on the armhf build.
Now the 3rd bummer, IntelliSense reports errors on everything (if the architecture was set to ARM it’s fine), because you don’t have the ARM64 headers on your Windows PC. Go to Tools->Options->Cross Platform -> Connection Manager -> Remote Headers IntelliSense Manager, update the headers from your connection, all the errors should go away.
I had another issue at this point, Visual Studio pops up some “tty” error, and turned out to be the tmux running in my ssh session. Remove it the error is gone - and yes you can’t start tmux automatically if you wan’t to use Visual Studio.
The code compiled, I can set break points and everything. There is a compiler waning like “implicit declaration of function ‘…’ something”, add “#define _GNU_SOURCE” at top of your code will clear it up.
The next thing, after I included the new libmraa and make a call to mraa_init(), the linker compliants “undefined reference to ‘mraa_init’”, WTH? because the linker is looking for mraa.so but there is only libmraa.so. You need go to the Project Configuration Properties -> Linker->Command Line, add “-lmraa” as additional option, the link will find it. (Is there a better way anyone?)
If you are running Debian ARM64 on your Pi like me, you are out of luck. It doesn’t have libjsonc, which you could install it using apt-get, but then you are missing glibc 2.27, I haven’t fixed this yet, but the errors are synced up with the mraa executable on your Pi - it’s broken too.
Try it out, have fun!