CLion - GDB: current version is GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1; supported version is 7.8.x
I had the very same problem. I wasn't able to make CLion work with gdb 7.10.x but I was able to make cygwin install gdb 7.8-1. My method should work to install any version you want.
The following steps describe the way I managed to do it, I'm a newbie using cygwin, so maybe some of them are unnecessary.
- Create a cache directory for cygwin and place the cygwin
setup.exe
in it (in my caseC:\cygwinCache
). [Source] - Execute the
setup.exe
and follow the usual steps for installing from Internet. Select Install from Internet, select your cygwin root directory (in my caseC:\cygwin64
), create and select a directory inside your cygwin cache directory (in my caseC:\cygwinCache\downloaded
), select the connection option your Internet connection requires, then select any server with gdb available (I selectedhttp://cygwin.mirror.constant.com
) and click Next. This will download and parse asetup.ini
file that contains the available packages in the server you selected. Thissetup.ini
file will be located in your cache directory in a sub directory named after the server you selected (C:\cygwinCache\downloaded\http%3a%2f%2fcygwin.mirror.constant.com%2f\x86_64
). - From the link that @H. DJEMAI found (this one) download the gdb installation and source files of the version you want (I downloaded
gdb-7.8-1.tar.xz
andgdb-7.8-1-src.tar.xz
). As a backup, I uploaded these files in here. In the directory where the
setup.ini
file is located create the\release\gdb
directory. In this newly created\release\gdb
directory place both of the gdb files you downloaded in the last step. Now you have the gdb installation and source files in the following paths:C:\cygwinCache\downloaded\http%3a%2f%2fcygwin.mirror.constant.com%2f\x86_64\release\gdb\gdb-7.8-1.tar.xzC:\cygwinCache\downloaded\http%3a%2f%2fcygwin.mirror.constant.com%2f\x86_64\release\gdb\gdb-7.8-1-src.tar.xz
Open the
setup.ini
file, and look for a line with this string:@ gdb
. This section has the information of the gdb package and information about the files it may contain. It should look like this:@ gdbsdesc: "The GNU Debugger"ldesc: "The GNU debugger, allows you to debug programs written in C, C++,and other languages, by executing them in a controlled fashionand printing their data."category: Develrequires: cygwin libexpat1 libiconv2 libintl8 liblzma5 libncursesw10 libreadline7 pythonversion: 7.10.1-1install: x86_64/release/gdb/gdb-7.10.1-1.tar.xz 2670932 cd1fa152888faa3e4cb8e1d075604fb2e039d73acdd159d7c9553741fd7710778c742495c93476b234e3386d54bd5bdc5275007290b6eb940d70197feb21b573source: x86_64/release/gdb/gdb-7.10.1-1-src.tar.xz 18542336 758428a83148af8425cff2712ac15d842f449d824f0edc9bb8db1d1d84bf963e2f371372d0c645408c202914ffb088a9da32be5a9b62a637a71f2fe9b7d4614f[prev]version: 7.9.1-1install: x86_64/release/gdb/gdb-7.9.1-1.tar.xz 2550148 f62f65865a11757b945f431a3662e16d0357dc9a0cbc720d16f5e99543cd3231f34bacd245daeb113ad38501358d9b1e7d128a1a45871d02c2bfb1c15891fbcbsource: x86_64/release/gdb/gdb-7.9.1-1-src.tar.xz 17888340 b90d198404a0a16268b443f4a4ec9672dac1d531f3fbda848f807fee7c004f5394e1985253c64ab0cdc2dcf7c088645c60edbf8e9f39dce0f149bce4b11f5085
Now edit the file to make cygwin install the version you want. To achieve this modify the lines where it says
version
,install
andsource
with the information of the files you want to install. I modified the lines after the[prev]
string replacing7.8-1
instead of7.9.1-1
so cygwin points to the correct location. Note that the lines that start withinstall:
andsource:
contain the relative location of the files you previously downloaded and placed in the\release\gdb
directory. After this relative location thesetup.ini
file contains the byte size and SHA-512 of the specified file. You can get the bite size for your file in the file properties. To get the SHA-512 you have to use other software like this one. In the case of the7.8-1
files I got the following:@ gdbsdesc: "The GNU Debugger"ldesc: "The GNU debugger, allows you to debug programs written in C, C++,and other languages, by executing them in a controlled fashionand printing their data."category: Develrequires: cygwin libexpat1 libiconv2 libintl8 liblzma5 libncursesw10 libreadline7 pythonversion: 7.10.1-1install: x86_64/release/gdb/gdb-7.10.1-1.tar.xz 2670932 cd1fa152888faa3e4cb8e1d075604fb2e039d73acdd159d7c9553741fd7710778c742495c93476b234e3386d54bd5bdc5275007290b6eb940d70197feb21b573source: x86_64/release/gdb/gdb-7.10.1-1-src.tar.xz 18542336 758428a83148af8425cff2712ac15d842f449d824f0edc9bb8db1d1d84bf963e2f371372d0c645408c202914ffb088a9da32be5a9b62a637a71f2fe9b7d4614f[prev]version: 7.8-1install: x86_64/release/gdb/gdb-7.8-1.tar.xz 2491984 4c8d81984fe2ccbf92614c857737a42c4ec0c4016a5f8cf1dbc0fd117a1978baa7a8eadd2415a6d52041a1eecbe6b4e1373ba6850db6584869311a5e02a6e3b2source: x86_64/release/gdb/gdb-7.8-1-src.tar.xz 17669132 a71b6886774cb004baa7dc88ed767983a72fc94c7585bd79ff64c2bd2071c411cf0de76584c56aa3553d9541172eaf31f1dd142a6dedec50c5446ff2986c6d48
Don't forget to save the
setup.ini
file after you modified it.- Open the cygwin setup inside the cache directory. Now instead of selecting the install from Internet option select Install from Local Directory, then set your root directory and as local package directory select your cache directory (
C:\cygwinCache\downloaded
). It will parse the setup.ini file, and if you edited it successfully, it will show you the grid to install, upgrade or uninstall packages. If the parsing fails an error will be shown. - Look for the gdb package under Devel category, it should appear installed with a current version:
- Click it where it says
Keep
until you see the version you want. Then click next, this will start the installation, when the process is done, click finish. - You're done. You can open the cygwin terminal and type
gdb --version
and see that the correct version is installed:
After all these steps, now you can open clion and go to Settings > Toolchains and see the result:
PS. I achieved this with cygwin setup version 2.873 (64 bits).
While LuissRicardo's answer seems like it will work, I stumbled upon a solution online that is a lot more straightforward. See: http://kennyroh.blogspot.co.uk/2016/04/cygwin-clion-gdb-current-version-is-gnu.html
Download
gdb-7.8-2.tar.xz
from http://cygwin.mirror.constant.com/x86_64/release/gdb/ and put it somewhere in your Cygwin filesystem.Open a Cygwin terminal at that location, and run:
tar Jxvf gdb-7.8-2.tar.xz
. The instructions usezxvf
, but that won't work for.xz
archives.cd
into the folder you just extracted (for me this was justcd usr
).Run the command
cp -R * /usr/
to copy this to the correct location in the filesystem.Run
gdb --version
just to make sure it's set to 7.8.2. If it's not then maybe try restarting Cygwin, and if that doesn't work then maybe post on StackOverflow or something :p