How to include CMake compatible with Cygwin on CLion on Windows? - windows

I'm trying to configure CLion with Cygwin, but I'm having trouble with CMake. The program says that the bundled version doesn't work in that environment and that the CMake from Cygwin is outdated (needs a newer version). However, I tried installing an independant CMake but then the program says it isn't compatible with Cygwin. How do I fix this?
screenshot

I'm teaching a C++ programming class this semester. All of my students were able to successfully install/configure CLion without too much trouble. Most of them are on Windows boxes, Win7 and Win10.
In my instructions, I referred them to this video, which was the best I could find: https://www.youtube.com/watch?v=i2h_976SpV0
Some of the students were missing the debugger the first time they tried this. In the cygwin installer, the number of check boxes is enormous and many of the names are remarkably similar. When we went back through and re-ran the installer, in each case we were able to find a place where they had checked the wrong box.
So my recommendation would be re-run your cygwin installation after watching the video once through. Then go back to the frame in the video where he shows all his checked install options and very carefully compare your checked boxes against the presenter's.
Good luck!

Related

How to upgrade gcc compiler

I have gcc 6.3.0 and to run tensorflow 2.11.0 along with cuda 11.2, I require gcc version 9.3.1, but I just cannot find a simple and straightforward way to do that. Some people say install mysys, other sites point to sourceforge download link, while download links on mingw site point to github repos, I just don't understand how to upgrade this thing. It would be really helpful if someone could explain it like you are explaining it to complete newbie, step by step.
Last time, I downloaded mysys2 because someone told that it will automatically upgrade gcc to latest version, mysys2 came with a python 3.10, and I was working with python 3.9, and it created a lot of issues, later I had to reset my pc. That's way I just want to know the direct way to upgrade this thing instead of upgrading other software. I also tried by downloading mingw, but the installer available on sourceforge gives gcc 6.3.0 and not the latest gcc. And what is this cygwin which gives unix like environment, why do i require unix like environment. Even if cygwin can do it easily, I am hesitant to download cygwin, cause i don't want another repeat of tragedy that happened due to mysys2, afterall, installing a complete set of programs that i don't know anything about and will probably never use will only create additional errors.

can compiled perl v5.28.0 from src (with gcc 4.8.5) run on RHEL 5.5?

My question is about whether if it would be possible to run a compiled perl 5.28.0 from source (with GCC 4.8.5 on CentOS 7) to be able to be used on RHEL 5.5 (Tikanga) where GCC version is lower and so would be the other libs like libc, glibc, etc.
Our production environment is running very old perl version (5.8.8) and due to security concerns, it is under heavy lock down, i.e. most of our servers lack make, gcc and related tools and there is no root access available to anyone
I was wondering if it would be possible to compile perl from source i.e. latest 5.28.0 with GCC 4.8.5 AND try to use this compiled version on our production servers (with GCC 4.8.2).
This will save me tonnes of headaches with slow bureaucracy and I can get going with my project with the new tools.
Have not been able to find any discussion or hint about this subject. Can anyone shed some light?
Thank you in advance.
Update after 2 days:
As it seems Perl 5.28 compiled on RHEL7 does not work on RHEL5.5. You will have to compile it on RHEL5.5 and make it relocatable for further usage on any server.
So I Downloaded the RHEL 5.5 and CentOS5.5 ISOs and ran into bootable iso related issues.
Couldn't make a suitable bootable disk for both rhel 5.5 and centos5.5.
rhel5.5 iso was a single dvd image and upon doing file rhel5.5.iso on command prompt, it showed bootable. tried unebootin, rufous iso creator, dd command and created ISOs and tried all of them one by one, but couldn't get it to show boot menu. tried FAT, NTFS FS while making boot disk. Stuck here now.
Centos5.5 iso came in 8 pieces of 600mb files. Had to create a single iso image out of it and found some online procedure to do it and made one ISO file. Got boot menu and looked like it worked. But then it got hung up on doing some sort of source media check test and couldn't proceed further. Found a fix related article that you imprint md5sum on iso and it should work but it didn't.
Just now found something on grokbase and it mentions a new technique, that could take me forward from the point of failure mentioned in point no.3 above.
Edit: static compilation bypasses the problems you are cautious about. You need to figure out whether the result is suitable for your intended purposes.
Otherwise you contend with traditional compilation like you had planned. If the libc is too different, it won't work. You could certainly just go ahead and try, then you'll know for certain.
The real solution is to set up a copy of your production environment (can be in a virtual machine) and compile stuff there.
You could try PerlApp + ActivePerl from ActiveState.com (maybe a part of PDK, Perl Development Kit). I've used it for many years. It compiles perl source and include modules (compiled modules also) into a .exe-program file on Windows and a binary executable file on Linux. There is a payed version and a free/demo version. The payed version allows for cross-compilation and more versions of Perl if I remember correctly.
You might run into trouble with differing versions of glibc/libc on dev vs prod computer, so try to use PerlApp on a CentOS 5.5 Linux (free) for compilation. CentOS5.5 resembles RHEL5.5 enough for most projects. Good luck.
Try perlbrew (is an admin-free perl installation management tool)

