Difference between revisions of "GDC"

From D Wiki
Jump to: navigation, search
(Linux distribution packages)
 
(66 intermediate revisions by 13 users not shown)
Line 1: Line 1:
[[Compilers|« See D compiler list]]
+
{{:Compilers_Widget}}
<table cellspacing= "10" style="width:100%">
 
<tr>
 
<td style="width:70%; vertical-align:top;">
 
= Gnu Compiler Collection D Compiler =
 
GDC uses the GCC backend for code generation. GDC typically generates substantially faster binaries than DMD.
 
  
= Guides =
+
Welcome to GDC. This project aims to continue the development of GDC, a GCC frontend for the D programming language.
* [[Installing_GDC|Installing GDC]]
 
  
</td>
+
=== Useful Links ===
<td style="width:30%; vertical-align:top;">
 
== Useful Links ==
 
 
* [https://github.com/D-Programming-GDC/GDC Source code (GitHub)]
 
* [https://github.com/D-Programming-GDC/GDC Source code (GitHub)]
</td>
+
* [http://www.gdcproject.org/ Project website]
 +
* [http://bugzilla.gdcproject.org/describecomponents.cgi Bug tracker]
 +
* [https://www.bountysource.com/trackers/455080-gdc Bountysource project]
 +
 
 +
== Introduction ==
 +
=== What is GDC? ===
 +
GDC is a frontend for the [//dlang.org D programming language]. By using GCC as a backend, it gives us the ability to target the same platforms that GCC targets.
 +
 
 +
This project was originally started by David Friedman. His first announcement can be found [http://forum.dlang.org/post/c3mnst$2htg$1@digitaldaemon.com here] and his original project page can be found [http://dgcc.sourceforge.net here]. Unfortunately, he disappeared from the D scene, and was no longer able to maintain GDC. This project was the result of an effort to help continue David Friedman's work on GDC.
 +
 
 +
The paperwork is complete and efforts are currently underway to merge GDC into the official GCC codebase, which represents a great step forward for D. However, more than ever, GDC is in need of contributors to keep it up to date with both the D frontend and the trunk development of the GCC backend.
 +
 
 +
=== Why GDC? ===
 +
There are many advantages to adding a D frontend to GCC, and most of them stem from the fact that the GCC codebase has been the focus of extensive development over several decades, and that the GCC middle and back ends are designed such that multiple languages can easily take advantage of them. This means that a D frontend that can make use of the GCC middle and backend code will gain many advantages that would require years of development to match in the DMD codebase.
 +
 
 +
Firstly, GCC targets many more platforms than DMD.
 +
 
 +
Secondly, GCC has a very well-developed optimization framework that can generally generate more performant code than DMD, particularly when taking advantage of more recent CPU features such as SIMD instructions (both directly and through automatic vectorization).
 +
 
 +
Thirdly, GDB is primarily developed to debug code generated by GCC, so debugging code generated by GCC will generally result in a better user experience.
 +
 
 +
=== Status ===
 +
D2 Frontend Versions: [//dlang.org/changelog/2.068.0.html 2.068], [//dlang.org/changelog/2.076.0.html 2.076], [//dlang.org/changelog/2.081.0.html 2.081]
 +
 
 +
=== Supported GCC versions ===
 +
* [//gcc.gnu.org/gcc-4.7 GCC 4.7.x (2.062)]
 +
* [//gcc.gnu.org/gcc-4.8 GCC 4.8.x (2.066.1)]
 +
* [//gcc.gnu.org/gcc-4.9 GCC 4.9.x (2.066.1)]
 +
* [//gcc.gnu.org/gcc-5 GCC 5.x (2.066.1)]
 +
* [//gcc.gnu.org/gcc-6 GCC 6.x (2.068.2)]
 +
* [//gcc.gnu.org/gcc-7 GCC 7.x (2.076.0)]
 +
* [//gcc.gnu.org/gcc-8 GCC 8.x (2.081.1)]
 +
* [//gcc.gnu.org/gcc-9 GCC 9.x (2.081.1)]
 +
* [//gcc.gnu.org/gcc-10 GCC 10.x (2.076)]
 +
* [https://gcc.gnu.org/gcc-11/changes.html GCC 11.x+ (2.076)]
 +
* [https://gcc.gnu.org/gcc-12/changes.html GCC 12.x+ (2.100.1)]
 +
* [https://gcc.gnu.org/gcc-13/changes.html GCC 13.x+ (2.103.0-rc.1)]
 +
 
 +
GDC (implementing version 2.076 of the language and runtime) was merged ( https://gcc.gnu.org/gcc-9/changes.html#d ) into GCC project in version 9.0, and will be supported and updated for all future GCC versions indefinitely.
 +
 
 +
== Installing GDC ==
 +
=== Linux distribution packages ===
 +
Official packages are available for these distributions
 +
* [https://packages.fedoraproject.org/pkgs/gcc/gcc-gdc/ Fedora]
 +
* [https://packages.debian.org/search?keywords=gdc&searchon=names&exact=1&suite=all&section=all Debian]
 +
* [https://packages.ubuntu.com/search?keywords=gdc&searchon=names&exact=1&suite=all&section=all Ubuntu]
 +
* [https://www.archlinux.org/packages/core/x86_64/gcc-d/ Arch Linux]
 +
 
 +
For Gentoo Linux, GDC enabled ebuilds of GCC are available from the [https://github.com/gentoo/dlang dlang] overlay:
 +
* [https://wiki.gentoo.org/wiki/Dlang Gentoo Wiki: Dlang]
 +
Enable the ''d'' USE-flag for sys-devel/gcc and emerge it again. If you are currently on stable GCC you can install the GDC enabled testing version in parallel. gcc-config should be used to switch the active version temporarily if you would like to be able to run ''gdc'' without typing the full path.
 +
 
 +
=== Official prebuilt binaries ===
 +
Various precompiled toolchains are available on the [http://gdcproject.org/downloads/ official download page].
 +
 
 +
=== Detailed installation guide ===
 +
[[GDC/Installation|GDC/Installation]] contains detailed information on building and installing GDC alongside your system's host compilers.
 +
 
 +
== Documentation ==
 +
=== User Documentation ===
 +
[[GDC/Using_GDC]] aims to explain some aspects of GDC such as its usage, differences from DMD, and known issues. If you need help using GDC, take a look here.
 +
 
 +
=== Target Documentation ===
 +
==== MinGW ====
 +
[[GDC/MinGW|This documentation page]] aims to explain aspects of the MinGW port of GDC.  Such as MinGW specific features, Windows specific topics and known issues.  A source code repository containing various patches and a build script can be found [https://github.com/venix1/MinGW-GDC here], but it may be out of date.
 +
 
 +
==== ARM Cortex-M ====
 +
A minimal "Hello World!" example that requires no D runtime, no standard library (Phobos), and no C can be found [[Minimal semihosted ARM Cortex-M %22Hello_World%22 | here]].  It serves as an excellent starting point for anyone wishing to pursue their own port of D to the ARM Cortex-M family of microcontrollers.
 +
 
 +
Additionally, there is [https://bitbucket.org/timosi/minlibd minlibd].  A collection of libraries and tools to compile D language programs for embedded systems with the GDC compiler.
 +
 
 +
See also [[Bare Metal ARM Cortex-M GDC Cross Compiler]] for instructions specific to building a bare metal ARM Cortex-M GDC cross compiler.
 +
 
 +
=== Developer Documentation ===
 +
[[GDC/Development/DevelopmentEnvironment]] provides instructions on how to set up a development environment for hacking the GDC compiler.
 +
 
 +
[[GDC/Hacking]] describes the structure of the GCC and GDC source code repositories.
 +
 
 +
[[GDC/Development]] contains information about the internals of GDC, and will be a valuable resource for those that wish to help with GDC's development.
 +
 
 +
== Support ==
 +
Support can be found in a couple of different places:
 +
 
 +
* On irc.libera.chat, there is a GDC irc channel. It is channel [irc://irc.libera.chat/d-gdc #d-gdc].
 +
* The D.gnu newsgroup, located [//forum.dlang.org/group/D.gnu here].
 +
* Sending an inbox message to one of the maintainers.
 +
 
 +
The D.gnu newsgroup should also be used for general discussion about GDC. A bug, proposal, or enhancement can go to the [http://bugzilla.gdcproject.org/describecomponents.cgi issue tracker]. If you choose to use the issue tracker, please label the issue appropriately. (bug, proposal, enhancement)
 +
 
 +
=== Bugs ===
 +
A list of open bugs can be found [http://bugzilla.gdcproject.org/describecomponents.cgi here.] New bugs should be submitted to the GDC Bugzilla site. A simple comment saying "This also happens/doesn't happen on Mac\Windows\Linux under GCC x.x.x(GCC version)" can be useful in helping solve the bug.
 +
 
 +
If you have found a possible bug in GDC, please submit it! Here are some guidelines that you should follow when submitting a bug:
 +
 
 +
# Make sure the bug has not already been submitted to GDC.
 +
# Include the GCC version. (e.g. 4.7.0, etc)
 +
# Include the git changeset you are using for GDC. (e.g. changeset 6f03952ff48f)
 +
# Include your operating system.(Mac/Windows/flavour of Linux)
 +
# Include a simple test case demonstrating the issue.
 +
# if possible, include a patch to fix the issue.
 +
 
 +
== Getting Involved ==
 +
 
 +
Please see [[GDC/GCCSubmission|Submission of D Front End]] for a list of open (and closed) tasks for the current GCC submission process.
 +
 
 +
Please see [[GDC/ProjectIdeas|Project Ideas]] for inspiration and long term goals.
 +
 
 +
GDC is currently developed by a very small group (as the commit history on GitHub shows). While the addition of a D frontend to GCC represents a great step forward for D, it also represents an informal promise by the D community to keep the D frontend up to date with the latest GCC development.
 +
 
 +
If you use GDC, we encourage you to try to contribute, whether by submitting pull requests or bug reports. In the past, GDC has nearly died due to poor communication and lack of development. Avoiding those issues is easier than ever before, but GDC will always need a community that's willing to give back.
 +
 
 +
Thanks to GitHub, contributing to GDC is as easy as forking the repository and submitting a pull request (although this workflow will likely change when the merge is officially complete), and filing a bug report is a simple web form.
 +
 
 +
There are a lot of things that you can do to get involved and help out with GDC. They vary from making simple documentation for some of the files, finding and submitting bugs, testing out bugs on different platforms, or submitting patches for GDC. Any help is appreciated.
 +
 
 +
[[Category:GDC Compiler]]

Latest revision as of 12:47, 13 December 2023

Compilers: OverviewDMDGDCLDC

Welcome to GDC. This project aims to continue the development of GDC, a GCC frontend for the D programming language.

Useful Links

Introduction

What is GDC?

GDC is a frontend for the D programming language. By using GCC as a backend, it gives us the ability to target the same platforms that GCC targets.

This project was originally started by David Friedman. His first announcement can be found here and his original project page can be found here. Unfortunately, he disappeared from the D scene, and was no longer able to maintain GDC. This project was the result of an effort to help continue David Friedman's work on GDC.

The paperwork is complete and efforts are currently underway to merge GDC into the official GCC codebase, which represents a great step forward for D. However, more than ever, GDC is in need of contributors to keep it up to date with both the D frontend and the trunk development of the GCC backend.

Why GDC?

There are many advantages to adding a D frontend to GCC, and most of them stem from the fact that the GCC codebase has been the focus of extensive development over several decades, and that the GCC middle and back ends are designed such that multiple languages can easily take advantage of them. This means that a D frontend that can make use of the GCC middle and backend code will gain many advantages that would require years of development to match in the DMD codebase.

Firstly, GCC targets many more platforms than DMD.

Secondly, GCC has a very well-developed optimization framework that can generally generate more performant code than DMD, particularly when taking advantage of more recent CPU features such as SIMD instructions (both directly and through automatic vectorization).

Thirdly, GDB is primarily developed to debug code generated by GCC, so debugging code generated by GCC will generally result in a better user experience.

Status

D2 Frontend Versions: 2.068, 2.076, 2.081

Supported GCC versions

GDC (implementing version 2.076 of the language and runtime) was merged ( https://gcc.gnu.org/gcc-9/changes.html#d ) into GCC project in version 9.0, and will be supported and updated for all future GCC versions indefinitely.

Installing GDC

Linux distribution packages

Official packages are available for these distributions

For Gentoo Linux, GDC enabled ebuilds of GCC are available from the dlang overlay:

Enable the d USE-flag for sys-devel/gcc and emerge it again. If you are currently on stable GCC you can install the GDC enabled testing version in parallel. gcc-config should be used to switch the active version temporarily if you would like to be able to run gdc without typing the full path.

Official prebuilt binaries

Various precompiled toolchains are available on the official download page.

Detailed installation guide

GDC/Installation contains detailed information on building and installing GDC alongside your system's host compilers.

Documentation

User Documentation

GDC/Using_GDC aims to explain some aspects of GDC such as its usage, differences from DMD, and known issues. If you need help using GDC, take a look here.

Target Documentation

MinGW

This documentation page aims to explain aspects of the MinGW port of GDC. Such as MinGW specific features, Windows specific topics and known issues. A source code repository containing various patches and a build script can be found here, but it may be out of date.

ARM Cortex-M

A minimal "Hello World!" example that requires no D runtime, no standard library (Phobos), and no C can be found here. It serves as an excellent starting point for anyone wishing to pursue their own port of D to the ARM Cortex-M family of microcontrollers.

Additionally, there is minlibd. A collection of libraries and tools to compile D language programs for embedded systems with the GDC compiler.

See also Bare Metal ARM Cortex-M GDC Cross Compiler for instructions specific to building a bare metal ARM Cortex-M GDC cross compiler.

Developer Documentation

GDC/Development/DevelopmentEnvironment provides instructions on how to set up a development environment for hacking the GDC compiler.

GDC/Hacking describes the structure of the GCC and GDC source code repositories.

GDC/Development contains information about the internals of GDC, and will be a valuable resource for those that wish to help with GDC's development.

Support

Support can be found in a couple of different places:

  • On irc.libera.chat, there is a GDC irc channel. It is channel #d-gdc.
  • The D.gnu newsgroup, located here.
  • Sending an inbox message to one of the maintainers.

The D.gnu newsgroup should also be used for general discussion about GDC. A bug, proposal, or enhancement can go to the issue tracker. If you choose to use the issue tracker, please label the issue appropriately. (bug, proposal, enhancement)

Bugs

A list of open bugs can be found here. New bugs should be submitted to the GDC Bugzilla site. A simple comment saying "This also happens/doesn't happen on Mac\Windows\Linux under GCC x.x.x(GCC version)" can be useful in helping solve the bug.

If you have found a possible bug in GDC, please submit it! Here are some guidelines that you should follow when submitting a bug:

  1. Make sure the bug has not already been submitted to GDC.
  2. Include the GCC version. (e.g. 4.7.0, etc)
  3. Include the git changeset you are using for GDC. (e.g. changeset 6f03952ff48f)
  4. Include your operating system.(Mac/Windows/flavour of Linux)
  5. Include a simple test case demonstrating the issue.
  6. if possible, include a patch to fix the issue.

Getting Involved

Please see Submission of D Front End for a list of open (and closed) tasks for the current GCC submission process.

Please see Project Ideas for inspiration and long term goals.

GDC is currently developed by a very small group (as the commit history on GitHub shows). While the addition of a D frontend to GCC represents a great step forward for D, it also represents an informal promise by the D community to keep the D frontend up to date with the latest GCC development.

If you use GDC, we encourage you to try to contribute, whether by submitting pull requests or bug reports. In the past, GDC has nearly died due to poor communication and lack of development. Avoiding those issues is easier than ever before, but GDC will always need a community that's willing to give back.

Thanks to GitHub, contributing to GDC is as easy as forking the repository and submitting a pull request (although this workflow will likely change when the merge is officially complete), and filing a bug report is a simple web form.

There are a lot of things that you can do to get involved and help out with GDC. They vary from making simple documentation for some of the files, finding and submitting bugs, testing out bugs on different platforms, or submitting patches for GDC. Any help is appreciated.