www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - native dmd and cygwin

reply Bruce Adams <tortoise_74 yahoo.co.uk> writes:
Hi,
   I've been trying to get started with D on windows. As a long time cygwin
user I first tried gdc, but I've been stumped by a compiler crash
with forward declarations see:
   http://d.puremagic.com/issues/show_bug.cgi?id=1325

So I have tried using dmc/dmd instead. There seems to be some kind of
environment clash. I've tried setting PATH, LIB and LINKCMD as documented on
but there is clearly something I'm missing. I suspect a documentation bug (i.e.
there is at least one other important var).

(note: running in DOS but with cygwin on path)
F:\projects>c:\cygwin\bin\make dtest2
dmc hello.d -o hello
c:\dmd\bin\..\..\dm\bin\link.exe hello,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

phobos.lib
 Warning 2: File Not Found phobos.lib
OPTLINK : Warning 23: No Stack
hello.obj(hello)
 Error 42: Symbol Undefined _main
hello.obj(hello)
 Error 42: Symbol Undefined __acrtused_con
OPTLINK : Warning 134: No Start Address
--- errorlevel 2
hello.d:
--- errorlevel 2
make: *** [dtest2] Error 2

If instead of using my normal cygwin friendly DOS prompt I use a plain one I
can get the samples to compile using shell all.sh as documented
on http://www.digitalmars.com/d/dcompiler.html. I've played with bud/build with
similar results. Anyone know what the critical setting(s) I'm missing is? 

Regards,

Bruce.
Jul 09 2007
parent reply Bruce Adams <tortoise_74 spam.me.not.yahoo.co.uk> writes:
Just to clarify here is a working environment:

F:\projects\Agenda>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Bruce\Application Data
CLASSPATH=.;C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=LIONHEART
ComSpec=C:\WINDOWS\system32\cmd.exe
CYGWIN=binmode ntsec tty
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Bruce
LIB=c:\dmd\lib;c:\dm\lib
LOGONSERVER=\\LIONHEART
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=c:\dmd\bin;c:\dm\bin;c:\cygwin\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl;.py;.pyw
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 47 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=2f02
ProgramFiles=C:\Program Files
PROMPT=$P$G
QTJAVA=C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\Bruce\LOCALS~1\Temp
TMP=C:\DOCUME~1\Bruce\LOCALS~1\Temp
USERDOMAIN=LIONHEART
USERNAME=Bruce
USERPROFILE=C:\Documents and Settings\Bruce
windir=C:\WINDOWS
__COMPAT_LAYER=EnableNXShowUI

F:\projects\Agenda>c:\cygwin\bin\make dtest2
dmc hello.d -o hello
c:\dmd\bin\..\..\dm\bin\link.exe hello,,,user32+kernel32/noi;
c:\dmd\bin\..\..\dm\bin\link.exe hello,,,user32+kernel32/noi;
hello.d:
hello.d:
link hello+hello,,,user32+kernel32/noi;

And a non-working environment which has the documented LINKCMD, LIB and PATH
but not the magic exlixir:

