www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GDC for dummies

reply bearophile <bearophileHUGS lycos.com> writes:
Time again to ask 'dumb' questions (maybe it's just a problem of searching
paths).

So far I have failed in the install of GDC (despite already having MinGW
correctly working, I use it quite often), so I have followed the instructions.

This page:
http://gdcwin.sourceforge.net/

Says:
"You need to have regular Minimalist GNU for Windows already installed,"

So I have used this online installer (to install it again ;-) ):
http://surfnet.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe
I have chosen to download the make and the C++ compiler.

Even if it's an ugly path, to avoid possible (silly) problems I have accepted
its suggested path:
C:\MinGW

(I have seen that it adds nothing to the path variable, that's probably wrong
for such installer).

Then I have installed this:
http://prdownloads.sourceforge.net/gdcwin/gdc-0.24-gcc-3.4.5.exe

Installed in:
C:\languages\D\GDC

Again I can't see path variable updated, nor any bat file that updates it on
the fly for a specific shell. So what ambient variables do I have to set, and
what paths I do have to add to the 'path' variable to make gdc work? I can't
see docs or helps that list them.

(I have no Perl installed yet, I usually use Python because it's better for
most things, but I may end installing ActivePerl too if it's useful).

I have tried to add most things to the path:

PATH=C:\MinGW;C:\MinGW\bin;C:\MinGW\lib;C:\languages\D\GDC;C:\languages\D\GDC\lib;C:\languages\D\GDC\bin;C:\WINNT;C:\MinGW\lib\gcc\mingw32\3.4.5;

Then I have tried to compile a tiny D Fibonacci program:
gdc fib.d -o fib

But it can't find this:
ld: crtbegin.o: No such file: No such file or directory

Note that crtbegin.o is currently here, in the path:
C:\MinGW\lib\gcc\mingw32\3.4.5

Detailed suggestions are very welcome. If you need more info about the system I
can give it too.

Bye,
bearophile
Nov 24 2007
next sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
bearophile wrote:
 Time again to ask 'dumb' questions (maybe it's just a problem of searching
paths).
 
 So far I have failed in the install of GDC (despite already having MinGW
correctly working, I use it quite often), so I have followed the instructions.
 
 This page:
 http://gdcwin.sourceforge.net/
 
 Says:
 "You need to have regular Minimalist GNU for Windows already installed,"
 
 So I have used this online installer (to install it again ;-) ):
 http://surfnet.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe
 I have chosen to download the make and the C++ compiler.
 
 Even if it's an ugly path, to avoid possible (silly) problems I have accepted
its suggested path:
 C:\MinGW
 
 (I have seen that it adds nothing to the path variable, that's probably wrong
for such installer).
 
 Then I have installed this:
 http://prdownloads.sourceforge.net/gdcwin/gdc-0.24-gcc-3.4.5.exe
 
 Installed in:
 C:\languages\D\GDC
 
 Again I can't see path variable updated, nor any bat file that updates it on
the fly for a specific shell. So what ambient variables do I have to set, and
what paths I do have to add to the 'path' variable to make gdc work? I can't
see docs or helps that list them.
 
 (I have no Perl installed yet, I usually use Python because it's better for
most things, but I may end installing ActivePerl too if it's useful).
 
 I have tried to add most things to the path:
 
 PATH=C:\MinGW;C:\MinGW\bin;C:\MinGW\lib;C:\languages\D\GDC;C:\languages\D\GDC\lib;C:\languages\D\GDC\bin;C:\WINNT;C:\MinGW\lib\gcc\mingw32\3.4.5;
 
 Then I have tried to compile a tiny D Fibonacci program:
 gdc fib.d -o fib
 
 But it can't find this:
 ld: crtbegin.o: No such file: No such file or directory
 
 Note that crtbegin.o is currently here, in the path:
 C:\MinGW\lib\gcc\mingw32\3.4.5
 
 Detailed suggestions are very welcome. If you need more info about the system
I can give it too.
 
 Bye,
 bearophile
I dunno but I would think you'd put lib dirs in a LIB or LIBPATH variable, rather than PATH. Still I'm surprised that it's not finding lib files by default. The mingw installs I've used seem to have the lib path hard-coded into them somehow so that they don't work unless they're in C:\MinGW. So installing it there is probably the right thing to do. I've never made a serious effort to get MinGW GDC working, though. --bb
Nov 24 2007
prev sibling next sibling parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bearophile wrote:
 So I have used this online installer (to install it again ;-) ):
 http://surfnet.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe
 I have chosen to download the make and the C++ compiler.
 
 Even if it's an ugly path, to avoid possible (silly) problems I have accepted
