www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - problem using ldc 1.0.0 as D compiler

reply Antonio Corbi <aaacorbi mail.com> writes:
Hi folks!

I'm using ldc version:
LDC - the LLVM D compiler (1.0.0):
   based on DMD v2.070.2 and LLVM 3.8.0
   built with DMD64 D Compiler v2.071.0
   Default target: x86_64-unknown-linux-gnu
   Host CPU: core2

And when trying to run this code (it compiles ok):

import std.regex;

void main(string[] args) {
   processLine ("abc int char[]");
}

long processLine (string l) {
   long count;
   int[string] lpb;

   lpb = ["char" : 0, "int" : 0, "for" : 0];

   foreach (rw; lpb.byKey) {
     string re = r"(^|\W)" ~ rw ~ r"(\W|$)";
     count = 0;

     auto r = matchAll(l, re);
     foreach(c; r) count++;

     lpb[rw] += count;
   }

   return count;
}

I get this error:
./ldcfail
Fatal Error while loading '/usr/lib/libphobos2-ldc.so.70':
         The module 'std.regex.internal.parser' is already defined 
in './ldcfail'.

The same code compiles and executes ok with both dmd (DMD64 D 
Compiler v2.071.0) and gdc (gdc (GCC) 6.1.1 20160501).

Is this a bug in ldc or is it somehow related to my code?
Thanks for your help.
Jun 20 2016
next sibling parent David Nadlinger <code klickverbot.at> writes:
Hi Antonio,

On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote:
 ./ldcfail
 Fatal Error while loading '/usr/lib/libphobos2-ldc.so.70':
         The module 'std.regex.internal.parser' is already 
 defined in './ldcfail'.

 […]

 Is this a bug in ldc or is it somehow related to my code?
 Thanks for your help.
This is a bug in LDC, or rather its interplay with certain system linker versions. This issue has also been reported at https://github.com/ldc-developers/ldc/issues/1534, but we are not sure how to reproduce it yet. Could you please add your test case and system details there? (Of particular interest are the version of the Linux distribution you are using, and `ld --version`.) As a workaround, you can always use Phobos as a static library in the meantime (e.g. from our the binary release packages). — David
Jun 20 2016
prev sibling parent reply Satoshi <satoshi rikarin.org> writes:
On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote:
 Hi folks!

 I'm using ldc version:
 LDC - the LLVM D compiler (1.0.0):
   based on DMD v2.070.2 and LLVM 3.8.0
   built with DMD64 D Compiler v2.071.0
   Default target: x86_64-unknown-linux-gnu
   Host CPU: core2

 [...]
I have the same problem with LDC 1.1.0 on Arch Linux
Jun 21 2016
next sibling parent reply yawniek <dlang srtnwz.com> writes:
On Tuesday, 21 June 2016 at 16:26:14 UTC, Satoshi wrote:
 On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote:
 Hi folks!

 I'm using ldc version:
 LDC - the LLVM D compiler (1.0.0):
   based on DMD v2.070.2 and LLVM 3.8.0
   built with DMD64 D Compiler v2.071.0
   Default target: x86_64-unknown-linux-gnu
   Host CPU: core2

 [...]
I have the same problem with LDC 1.1.0 on Arch Linux
you could use ldc-git from aur, https://aur.archlinux.org/packages/ldc-git/ this has static phobos
Jun 21 2016
parent Satoshi <satoshi rikarin.org> writes:
On Tuesday, 21 June 2016 at 17:30:38 UTC, yawniek wrote:
 On Tuesday, 21 June 2016 at 16:26:14 UTC, Satoshi wrote:
 On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote:
 Hi folks!

 I'm using ldc version:
 LDC - the LLVM D compiler (1.0.0):
   based on DMD v2.070.2 and LLVM 3.8.0
   built with DMD64 D Compiler v2.071.0
   Default target: x86_64-unknown-linux-gnu
   Host CPU: core2

 [...]
I have the same problem with LDC 1.1.0 on Arch Linux
you could use ldc-git from aur, https://aur.archlinux.org/packages/ldc-git/ this has static phobos
I'm linking phobos and druntime into another shared lib then I'm using it in projects.
Jun 21 2016
prev sibling parent reply David Nadlinger <code klickverbot.at> writes:
On Tuesday, 21 June 2016 at 16:26:14 UTC, Satoshi wrote:
 On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote:
 Hi folks!

 I'm using ldc version:
 LDC - the LLVM D compiler (1.0.0):
   based on DMD v2.070.2 and LLVM 3.8.0
   built with DMD64 D Compiler v2.071.0
   Default target: x86_64-unknown-linux-gnu
   Host CPU: core2

 [...]
I have the same problem with LDC 1.1.0 on Arch Linux
A fix for this just landed in Git master: https://github.com/ldc-developers/ldc/commit/6de981af757b00a91b36ae94d9ce9a8a81cfabf9 It would be great if you could build LDC yourself to verify that the issue is gone – be sure to open another ticket if the issue persists! — David
Jun 21 2016
parent reply Dicebot <public dicebot.lv> writes:
On Tuesday, 21 June 2016 at 21:43:16 UTC, David Nadlinger wrote:
 On Tuesday, 21 June 2016 at 16:26:14 UTC, Satoshi wrote:
 On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote:
 Hi folks!

 I'm using ldc version:
 LDC - the LLVM D compiler (1.0.0):
   based on DMD v2.070.2 and LLVM 3.8.0
   built with DMD64 D Compiler v2.071.0
   Default target: x86_64-unknown-linux-gnu
   Host CPU: core2

 [...]
I have the same problem with LDC 1.1.0 on Arch Linux
A fix for this just landed in Git master: https://github.com/ldc-developers/ldc/commit/6de981af757b00a91b36ae94d9ce9a8a81cfabf9 It would be great if you could build LDC yourself to verify that the issue is gone – be sure to open another ticket if the issue persists!
Would you mind making a point release with it if fix is confirmed?
Jun 21 2016
parent David Nadlinger <code klickverbot.at> writes:
On Tuesday, 21 June 2016 at 21:44:59 UTC, Dicebot wrote:
 Would you mind making a point release with it if fix is 
 confirmed?
That's Kai's territory, but I'm sure he'll agree that this a sensible thing to do. — David
Jun 22 2016