module std.regex

2013-12-30 Thread Benji

Hello,
when I try to run following code:

import std.stdio;
import std.net.curl;

void main()
{
writeln(dlang.org);
}

I get following error:

Fatal Error while loading 
'/usr/lib/x86_64-linux-gnu/libphobos2.so.0.64':

The module 'std.regex' is already defined in './maina'.
Segmentation fault (core dumped)

Somewhere I read that this should fix it:
- Make ModuleInfos immutable, which is something we should do 
anyhow.


But what are ModuleInfos ? Where I can find them and what 
exactly to do with them?


Re: module std.regex

2013-12-30 Thread Benji

On Monday, 30 December 2013 at 18:36:24 UTC, John Colvin wrote:

On Monday, 30 December 2013 at 18:08:42 UTC, Benji wrote:

Hello,
when I try to run following code:

import std.stdio;
import std.net.curl;

void main()
{
writeln(dlang.org);
}

I get following error:

Fatal Error while loading 
'/usr/lib/x86_64-linux-gnu/libphobos2.so.0.64':

The module 'std.regex' is already defined in './maina'.
Segmentation fault (core dumped)

Somewhere I read that this should fix it:
- Make ModuleInfos immutable, which is something we should do 
anyhow.


But what are ModuleInfos ? Where I can find them and what 
exactly to do with them?


Which compiler/version?


DMD 2.064-2 64bit, Ubuntu 13.10


Re: module std.regex

2013-12-30 Thread Benji
On Monday, 30 December 2013 at 19:27:43 UTC, Dmitry Olshansky 
wrote:

30-Dec-2013 22:08, Benji пишет:

Hello,
when I try to run following code:

import std.stdio;
import std.net.curl;

void main()
{
writeln(dlang.org);
}

I get following error:

Fatal Error while loading 
'/usr/lib/x86_64-linux-gnu/libphobos2.so.0.64':

The module 'std.regex' is already defined in './maina'.
Segmentation fault (core dumped)



It's a bug in 2.064-2 when using shared library. You as end 
user can't do much about it - wait for the next release where 
it should be fixed or use static linking for the moment.



Somewhere I read that this should fix it:
- Make ModuleInfos immutable, which is something we should do 
anyhow.




This is part of core developers discussion and isn't something 
easily tweaked (else it would've been already fixed).


Thanks! Could be downgrading to 2.063 the solution?


std.net.curl - get() is too slow

2013-12-20 Thread Benji

When I call get() function from std.net.curl,
I notice it's extremely slow!
Maybe 50 times slower than in Python..

Is there any better/faster alternative?


Re: D references

2013-12-20 Thread Benji

On Friday, 20 December 2013 at 18:26:08 UTC, Benji wrote:

On Friday, 20 December 2013 at 15:42:29 UTC, Frustrated wrote:
(I do believe you can build the docs from the source but I'm 
not

interested in that since it is already done)


Try http://ddili.org/ders/d.en/ (by Ali)


Sorry, I have got some sweety birds in my head now, I haven't 
understand your question properly :)


Re: D references

2013-12-20 Thread Benji

On Friday, 20 December 2013 at 15:42:29 UTC, Frustrated wrote:

(I do believe you can build the docs from the source but I'm not
interested in that since it is already done)


Try http://ddili.org/ders/d.en/ (by Ali)


Re: updating druntime

2013-12-15 Thread Benji

On Saturday, 14 December 2013 at 16:58:06 UTC, Marco Leise wrote:

Am Sat, 14 Dec 2013 08:43:42 +0100
schrieb Benji romanbeno...@gmail.com:

On Saturday, 14 December 2013 at 00:15:30 UTC, Marco Leise 
wrote:

 Am Fri, 13 Dec 2013 21:40:10 +0100
 schrieb Benji romanbeno...@gmail.com:

 I got two errors mentioned above at once.. :(

 What the heck is happening on your system? :(

I plan to install Arch, so hope that will solve it :P


So format c: it is ...
If you are switching already, Gentoo 
(http://www.gentoo.org/main/en/about.xml)
is also a viable option for D development 
(https://github.com/gentoo-dlang)

especially if you want to try alternative compilers to DMD and
plan to use libraries like GtkD and want them to work on top
of all your installed D compilers.
[Currently all D compilers produce libraries that are
incompatible with those of the other compilers, so a library
needs to be compiled and installed up to 6 times for all three
compilers and 32/64 bit versions. So it is nice to get some
assistance from the package manager here.]


I have Debian now,
and it works with dmd ~/main.d -L-lcurl :)


eclipse - adding custom flags to dmd when compiling

2013-12-15 Thread Benji

I want to compile file 'main.d' within Eclipse by following way:
  dmd ~/main.d -L-lcurl

How to achieve that?
By default, Eclipse compiles it without -L-lcurl flag.


Re: updating druntime

2013-12-13 Thread Benji

On Friday, 13 December 2013 at 15:00:57 UTC, Marco Leise wrote:

Am Thu, 12 Dec 2013 20:29:31 +0100
schrieb Benji romanbeno...@gmail.com:

On Thursday, 12 December 2013 at 19:11:03 UTC, John Colvin 
wrote:

 On Thursday, 12 December 2013 at 16:44:28 UTC, Benji wrote:
 Hello,
 when I try to compile something with dmd,
 I get following message:

 /usr/include/dmd/phobos/std/bitmanip.d(416): Error: 
 undefined identifier '_xopCmp'
 Error: ICE: _xopCmp not found in object module. You must 
 update druntime


 How to 'update druntime' ?

 how did you install dmd/druntime/phobos originally?

As it is mentioned in installation instructions to the dmd 
(linux-ubuntu)


Did you use the .deb file? It shouldn't produce such a
version mismatch. Did you install over a previous installation
and possibly have some leftover files from the old DMD version?

I'd say format c: and start over with the installation of DMD.
In any case, if you didn't install from the GitHub sources
this error message should not appear and someone who isn't
hacking on DMD does not have to update druntime manually.


Yes, I used :(

I tryied it again via zip-archive, and it works...
but, using std.net.curl module functions doesn't work for me...

This is my error: (after get(google.com) call)

[...]
In function `_D3std3net4curl4Curl7performMFbZi':
std/net/curl.d:(.text._D3std3net4curl4Curl7performMFbZi+0x1f): 
undefined reference to `curl_easy_perform'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libphobos2.a(curl_248d_4a1.o): 
In function `_D3std3net4curl4Curl11errorStringMFiZAya':
std/net/curl.d:(.text._D3std3net4curl4Curl11errorStringMFiZAya+0x11): 
undefined reference to `curl_easy_strerror'

collect2: error: ld returned 1 exit status

When I compile it this way: dmd helloa.d -L-lphobos2 -L-lcurl
Another error appear:

[...]
helloa.d:(.text._D3std6format66__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTmZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAammZk+0x45): 
undefined reference to 
`_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNcNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec'
helloa.o: In function 
`_D3std6format68__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTAyaZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAamAyaZk':
helloa.d:(.text._D3std6format68__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTAyaZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAamAyaZk+0x49): 
undefined reference to 
`_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNcNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec'
helloa.o:helloa.d:(.text._D3std6format64__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTtZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAatZk+0x40): 
more undefined references to 
`_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNcNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec' 
follow

collect2: error: ld returned 1 exit status

After 7 hours of effort and trying everything it still doesn't 
work :((


Re: updating druntime

2013-12-13 Thread Benji

On Friday, 13 December 2013 at 19:22:20 UTC, Marco Leise wrote:

Am Fri, 13 Dec 2013 19:48:46 +0100
schrieb Benji romanbeno...@gmail.com:


When I compile it this way: dmd helloa.d -L-lphobos2 -L-lcurl
Another error appear:

[...]
helloa.d:(.text._D3std6format66__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTmZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAammZk+0x45): 
undefined reference to 
`_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNcNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec'
helloa.o: In function 
`_D3std6format68__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTAyaZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAamAyaZk':
helloa.d:(.text._D3std6format68__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTAyaZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAamAyaZk+0x49): 
undefined reference to 
`_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNcNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec'
helloa.o:helloa.d:(.text._D3std6format64__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTtZ14formattedWriteFNaNfS3std5array17__T8AppenderTAyaZ8AppenderxAatZk+0x40): 
more undefined references to 
`_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNcNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec' 
follow

collect2: error: ld returned 1 exit status

After 7 hours of effort and trying everything it still doesn't 
work :((


And when you compile like this?: dmd helloa.d -L-lcurl
This will link in the static version of Phobos and there is
only one static (.a) Phobos on any system. -L-lphobos2 might
link against the wrong (.so) if you have an old version. I'm
just guessing here.


I got two errors mentioned above at once.. :(


Re: updating druntime

2013-12-13 Thread Benji

On Saturday, 14 December 2013 at 00:15:30 UTC, Marco Leise wrote:

Am Fri, 13 Dec 2013 21:40:10 +0100
schrieb Benji romanbeno...@gmail.com:


I got two errors mentioned above at once.. :(


What the heck is happening on your system? :(


I plan to install Arch, so hope that will solve it :P


updating druntime

2013-12-12 Thread Benji

Hello,
when I try to compile something with dmd,
I get following message:

/usr/include/dmd/phobos/std/bitmanip.d(416): Error: undefined 
identifier '_xopCmp'
Error: ICE: _xopCmp not found in object module. You must update 
druntime


How to 'update druntime' ?


Re: updating druntime

2013-12-12 Thread Benji

On Thursday, 12 December 2013 at 19:11:03 UTC, John Colvin wrote:

On Thursday, 12 December 2013 at 16:44:28 UTC, Benji wrote:

Hello,
when I try to compile something with dmd,
I get following message:

/usr/include/dmd/phobos/std/bitmanip.d(416): Error: undefined 
identifier '_xopCmp'
Error: ICE: _xopCmp not found in object module. You must 
update druntime


How to 'update druntime' ?


how did you install dmd/druntime/phobos originally?


As it is mentioned in installation instructions to the dmd 
(linux-ubuntu)


Re: stdout - autoflushing

2013-12-04 Thread Benji

On Tuesday, 3 December 2013 at 21:47:19 UTC, Adam D. Ruppe wrote:

On Tuesday, 3 December 2013 at 20:36:22 UTC, Benji wrote:

I am using Xubuntu, 64bit, and GDC as compiler


Any IDE? I've seen ide consoles buffer differently because the 
runtime sees the target as a pipe instead of a user-interactive 
terminal.


I'm using using Eclipse Kepler Standard(4.3).
I tryied it via shell and everything worked fine also without 
stdout.flush().




stdout - autoflushing

2013-12-03 Thread Benji

Hello,
in order to have correctly displayed output (before reading 
something from stdin),

I must call stdout.flush().
Sometimes, it's really annoying, especially when it is necessarry 
to call it 10 times.


For example:
write(Enter some string: );
stdout.flush();
string a = readln();
write(And again please: );
stdout.flush();
string b = readln();
...

Is there any way to prevent this?


Re: stdout - autoflushing

2013-12-03 Thread Benji

On Tuesday, 3 December 2013 at 17:49:32 UTC, H. S. Teoh wrote:

On Tue, Dec 03, 2013 at 06:12:20PM +0100, Benji wrote:

Hello,
in order to have correctly displayed output (before reading
something from stdin),
I must call stdout.flush().
Sometimes, it's really annoying, especially when it is 
necessarry to

call it 10 times.

For example:
write(Enter some string: );
stdout.flush();
string a = readln();
write(And again please: );
stdout.flush();
string b = readln();
...

Is there any way to prevent this?


What about:

void prompt(A...)(string fmt, A args)
{
writef(fmt, args);
stdout.flush();
return readln();
}

auto a = prompt(Enter your name: );
auto b = prompt(Enter your age: ).to!int;
... // etc.


T


Thanks, I didn't think about that (I'm beginner)


Re: stdout - autoflushing

2013-12-03 Thread Benji

On Tuesday, 3 December 2013 at 19:33:47 UTC, Ali Çehreli wrote:

On 12/03/2013 09:12 AM, Benji wrote:

Hello,
in order to have correctly displayed output (before reading 
something

from stdin),
I must call stdout.flush().


I am surprised that you need that. What is your platform?

Normally, stdin and stdout are tied. Reading from stdin 
flushes stdout automatically.


Ali


I am using Xubuntu, 64bit, and GDC as compiler