F:\projects\Agenda>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Bruce\Application Data
CLASSPATH=.;C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=LIONHEART
ComSpec=C:\WINDOWS\system32\cmd.exe
CVSROOT=:local:F:\projects\cvsroot
CYGROOT=C:
CYGTYPE=cygwin
CYGWIN=binmode ntsec tty
FP_NO_HOST_CHECK=NO
GCCINCDIR=C:\cygwin\usr\include;C:\cygwin\usr\include\sys;C:\cygwin\usr\include\
w32api;C:\cygwin\usr\local\i686-pc-cygwin\include;C:\cygwin\usr\local\i686-pc-cy
gwin\include\sys;C:\cygwin\usr\include\c++\3.4.4;C:\cygwin\usr\include\c++\3.4.4
\i686-pc-cygwin;C:\cygwin\usr\include\c++\3.4.4\i686-pc-cygwin\bits;C:\cygwin\li
b\gcc-lib\i686-pc-cygwin\3.4.4\include;C:\cygwin\usr\include;C:\cygwin\usr\inclu
de\sys;C:\cygwin\usr\include\w32api;C:\cygwin\usr\local\i686-pc-cygwin\include;C
:\cygwin\usr\local\i686-pc-cygwin\include\sys;C:\cygwin\usr\include\c++\3.4.4;C:
\cygwin\usr\include\c++\3.4.4\i686-pc-cygwin;C:\cygwin\usr\include\c++\3.4.4\i68
6-pc-cygwin\bits;C:\cygwin\lib\gcc\i686-pc-cygwin\C:\cygwin\usr\include;C:\cygwi
n\usr\include\sys;C:\cygwin\usr\include\w32api;C:\cygwin\usr\local\i686-pc-cygwi
n\include;C:\cygwin\usr\local\i686-pc-cygwin\include\sys;C:\cygwin\usr\include\c
++\3.4.4;C:\cygwin\usr\include\c++\3.4.4\i686-pc-cygwin;C:\cygwin\usr\include\c+
+\3.4.4\i686-pc-cygwin\bits;C:\cygwin\lib\gcc-lib\i686-pc-cygwin\3.4.4\include;C
:\cygwin\usr\include;C:\cygwin\usr\include\sys;C:\cygwin\usr\include\w32api;C:\c
ygwin\usr\local\i686-pc-cygwin\include;C:\cygwin\usr\local\i686-pc-cygwin\includ
e\sys;C:\cygwin\usr\include\c++\3.4.4;C:\cygwin\usr\include\c++\3.4.4\i686-pc-cy
gwin;C:\cygwin\usr\include\c++\3.4.4\i686-pc-cygwin\bits\include;C:\cygwin\lib\g
cc\i686-pc-cygwin\3.4.4\include\c++;;C:\cygwin\lib\gcc\i686-pc-cygwin\3.4.4\incl
ude\c++\i686-pc-cygwin;C:\cygwin\lib\gcc\i686-pc-cygwin\3.4.4\include
GCCVERSION=3.4.4
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Bruce
LIB=c:\dmd\lib;c:\dm\lib
LINKCMD=c:\dm\bin\link
LOGNAME=brucea
LOGONSERVER=\\LIONHEART
MAKE_MODE=UNIX
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=c:\dmd\bin;c:\dm\bin;c:\cygwin\bin
PATHEXT=.bat;.tcx;.tcl;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl;.py
;.pyw
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 47 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=2f02
ProgramFiles=C:\Program Files
PROJECTDIR=f:\projects
PROMPT=$P$G
QTJAVA=C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip
RCSINIT=-x,v
SESSIONNAME=Console
SVN_EDITOR="c:\program files\windows NT\accessories\wordpad.exe"
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\Bruce\LOCALS~1\Temp
TMP=C:\DOCUME~1\Bruce\LOCALS~1\Temp
USER=BSA
USERDOMAIN=LIONHEART
USERNAME=brucea
USERPROFILE=C:\Documents and Settings\Bruce
VCBIN=c:\\vc\\bin
VCINC=c:\\vc\\include
VCLIB=c:\\vc\\lib
VPATH=f:\projects\introspection\RCS
windir=C:\WINDOWS
WXWIN=F:\projects\wxwindows
__COMPAT_LAYER=EnableNXShowUI

F:\projects\Agenda>c:\cygwin\bin\make dtest2
dmc hello.d -o hello
c:\dmd\bin\..\..\dm\bin\link.exe hello,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

phobos.lib
 Warning 2: File Not Found phobos.lib
OPTLINK : Warning 23: No Stack
hello.obj(hello)
 Error 42: Symbol Undefined _main
hello.obj(hello)
 Error 42: Symbol Undefined __acrtused_con
OPTLINK : Warning 134: No Start Address
--- errorlevel 2
hello.d:
--- errorlevel 2
make: *** [dtest2] Error 2

What is wrong with environment 2? 

Bruce Adams Wrote:

 Hi,
    I've been trying to get started with D on windows. As a long time cygwin
user I first tried gdc, but I've been stumped by a compiler crash
 with forward declarations see:
    http://d.puremagic.com/issues/show_bug.cgi?id=1325
 
 So I have tried using dmc/dmd instead. There seems to be some kind of
environment clash. I've tried setting PATH, LIB and LINKCMD as documented on
but there is clearly something I'm missing. I suspect a documentation bug (i.e.
there is at least one other important var).
 
 (note: running in DOS but with cygwin on path)
 F:\projects>c:\cygwin\bin\make dtest2
 dmc hello.d -o hello
 c:\dmd\bin\..\..\dm\bin\link.exe hello,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 phobos.lib
  Warning 2: File Not Found phobos.lib
 OPTLINK : Warning 23: No Stack
 hello.obj(hello)
  Error 42: Symbol Undefined _main
 hello.obj(hello)
  Error 42: Symbol Undefined __acrtused_con
 OPTLINK : Warning 134: No Start Address
 --- errorlevel 2
 hello.d:
 --- errorlevel 2
 make: *** [dtest2] Error 2
 
 If instead of using my normal cygwin friendly DOS prompt I use a plain one I
can get the samples to compile using shell all.sh as documented
 on http://www.digitalmars.com/d/dcompiler.html. I've played with bud/build
with similar results. Anyone know what the critical setting(s) I'm missing is? 
 
 Regards,
 
 Bruce.
 
Jul 09 2007
parent Bruce Adams <tortoise_74 spam.me.not.yahoo.co.uk> writes:
I have a partial explanation. The critical variable is GCCINCDIR. Its value is
too long. A shorter value does not kill DMD. I have entered this as a bug. -
http://d.puremagic.com/issues/show_bug.cgi?id=1327
Jul 09 2007