digitalmars.D.learn - Find out druntime/import and phobos folder on Linux
- Andre Pany (19/19) Jul 14 2018 Hi,
- Anonymouse (5/10) Jul 14 2018 Arch Linux and derivatives keep them under
- Andre Pany (6/17) Jul 14 2018 Somehow also the DMD executable needs to know which
- Mike Franklin (4/7) Jul 14 2018 DMD determines default import and library paths from the dmd.conf
- Timoses (4/23) Jul 15 2018 Maybe this helps?
- Seb (23/42) Jul 15 2018 DMD:
- Andre Pany (7/31) Jul 15 2018 Thank you all for the answers. That was exactly the answers I
Hi, The IntelliJ D Language plugin has support for D-scanner and DCD. Both tools needs to know the paths to druntime/import and Phobos source folder. In IntelliJ you set the path to the folder where dmd binary is located. Based on this information on Windows and MacOS it is possible to determine the paths. The code can be found here https://github.com/intellij-dlanguage/intellij-dlanguage/blob/develop/src/main/java/io/github/intellij/dlanguage/codeinsight/dcd/DCDCompletionServer.java#L180 I want to provide a fix that the paths are also automatically determined on Linux correctly but I do not have much Linux experience. Is there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr/include/dmd/phobos Kind regards Andre
Jul 14 2018
On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote:Is there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr/include/dmd/phobosArch Linux and derivatives keep them under /usr/include/dlang/{dmd,gdc,ldc}/* You may have to hardcode some common paths and try them in each in turn. I'm happy to be proven wrong here though.
Jul 14 2018
On Saturday, 14 July 2018 at 19:00:56 UTC, Anonymouse wrote:On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote:Somehow also the DMD executable needs to know which Phobos/DRuntime it should use. How does DMD is working here? Maybe I can do the same... Kind regards AndréIs there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr/include/dmd/phobosArch Linux and derivatives keep them under /usr/include/dlang/{dmd,gdc,ldc}/* You may have to hardcode some common paths and try them in each in turn. I'm happy to be proven wrong here though.
Jul 14 2018
On Saturday, 14 July 2018 at 19:04:01 UTC, Andre Pany wrote:Somehow also the DMD executable needs to know which Phobos/DRuntime it should use. How does DMD is working here? Maybe I can do the same...DMD determines default import and library paths from the dmd.conf file typically at /etc/dmd.conf. Mike
Jul 14 2018
On Saturday, 14 July 2018 at 19:04:01 UTC, Andre Pany wrote:On Saturday, 14 July 2018 at 19:00:56 UTC, Anonymouse wrote:Maybe this helps? https://github.com/dlang/installer/blob/master/linux/dmd_deb.sh#L331 Or check thOn Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote:Somehow also the DMD executable needs to know which Phobos/DRuntime it should use. How does DMD is working here? Maybe I can do the same... Kind regards AndréIs there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr/include/dmd/phobosArch Linux and derivatives keep them under /usr/include/dlang/{dmd,gdc,ldc}/* You may have to hardcode some common paths and try them in each in turn. I'm happy to be proven wrong here though.
Jul 15 2018
On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote:Hi, The IntelliJ D Language plugin has support for D-scanner and DCD. Both tools needs to know the paths to druntime/import and Phobos source folder. In IntelliJ you set the path to the folder where dmd binary is located. Based on this information on Windows and MacOS it is possible to determine the paths. The code can be found here https://github.com/intellij-dlanguage/intellij-dlanguage/blob/develop/src/main/java/io/github/intellij/dlanguage/codeinsight/dcd/DCDCompletionServer.java#L180 I want to provide a fix that the paths are also automatically determined on Linux correctly but I do not have much Linux experience. Is there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr/include/dmd/phobos Kind regards AndreDMD: https://github.com/dlang/dmd/blob/master/src/dmd/dinifile.d#L40 LDC: https://wiki.dlang.org/Using_LDC, https://github.com/dlang/dmd/blob/master/src/dmd/frontend.d#L97 Once you have the config file, simply parse the config files: https://github.com/dlang/dmd/blob/master/src/dmd/frontend.d#L156 Anyhow as DMD is on DUB, there's no need for copy/pasting: --- /+dub.sdl: dependency "dmd" version="~master" +/ void main() { import dmd.frontend; import std.stdio; findImportPaths().writeln; // will determine the currently active "dmd" compiler (can be LDC too) } --- DMD's order is a bit annoying, see: https://github.com/dlang/dmd/pull/7915
Jul 15 2018
On Sunday, 15 July 2018 at 09:17:31 UTC, Seb wrote:On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote:Thank you all for the answers. That was exactly the answers I searched for. The IntelliJ D plugin is written in java/Kotlin so I cannot use dmd here but simple rewrite the logic in java. Kind regards Andre[...]DMD: https://github.com/dlang/dmd/blob/master/src/dmd/dinifile.d#L40 LDC: https://wiki.dlang.org/Using_LDC, https://github.com/dlang/dmd/blob/master/src/dmd/frontend.d#L97 Once you have the config file, simply parse the config files: https://github.com/dlang/dmd/blob/master/src/dmd/frontend.d#L156 Anyhow as DMD is on DUB, there's no need for copy/pasting: --- /+dub.sdl: dependency "dmd" version="~master" +/ void main() { import dmd.frontend; import std.stdio; findImportPaths().writeln; // will determine the currently active "dmd" compiler (can be LDC too) } --- DMD's order is a bit annoying, see: https://github.com/dlang/dmd/pull/7915
Jul 15 2018