Building with dub fails on Ubuntu 16.10.

2016-09-10 Thread Vlasov Roman via Digitalmars-d-learn

Hello, guys.
I tried to build HelloWorld with dub, but i got strange linker 
error:



Performing "debug" build using dmd for x86_64.
test ~master: building configuration "application"...
Linking...
/usr/bin/ld: 
.dub/build/application-debug-linux.posix-x86_64-dmd_2071-0D6D3AB638EA28C55CFA241FFD9CA209/test.o: relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(object_15_594.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_223_55a.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can 
not be used when making a shared object; recompile with -fPIC


//manyStringsLater

/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(thread_26c_155.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can 
not be used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
--- errorlevel 1
dmd failed with exit code 1.

ld --version = 2.27
dmd --version = 2.071.1
dub --version = 1.0.0
Ubuntu 16.10 daily

On previously versions of Ubuntu all work fine.

What is the problem? Does anybody have any idea?



Compilation with dub + dmd: out of memory

2015-02-10 Thread Vlasov Roman via Digitalmars-d-learn
I have the quite computer with 2 GB RAM. At compilation with dub 
and dmd of small project this pair eating about 1.4~1.5 GB RAM. I 
solve this probleb by connecting swap partition, but it calls 
some freezes + it take ~10% of swap, and after compilation swap 
not released. At switching off swap as result we get ~200 MB of 
dead data in RAM, which can be released by rebooting. How i can 
resolve it?


Re: Compilation with dub + dmd: out of memory

2015-02-10 Thread Vlasov Roman via Digitalmars-d-learn

On Tuesday, 10 February 2015 at 12:42:07 UTC, ketmar wrote:

On Tue, 10 Feb 2015 11:44:09 +, Vlasov Roman wrote:


On Tuesday, 10 February 2015 at 11:32:32 UTC, bearophile wrote:

Vlasov Roman:

I have the quite computer with 2 GB RAM. At compilation with 
dub and
dmd of small project this pair eating about 1.4~1.5 GB RAM. 
I solve
this probleb by connecting swap partition, but it calls some 
freezes +
it take ~10% of swap, and after compilation swap not 
released. At
switching off swap as result we get ~200 MB of dead data 
in RAM,

which can be released by rebooting. How i can resolve it?


Look for CTFE code, perhaps some of it is excessive. You can 
convert

some of it to run-time in a module-level static this().

Bye,
bearophile


I think you don't understand me. 1.4~1.5 GB taked by 
compilator at

compilation my project in 100 string of code in 3 modules.


  fileVersion: 1,
  versions: {
dunit: 1.0.10,
descore: 1.2.0,
derelict-ft: 1.0.2,
derelict-util: 1.9.1,
tga: 0.1.0,
des: 1.3.3,
derelict-sdl2: 1.9.1,
derelict-gl3: 1.0.12
  }

wow-wow, do you REALLY expect all that to compile with few megs 
of RAM?
run dub -v and see the command lines. you'll be very 
surprised.


Whether correctly I understand that the problem is that my 
dependences have other dependences which are compiled with my 
project?
Yes, i very surpriced, because i use only 1-2 shared modules. 
So, i can copy this modules just in my project, but in big 
projects this problem can be very serious.




Re: Compilation with dub + dmd: out of memory

2015-02-10 Thread Vlasov Roman via Digitalmars-d-learn

On Tuesday, 10 February 2015 at 11:55:43 UTC, Daniel Kozák wrote:

V Tue, 10 Feb 2015 11:44:09 +
Vlasov Roman via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com napsáno:


On Tuesday, 10 February 2015 at 11:32:32 UTC, bearophile wrote:
 Vlasov Roman:

 I have the quite computer with 2 GB RAM. At compilation 
 with dub and dmd of small project this pair eating about 
 1.4~1.5 GB RAM. I solve this probleb by connecting swap 
 partition, but it calls some freezes + it take ~10% of 
 swap, and after compilation swap not released. At switching 
 off swap as result we get ~200 MB of dead data in RAM, 
 which can be released by rebooting. How i can resolve it?


 Look for CTFE code, perhaps some of it is excessive. You can 
 convert some of it to run-time in a module-level static 
 this().


 Bye,
 bearophile

I think you don't understand me. 1.4~1.5 GB taked by 
compilator at compilation my project in 100 string of code in 
3 modules.




Still it could be code dependent, can you share your code 
anywhere?


https://bitbucket.org/VlasovRoman/ogl/overview



mixin template had error by calling shared function

2014-12-10 Thread Vlasov Roman via Digitalmars-d-learn

I have this code

import std.stdio;

mixin template Template(void function() func1, void function() 
func2) {


voidto() {
func1();
func2();
}
};

class SomeClass {
mixin Template!(func, func23);

void func() {
writeln(First function!);
}

void func23() {
writeln(First function!);
}

void toTemplate() {
to();
}
}

void main() {
SomeClass a = new SomeClass();

a.toTemplate();
}

After running the program give me SIGSEGV in func23();

Terminal with gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00428352 in invariant._d_invariant(Object) ()
(gdb) up
#1  0x004257f7 in main.SomeClass.func23() ()


Manjaro Linux 0.9.0 x86_64
dmd 2.066
Kernel 3.14.4


Re: mixin template had error by calling shared function

2014-12-10 Thread Vlasov Roman via Digitalmars-d-learn

On Wednesday, 10 December 2014 at 10:34:25 UTC, Marc Schütz wrote:
On Wednesday, 10 December 2014 at 09:41:43 UTC, Rikki 
Cattermole wrote:

On 10/12/2014 10:10 p.m., Vlasov Roman wrote:

I have this code

import std.stdio;

mixin template Template(void function() func1, void 
function() func2) {


   void to() {
   func1();
   func2();
   }
};

class SomeClass {
   mixin Template!(func, func23);

   void func() {
   writeln(First function!);
   }

   void func23() {
   writeln(First function!);
   }

   void toTemplate() {
   to();
   }
}

void main() {
   SomeClass a = new SomeClass();

   a.toTemplate();
}

After running the program give me SIGSEGV in func23();

Terminal with gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00428352 in invariant._d_invariant(Object) ()
(gdb) up
#1  0x004257f7 in main.SomeClass.func23() ()


Manjaro Linux 0.9.0 x86_64
dmd 2.066
Kernel 3.14.4


Ugh, that's a compiler bug.
You should not be able to pass in delegates as function 
pointers to a mixin template.


A better way would be to pass in the names of the methods into 
the mixin template and then use string mixin's to call the 
methods.


Better yet, try this:

mixin template Template(void delegate() func1, void delegate() 
func2)


I tried this, but compiler give me error

main.d(12): Error: no 'this' to create delegate for func
main.d(12): Error: no 'this' to create delegate for func23

I think that error because i don't completly know dlang