D.gnu - gdc --version doesn't indicate which D front-end version it's
- singingbush (26/26) Jan 28 2022 not sure where is best placed for this but on my Fedora system
- singingbush (3/29) Jan 28 2022 Just seen
- Siarhei Siamashka (25/30) Jan 28 2022 This would be indeed nice. But so far we have to compile and run
- singingbush (5/5) Jan 28 2022 Seems I cannot use gdc currently. It turns out that gdc-11.2.1
- Adam D Ruppe (5/8) Jan 28 2022 It is more complicated than that because gdc has a bunch of
- Salih Dincer (8/12) Jan 30 2022 It might be a silly question: If the compiler includes old
- Siarhei Siamashka (23/35) Jan 30 2022 Phobos source files are included in the GDC source tree.
- WebFreak001 (12/38) Feb 22 2022 If you want to do this automated you can run
not sure where is best placed for this but on my Fedora system running `gdc --version` gives me pretty much the same output as `gcc --version` GDC: ``` $ gdc --version gdc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` GCC: ``` $ gcc --version gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).
Jan 28 2022
On Friday, 28 January 2022 at 17:42:25 UTC, singingbush wrote:not sure where is best placed for this but on my Fedora system running `gdc --version` gives me pretty much the same output as `gcc --version` GDC: ``` $ gdc --version gdc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` GCC: ``` $ gcc --version gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).Just seen https://forum.dlang.org/thread/nuphsvwkdlygdcxaihwf forum.dlang.org about D 2.098 being in GCC, still can't tell if that's what I have based on the output though.
Jan 28 2022
On Friday, 28 January 2022 at 17:45:32 UTC, singingbush wrote:This would be indeed nice. But so far we have to compile and run the following code: ```D import std.stdio, std.compiler; void main() { writeln(version_major, ".", version_minor); } ``` It's ironic that I have exactly the opposite problem. I need to check for the backend version from inside of the running program, and this isn't easy. I resorted to using this hack: ```D // GDC11 was the first version to start supporting getTargetInfo traits bool detect_gdc11() { version(GNU) { return __traits(compiles, __traits(getTargetInfo, "cppStd")); } else return false; } ```It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).Just seen https://forum.dlang.org/thread/nuphsvwkdlygdcxaihwf forum.dlang.org about D 2.098 being in GCC, still can't tell if that's what I have based on the output though.It landed in the git repository and is going to be released as part of GDC 12.
Jan 28 2022
Seems I cannot use gdc currently. It turns out that gdc-11.2.1 (which is the one in Fedora 35 repo) still has D frontend at 2.076 and I have multiple dependencies that cannot compile with that version. Hopefully when GDC 12 lands projects will start testing against it in their CI builds.
Jan 28 2022
On Friday, 28 January 2022 at 17:42:25 UTC, singingbush wrote:It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).It is more complicated than that because gdc has a bunch of backported things from newer versions too. You might be best off just trying it and seeing if your code works.
Jan 28 2022
On Friday, 28 January 2022 at 17:42:25 UTC, singingbush wrote:It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).It might be a silly question: If the compiler includes old version Dlang. So how about compiling with new version of Phobos source files. Will it compile take too long, huh? One more question but it will be irrelevant: If we leave DMD out of the question; other compilers throwing an error when compiling with "-version=test1" etc. I guess only DMD supports it? Thanks...
Jan 30 2022
On Sunday, 30 January 2022 at 17:41:21 UTC, Salih Dincer wrote:On Friday, 28 January 2022 at 17:42:25 UTC, singingbush wrote:Phobos source files are included in the GDC source tree. Compiling GDC (actually GCC with C, C++, Objective C, Fortran, D and a bunch of other bells and whistles) takes more than one hour on my computer. ``` $ gdc-12.0.1 --version gdc-12.0.1 (Gentoo 12.0.1, commit d1182631ee73f3c7efeb5e70e6caa2da064df984) 12.0.1 20220130 (experimental) Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` Just as the message says, it's an experimental build from git. Various bugs may be expected in both D frontend and GCC backend. But it's good enough as a preview of the new features. I doubt that compiling the newest Phobos with the old GDC 11 is going to work smoothly. If this was the case, then newer Phobos would have been already bundled with GDC 11.It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).It might be a silly question: If the compiler includes old version Dlang. So how about compiling with new version of Phobos source files. Will it compile take too long, huh?One more question but it will be irrelevant: If we leave DMD out of the question; other compilers throwing an error when compiling with "-version=test1" etc. I guess only DMD supports it?It's "-fversion=test1" for GDC.
Jan 30 2022
On Friday, 28 January 2022 at 17:42:25 UTC, singingbush wrote:not sure where is best placed for this but on my Fedora system running `gdc --version` gives me pretty much the same output as `gcc --version` GDC: ``` $ gdc --version gdc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` GCC: ``` $ gcc --version gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` It would be far more helpful if running `gdc --version` gave some indication of the version of D it's aligned to (which was 2.076 last time I checked).If you want to do this automated you can run echo | gdc -xd -fsyntax-only -v - see how code-d does it: https://github.com/Pure-D/code-d/blob/master/src/compilers.ts#L637 Then you can fetch from the output the GCC version, DMD-FE version and import paths using these regexes: ```js const gdcVersionRegex = /^gcc version\s+v?(\d+(?:\.\d+)+)/gm; const gdcFeVersionRegex = /^version\s+v?(\d+(?:\.\d+)+)/gm; const gdcImportPathRegex = /^import path\s*\[\d+\]\s*=\s*(.+)/gm; ```
Feb 22 2022