its suggested path:
 C:\MinGW
 
 (I have seen that it adds nothing to the path variable, that's probably wrong
for such installer).
 
 Then I have installed this:
 http://prdownloads.sourceforge.net/gdcwin/gdc-0.24-gcc-3.4.5.exe
 
 Installed in:
 C:\languages\D\GDC
 
That's your problem right there. You can install MinGW wherever you want (although it's probably best to avoid spaces in the path), but you *must* install gdc to the *same* folder. Then add c:\mingw\bin to the path if it didn't do it (can't remember, it's been a while since I installed it), and you should be set. There should be no need to set any other environment variable (at least, I didn't and it works for me). Jerome - -- +------------------------- Jerome M. BERGER ---------------------+ | mailto:jeberger free.fr | ICQ: 238062172 | | http://jeberger.free.fr/ | Jabber: jeberger jabber.fr | +---------------------------------+------------------------------+ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFHSx5bd0kWM4JG3k8RAr/KAJsFinMc0IMMK82npLsHMfdsgheOLgCfW8OV WGEA28cItOJMPKQUQg4IS3M= =iDmT -----END PGP SIGNATURE-----
Nov 26 2007
prev sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Jerome:
 That's your problem right there. You can install MinGW wherever you
 want (although it's probably best to avoid spaces in the path),
 but you *must* install gdc to the *same* folder.
 Then add c:\mingw\bin to the path if it didn't do it
It works, thank you very much :-) As a first test I have tried to benchmark the templated Bitfield accessors: Timings (seconds), n=4_000_000*25: C: 0.80 GDC: 1.30 DMD: 3.18 Compiled with: gcc version 3.4.5 (mingw special) (gdc 0.24, using dmd 1.020) DMD v1.023 gcc version 3.4.2 (mingw-special) Compilation parameters I have used: gcc -O3 -s -finline-functions -ffast-math -fomit-frame-pointer -funroll-loops -march=pentiumpro bitfieldsC.c -o bitfieldsC gdc -O3 -s -frelease -finline-functions -ffast-math -fomit-frame-pointer -funroll-loops -march=pentiumpro bitfieldsD.d -o bitfieldsD2 dmd -O -release -inline bitfieldsD.d And for reference here is the assembly too, it's interesting. ASM from GCC: .file "bitfieldsC.c" .def ___main; .scl 2; .type 32; .endef .data .align 4 LC0: .long 1628676761 .long 1620574103 .long 1237153253 .long 1098880307 .long 87513741 .long 13181925 .long 14686126 .long 7429435 .long 16286706 .long 6474381 .long 4879794 .long 7734725 .long 3745958 .long 13353858 .long 4236193 .long 7587 .long 4309 .long 28846 .long 7313 .long 14516 .long 126 .long 143 .long 171 .long 221 .long 156 .section .rdata,"dr" LC1: .ascii "%d\12\0" .text .p2align 4,,15 .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl $16, %eax movl %esp, %ebp pushl %edi pushl %esi pushl %ebx subl $140, %esp andl $-16, %esp call __alloca call ___main leal -136(%ebp), %eax movl $100, %ecx movl $LC0, %edx movl %ecx, 8(%esp) xorl %esi, %esi xorl %edi, %edi movl %edx, 4(%esp) movl %eax, (%esp) call _memcpy L9: xorl %ebx, %ebx .p2align 4,,15 L8: movl -136(%ebp,%ebx,4), %eax movl -132(%ebp,%ebx,4), %edx movl %eax, %ecx shrl $2, %ecx andl $1, %eax andl $127, %ecx addl %eax, %ecx leal (%esi,%ecx), %ecx movl %edx, %esi movl -128(%ebp,%ebx,4), %eax shrl $2, %esi andl $1, %edx andl $127, %esi addl %edx, %esi addl %esi, %ecx movl -124(%ebp,%ebx,4), %edx movl %eax, %esi shrl $2, %esi andl $1, %eax andl $127, %esi addl %eax, %esi movl %edx, %eax addl %esi, %ecx shrl $2, %eax movl -120(%ebp,%ebx,4), %esi andl $127, %eax andl $1, %edx addl %edx, %eax addl $5, %ebx addl %eax, %ecx movl %esi, %eax shrl $2, %eax andl $1, %esi andl $127, %eax addl %esi, %eax cmpl $24, %ebx leal (%ecx,%eax), %esi jle L8 incl %edi cmpl $3999999, %edi jle L9 movl %esi, 4(%esp) movl $LC1, (%esp) call _printf leal -12(%ebp), %esp xorl %eax, %eax popl %ebx popl %esi popl %edi popl %ebp ret .def _memcpy; .scl 3; .type 32; .endef .def _printf; .scl 3; .type 32; .endef ---------------------- ASM from GDC: .file "bitfieldsD.d" .globl __D34TypeInfo_S10bitfieldsD10INTORFLOAT6__initZ .section .data$_D34TypeInfo_S10bitfieldsD10INTORFLOAT6__initZ,"w" .linkonce same_size .align 4 __D34TypeInfo_S10bitfieldsD10INTORFLOAT6__initZ: .long __D15TypeInfo_Struct6__vtblZ .long 0 .long 21 .long __D34TypeInfo_S10bitfieldsD10INTORFLOAT6__initZ+44 .long 4 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .ascii "bitfieldsD.INTORFLOAT\0" .globl __D10bitfieldsD10INTORFLOAT6__initZ .section .rdata,"dr" .align 4 __D10bitfieldsD10INTORFLOAT6__initZ: .space 4 LC0: .ascii "%d\12\0" .text .p2align 4,,15 .globl __Dmain .def __Dmain; .scl 2; .type 32; .endef __Dmain: pushl %ebp movl $25, %ecx movl $25, %edx pushl %edi xorl %ebp, %ebp xorl %edi, %edi pushl %esi pushl %ebx subl $140, %esp movl %ecx, %ebx movl %edx, 4(%esp) sall $2, %ebx leal 16(%esp), %esi movl $__D11TypeInfo_Ak6__initZ, (%esp) call __d_newarrayT movl $1628676761, (%edx) movl $1620574103, 4(%edx) movl $1237153253, 8(%edx) movl $1098880307, 12(%edx) movl $87513741, 16(%edx) movl $13181925, 20(%edx) movl $14686126, 24(%edx) movl $7429435, 28(%edx) movl $16286706, 32(%edx) movl $6474381, 36(%edx) movl $4879794, 40(%edx) movl $7734725, 44(%edx) movl $3745958, 48(%edx) movl $13353858, 52(%edx) movl $4236193, 56(%edx) movl $7587, 60(%edx) movl $4309, 64(%edx) movl $28846, 68(%edx) movl $7313, 72(%edx) movl $14516, 76(%edx) movl $126, 80(%edx) movl $143, 84(%edx) movl $171, 88(%edx) movl $221, 92(%edx) movl $156, 96(%edx) movl %ebx, 8(%esp) xorl %ebx, %ebx movl %edx, 4(%esp) movl %esi, (%esp) call _memcpy cmpl $4000000, %ebx jge L9 L25: xorl %ecx, %ecx jmp L11 .p2align 4,,7 L23: movl 16(%esp,%ecx,4), %edx xorl %esi, %esi movl %edx, %eax shrl $2, %eax andl $1, %edx andl $127, %eax addl %edx, %eax movl 20(%esp,%ecx,4), %edx addl %eax, %edi adcl %esi, %ebp xorl %esi, %esi movl %edx, %eax shrl $2, %eax andl $1, %edx andl $127, %eax addl %edx, %eax movl 24(%esp,%ecx,4), %edx addl %eax, %edi adcl %esi, %ebp xorl %esi, %esi movl %edx, %eax shrl $2, %eax andl $1, %edx andl $127, %eax addl %edx, %eax movl 28(%esp,%ecx,4), %edx addl %eax, %edi adcl %esi, %ebp xorl %esi, %esi movl %edx, %eax shrl $2, %eax andl $1, %edx andl $127, %eax addl %edx, %eax movl 32(%esp,%ecx,4), %edx addl %eax, %edi adcl %esi, %ebp xorl %esi, %esi movl %edx, %eax shrl $2, %eax andl $1, %edx andl $127, %eax addl %edx, %eax addl %eax, %edi adcl %esi, %ebp addl $5, %ecx L11: cmpl $25, %ecx jl L23 incl %ebx cmpl $4000000, %ebx jl L25 L9: movl %edi, 4(%esp) movl %ebp, 8(%esp) movl $LC0, (%esp) call _printf addl $140, %esp xorl %eax, %eax popl %ebx popl %esi popl %edi popl %ebp ret .section .rdata,"dr" LC1: .ascii "bitfieldsD\0" .globl __D10bitfieldsD12__ModuleInfoZ .data .align 4 __D10bitfieldsD12__ModuleInfoZ: .long 0 .long 0 .long 10 .long LC1 .long 1 .long __D10bitfieldsD12__ModuleInfoZ+48 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long __D3std5stdio12__ModuleInfoZ .align 4 ___mod_ref.0: .long 0 .long __D10bitfieldsD12__ModuleInfoZ .section .ctors,"w" .align 4 .long __D10bitfieldsD9__modinitFZv .text .p2align 4,,15 .globl __D10bitfieldsD10INTORFLOAT4signMFZk .def __D10bitfieldsD10INTORFLOAT4signMFZk; .scl 2; .type 32; .endef __D10bitfieldsD10INTORFLOAT4signMFZk: movl 4(%esp), %eax movl (%eax), %eax andl $1, %eax ret .p2align 4,,15 .globl __D10bitfieldsD10INTORFLOAT4signMFkZv .def __D10bitfieldsD10INTORFLOAT4signMFkZv; .scl 2; .type 32; .endef __D10bitfieldsD10INTORFLOAT4signMFkZv: movl 4(%esp), %eax movl 8(%esp), %ecx movl (%eax), %edx andl $1, %ecx andl $-2, %edx orl %ecx, %edx movl %edx, (%eax) ret .p2align 4,,15 .globl __D10bitfieldsD10INTORFLOAT14biasedexponentMFZk .def __D10bitfieldsD10INTORFLOAT14biasedexponentMFZk; .scl 2; .type 32; .endef __D10bitfieldsD10INTORFLOAT14biasedexponentMFZk: movl 4(%esp), %eax movl (%eax), %eax shrl %eax andl $255, %eax ret .p2align 4,,15 .globl __D10bitfieldsD10INTORFLOAT14biasedexponentMFkZv .def __D10bitfieldsD10INTORFLOAT14biasedexponentMFkZv; .scl 2; .type 32; .endef __D10bitfieldsD10INTORFLOAT14biasedexponentMFkZv: movzbl 8(%esp), %eax movl 4(%esp), %ecx movl (%ecx), %edx addl %eax, %eax andl $-511, %edx orl %eax, %edx movl %edx, (%ecx) ret .p2align 4,,15 .globl __D10bitfieldsD10INTORFLOAT11significandMFZk .def __D10bitfieldsD10INTORFLOAT11significandMFZk; .scl 2; .type 32; .endef __D10bitfieldsD10INTORFLOAT11significandMFZk: movl 4(%esp), %eax movl (%eax), %eax shrl $9, %eax ret .p2align 4,,15 .globl __D10bitfieldsD10INTORFLOAT11significandMFkZv .def __D10bitfieldsD10INTORFLOAT11significandMFkZv; .scl 2; .type 32; .endef __D10bitfieldsD10INTORFLOAT11significandMFkZv: movl 4(%esp), %ecx movl 8(%esp), %eax movl (%ecx), %edx andl $8388607, %eax sall $9, %eax andl $511, %edx orl %eax, %edx movl %edx, (%ecx) ret .p2align 4,,15 .def __D10bitfieldsD9__modinitFZv; .scl 3; .type 32; .endef __D10bitfieldsD9__modinitFZv: movl __Dmodule_ref, %eax movl $___mod_ref.0, %edx movl %edx, __Dmodule_ref movl %eax, ___mod_ref.0 ret .def _memcpy; .scl 2; .type 32; .endef Bye, bearophile
Nov 28 2007
parent 0ffh <frank frankhirsch.youknow.what.todo.net> writes:
bearophile wrote:
 Jerome:
 That's your problem right there. You can install MinGW wherever you
 want (although it's probably best to avoid spaces in the path),
 but you *must* install gdc to the *same* folder.
 Then add c:\mingw\bin to the path if it didn't do it
It works, thank you very much :-) As a first test I have tried to benchmark the templated Bitfield accessors: Timings (seconds), n=4_000_000*25: [...]
Nice, thanks for the info! But, now of course I wonder how D2.Phobos' templates compare... =) regards, frank
Nov 28 2007