Porting Linux project to windows platform with VS2015 using “mussel" library

I could find that vs2015 comes with mussel library which is more like to use POSIX calls. I went through the installation guide provided and through the official link, came to know that I need to run configuration file followed by make.
But the configuration file has not been provided with vs2015.
I request you to let me know the procedure if someone has done this before.
musl doesn't support Windows; from the FAQ page:
What are musl’s dependencies?
Linux 2.6 or later. Earlier versions will suffice for running most simple single-threaded programs, but due to bugs and conformance issues at the kernel level, musl is not offically supported on earlier kernels.
(now, Windows 10 does support running Linux binaries through WSL, but in that case you would be building musl through gcc inside the Linux "container" and it would be another kind of game entirely)
As it comes as VS2015 along with third party license I thought there should be a way to get it done. The folder location is Microsoft Visual Studio 14.0\VC\vcpackages\IntelliSense\iOS\OSS\musl-1.1.10
As said in the comment, from the folder name it seems that it's there just to aid IntelliSense when editing code for iOS targets.

Writing code for a Mac using Lazarus

I have done a little work on lazarus' free pascal. So when a client asked me to write an application for a mac, after the initial, "it can't be done" stage. (followed by an asp.net maybe stage) i thought about writing it using lazarus.
Question is. I have only a virtual machine running mac OSX, this means that i do not really want to develop on the mac. However, i just cannot seem to get the applications that i have written in lazarus on windows to work on the mac. I have tried the deployment using the Lazarus Wiki and the MACOS folder is empty and so when i put it on the mac it doesn't run the application.
What is the best way of doing this or am i barking up the wrong tree?
It seems you want to do cross-compiling, which is theoretically possible, but may not be practical, for the reasons mentioned by Marco above.
As an alternative, you could install XCode, FreePascal, and Lazarus on a MacOX machine. You could still do your development and some testing on Windows/Linux. When you hit a certain milestone, you can copy your source code to the Mac and compile your application to test and give to the user.
Even if it were possible to easily cross-compile, there some minor differences between platforms, so (especially if it's a GUI app), you would want to test it on an actual MacOS box before giving it to the client.
I've taken the route described by Noah - and I was incredibly surprised that after about three weeks development on Windows, it took about 10 minutes to get the application running on the Mac.
My route was to install Xcode 4.3 on an old Mac Mini running snow leopard, then install Lazarus using the fink version as described here. This took a while but was done in an evening.
Then I just copied my folder across to the Mac, opened the lpi on the Mac, compiled it. It failed so I removed a windows references, recompiled, and it was working. I was truly amazed.
What linker and assembler do you use to generate binaries? To my best knowledge the linker for recent OS X versions is not available in source.
Afaik what you want (crosscompiling to Mac) is not possible for recent versions (and I've done it for PowerPC myself in the past).
The easiest is to use the Unix "file" command on the binary to see what is generated, and make sure it reads something with "MachO" in it. Easiest is if you have a Linux install (where this command is pretty standard), but versions can be found for windows too (cygwin, mingw and 3rd party)

Visual C++ Development Targeting Linux

I've been a Visual C++ user for quite some time now, and in the following weeks, I will be joining a (C++) Linux-only project. It should be noted that I have absolutely zero development experience on Linux.
Currently, Visual C++ 9 along with the Visual Assist X add-in make Windows-based development rather enjoyable. Having looked at various C++ IDEs on Linux left me a little disappointed with the coding experience, however.
I'd love to be able to use my current tool set (see above) for Linux development, so I have a couple of questions:
Can the VS editor convert between CR+LF <-> LF in a reliable manner?
Is it possible to set up a system where if I press "Build" in the IDE all of my work gets transferred to another box (e.g., a virtual machine) running Linux that compiles my project?
How would debugging work? Is it possible to remote-debug an application running in Linux via something like gdb? If so, would the "advanced" features of MS's debugger (e.g., tracepoints, break-if-cond, etc.) be lost?
Is this even a sane thing to think of? Does anyone use a Windows environment for Linux development? If not, I guess I should just suck it up and move to a Linux environment all together...?
Any input is appreciated, as I feel a little lost right now.
It's probable you'll eventually want to suck it up and work on Linux. microsoft, for obvious reasons, builds their tools to be very Windows-centric and Windows-specific; there are even a few ways in which Visual C++ isn't quite standard C++.
That said, though, you can work with VC++ to some extent.
There are easy tools on linux that will translate to UNIX line endings from Windows. (called something creative like 'dos2unix')
You can set up a remote file system, like with ExpanDrive for Windows, to let you keep your files there.
You can run ssh or rsh from Windows to run makes on the remote Linux box.
I've done windows/linux/freebsd cross-platform development with Windows as my primary OS... so it is possible.
Use VS as editor.
Access Linux Dev node via SSH with
putty.
Use revision control system
(subversion/git/bazaar/mercurial/cvs)
to check changes into repo & check
changes out on Linux.
Use a multi-platform build process. I
use SCons. It is python based
and works beautifully - though it is
a little slow with the default
settings.
Launch build process from shell using
putty.
Use additional shells as needed to
attach gdb & debug.
Now to answer your questions:
Yes. There is a VS setting to say use unix line endings. Many revision control systems can also be configured to correct this for you.
Maybe, but that's not how I did it.
Yes, you can remotely debug using GDB. GDB has many (all?) the features available with VS's debuger but you have to learn the GDB commands. I don't know of a way to use VS's debugger to debug processes compiled with GCC - though this is a frequent request.
I'd recommend that you dive in and try to learn the Linux way of doing things. What are the other people on your team using? If you use the same tool-set as other people, you'll be much better of when asking for help. If you're sitting on a Windows box cross-compiling using Cygwin, you're more or less on your own.
I work on a Linux team currently but use Visual Studio + Visual AssistX as my IDE. VS+VAX is the best environment for developing code in my opinion. Nothing like it exists anywhere else that I've found.
What you want to do is:
Install Cygwin openssh and configure it for shelling into your linux machine without a password.
Expose your development tree on your linux machine as a samba share and mount the share on your Windows machine.
Create a Visual Studio "makefile" project referencing the files on your linux machine.
Override the make command to ssh into your linux machine and execute the build.
Write a sed script on your linux machine that converts gcc/g++ output errors into visual studio format. I use something similar to this: sed -e 's/(.):([0-9]): (.*)/z:\path\to\code\\1(\2): \3/' \
I would really recommend you to give Linux a shot natively, not through a virtual machine. If you run it under a virtual machine you will probably end up doing 85% of your activities under Windows and this will prevent you from actually learning anything under linux.
Install linux in its own partition and work on it fulltime. Do this ASAP before the project start and get familiarized with the basics on how to use it first.
Regarding IDE's to use, find out what build system the project will use and what libraries you will be using. KDevelop is a great IDE although it might be a bit too cluttered. I really like Qt-Creator.
You might wanna give Eclipse a shot too.
As of what distribution to use, I would recommend you Archlinux if you feel like really learning something out of this and learning about linux along with learning to do development under linux. If you dont really want to learn too much about linux and go straight into developing then go with Kubuntu.
As for what Desktop Manager to use I would go with KDE.
There is no Visual Studio on Linux. Period. Try KDevelop or Code::Blocks. They should make development fun on Linux.
As for the compiler/executables you'd have to use the GNU GCC toolchain. There is no MS cl compiler on Linux either.
The debugger to use is gdb, again part of the GCC toolchain.
One more thing, try to pick a shell (like bash) and read up on it. It'll save quite some time in future.
I wrote a ftp script to move files from my pc to the linux box,
then set it up as a tool, so i can at least write the code on the pc, and have
easy access to source safe. I hit a tool button, and the files get transferred to
the linux box, where i use the utilities there to do the work
& 3.:
I use cygwin + Eclipse on Windows for developing and compiling.
With this combination I can also debug via gdbserver on the target machine (VM with x86 Linux or ARM "real" target).
Unfortunately you have to do some tiny but important settings (library paths in gdb etc...) but as soon as it works......
Sorry, no solution for debugging from within VS on a linux box...and I think there will none in the near future...
What you will find is that there are dialectic variations in the compiler and the libraries are different enough that it's unlikely to work well.
You're probably better off with a gcc based tool chain like MinGW if you don't want to switch your environment to Windows right off. MinGW uses native Win32 ports of standard open-source libraries such as getopt, and it is fairly easy to port software between Linux and MinGW32 (as long as you're not using Linux or Windows specific APIs).
However, porting software from MinGW to Visual C++ is quite a bit harder. On the few occasions that I've done this sort of thing I find that porting between Linux and MinGW is much easier than porting between MinGW and Visual C++.
As far as I'm aware I've never seen a MinGW plugin for Visual Studio, although one could theoretically write such a thing as Visual Studio will let you use third party compilers. Additionally, you will have to work with whatever build system the rest of the team uses, which is pretty much guaranteed not to be MSBuild.
So, I'd guess that it's fairly unlikely to work well. Still, as Hunt & Thomas would say getting used to a different way of doing things will make you a better programmer. While vi (or emacs if you're that way inclined), ctags and gdb work quite differently to Visual studio they're still quite a powerful development environment. With MinGW32 and Cygwin or MSYS you can use these without having to make a wholesale switch across to Linux.

Resources