www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - SCons?

reply Jason Jasmin <zod269-d yahoo.com> writes:
I've got a question regarding D and SCons -- and since I saw the author 
for the D module in SCons hangs out here, hopefully I can get an answer :)

I've never used SCons before, but it looks really nice and wanted to 
give it a whirl. However, I have had very little luck getting it to 
actually work.

I made an SConstruct file that looked like:

Program('pi.d')

Which didn't work. SCons tried to compile pi.d with gcc. After searching 
the SCons mailing lists, I came up with the following (this is from 
memory, but it should be fairly close):

env = Enviroment(tools=['Default', 'dmd'])
env.Program('pi.d')

which will recognize the file as a D file, and compile it using dmd. 
However, it won't link it :(

Could any kind soul please post a simple, working SConscript file that I 
can use as a template to get stuff going?

Thanks,

Jason Jasmin
Jan 06 2005
next sibling parent reply Brad Anderson <brad dsource.dot.org> writes:
Here's one that the author of SCons for D (Andy Friesen) modified a few 
days ago:

http://trac.dsource.org/projects/dwt/file/trunk/src/SConstruct

It's long, because the project has some size to it, but maybe you could 
boil it down.  I'll look around for a smaller one, too.

BA


Jason Jasmin wrote:
 I've got a question regarding D and SCons -- and since I saw the author 
 for the D module in SCons hangs out here, hopefully I can get an answer :)
 
 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.
 
 I made an SConstruct file that looked like:
 
 Program('pi.d')
 
 Which didn't work. SCons tried to compile pi.d with gcc. After searching 
 the SCons mailing lists, I came up with the following (this is from 
 memory, but it should be fairly close):
 
 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')
 
 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(
 
 Could any kind soul please post a simple, working SConscript file that I 
 can use as a template to get stuff going?
 
 Thanks,
 
 Jason Jasmin

Jan 06 2005
parent reply Jason Jasmin <zod269-d yahoo.com> writes:
I downloaded the latest dwt from svn and tried to build it, but it still 
doesn't work for me :( I'm running RHEL 3 with python 2.2.3 and the 
latest scons, and it initially complained about the

if 'win32' in sys.platform:

line, with the following error:

scons: Reading SConscript files ...
TypeError: 'in <string>' requires character as left operand:
   File "SConstruct", line 21:
     if 'win32' in sys.platform:

I removed the win32 stuff, and it ran, at least :) But then I get:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o HelloDWT dwt/dwt.d dwt/accessibility/accessible.d 
dwt/accessibility/acc.d dwt/internal/win32/tchar.d 
dwt/internal/win32/os.d dwt/internal/win32/types.d 
dwt/internal/win32/func.d dwt/internal/platform.d 
dwt/internal/cloneablecompatibility.d dwt/internal/library.d 
dwt/internal/ttypes.d dwt/internal/serializablecompatibility.d 
dwt/internal/callbacktable.d dwt/internal/dwteventlistener.d 
dwt/internal/dwteventobject.d dwt/internal/compatibility.d 
dwt/internal/callback.d dwt/util/runnable.d dwt/util/util.d 
dwt/util/system.d dwt/util/throwable.d dwt/util/string.d 
dwt/util/eventlistener.d dwt/util/eventobject.d dwt/graphics/gc.d 
dwt/graphics/fontmetrics.d dwt/graphics/device.d dwt/graphics/fontdata.d 
dwt/graphics/rectangle.d dwt/graphics/font.d dwt/graphics/imageloader.d 
dwt/graphics/rgb.d dwt/graphics/imagedata.d dwt/graphics/cursor.d 
dwt/graphics/color.d dwt/graphics/image.d dwt/graphics/gcdata.d 
dwt/graphics/region.d dwt/graphics/palettedata.d dwt/graphics/point.d 
dwt/graphics/devicedata.d dwt/graphics/IDrawable.d 
dwt/events/disposelistener.d dwt/events/modifylistener.d 
dwt/events/traverseevent.d dwt/events/mouselistener.d 
dwt/events/helplistener.d dwt/events/keylistener.d 
dwt/events/treeevent.d dwt/events/menuadapter.d 
dwt/events/disposeevent.d dwt/events/shellevent.d 
dwt/events/mousetrackadapter.d dwt/events/paintlistener.d 
dwt/events/focusevent.d dwt/events/controlevent.d 
dwt/events/mousetracklistener.d dwt/events/mousemovelistener.d 
dwt/events/armlistener.d dwt/events/controllistener.d 
dwt/events/selectionevent.d dwt/events/typedevent.d 
dwt/events/modifyevent.d dwt/events/mouseadapter.d 
dwt/events/keyadapter.d dwt/events/treeadapter.d 
dwt/events/traverselistener.d dwt/events/treelistener.d 
dwt/events/menuevent.d dwt/events/verifyevent.d 
dwt/events/shelladapter.d dwt/events/verifylistener.d 
dwt/events/menulistener.d dwt/events/paintevent.d 
dwt/events/shelllistener.d dwt/events/focusadapter.d 
dwt/events/armevent.d dwt/events/controladapter.d 
dwt/events/focuslistener.d dwt/events/selectionadapter.d 
dwt/events/mouseevent.d dwt/events/helpevent.d dwt/events/keyevent.d 
dwt/events/selectionlistener.d dwt/widgets/synchronizer.d 
dwt/widgets/caret.d dwt/widgets/item.d dwt/widgets/composite.d 
dwt/widgets/menu.d dwt/widgets/display.d dwt/widgets/shell.d 
dwt/widgets/decorations.d dwt/widgets/canvas.d dwt/widgets/button.d 
dwt/widgets/layout.d dwt/widgets/imagelist.d dwt/widgets/runnablelock.d 
dwt/widgets/control.d dwt/widgets/event.d dwt/widgets/scrollable.d 
dwt/widgets/scrollbar.d dwt/widgets/menuitem.d dwt/widgets/widget.d 
dwt/widgets/listener.d dwt/widgets/monitor.d dwt/widgets/eventtable.d 
dwt/widgets/typedlistener.d HelloDWT.d
/usr/bin/ld:dwt/dwt.d: file format not recognized; treating as linker script
/usr/bin/ld:dwt/dwt.d:22: syntax error
collect2: ld returned 1 exit status
scons: *** [HelloDWT] Error 1
scons: building terminated because of errors.

... which is the same problem I originally had, where it's not 
recognizing .d files as D source code.

I have to be doing something stupidly wrong :) But I'm not sure what, 
this is a clean install of scons straight from the RPM.

Jason

Brad Anderson wrote:
 Here's one that the author of SCons for D (Andy Friesen) modified a few 
 days ago:
 
 http://trac.dsource.org/projects/dwt/file/trunk/src/SConstruct
 
 It's long, because the project has some size to it, but maybe you could 
 boil it down.  I'll look around for a smaller one, too.
 
 BA
 
 
 Jason Jasmin wrote:
 
 I've got a question regarding D and SCons -- and since I saw the 
 author for the D module in SCons hangs out here, hopefully I can get 
 an answer :)

 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.

 I made an SConstruct file that looked like:

 Program('pi.d')

 Which didn't work. SCons tried to compile pi.d with gcc. After 
 searching the SCons mailing lists, I came up with the following (this 
 is from memory, but it should be fairly close):

 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')

 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(

 Could any kind soul please post a simple, working SConscript file that 
 I can use as a template to get stuff going?

 Thanks,

 Jason Jasmin


Jan 06 2005
parent reply Brad Anderson <brad dsource.dot.org> writes:
All work on DWT to date (except for a very little bit) has been targeted 
to the Win32 platform.  And even that is very early as far as readiness 
to compile and even work.  The project was stalled due to some time 
constraints as well as DMD compiler issues that may have been resolved 
recently.

Once we get Win32 working, then we'd start to focus on GTK for Linux. 
But DWT is a long way off, I'm afraid.  Check the forums for more info 
on the status...

BA

Jason Jasmin wrote:

 I downloaded the latest dwt from svn and tried to build it, but it still 
 doesn't work for me :( I'm running RHEL 3 with python 2.2.3 and the 
 latest scons, and it initially complained about the
 
 if 'win32' in sys.platform:
 
 line, with the following error:
 
 scons: Reading SConscript files ...
 TypeError: 'in <string>' requires character as left operand:
   File "SConstruct", line 21:
     if 'win32' in sys.platform:
 
 I removed the win32 stuff, and it ran, at least :) But then I get:
 
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 gcc -o HelloDWT dwt/dwt.d dwt/accessibility/accessible.d 
 dwt/accessibility/acc.d dwt/internal/win32/tchar.d 
 dwt/internal/win32/os.d dwt/internal/win32/types.d 
 dwt/internal/win32/func.d dwt/internal/platform.d 
 dwt/internal/cloneablecompatibility.d dwt/internal/library.d 
 dwt/internal/ttypes.d dwt/internal/serializablecompatibility.d 
 dwt/internal/callbacktable.d dwt/internal/dwteventlistener.d 
 dwt/internal/dwteventobject.d dwt/internal/compatibility.d 
 dwt/internal/callback.d dwt/util/runnable.d dwt/util/util.d 
 dwt/util/system.d dwt/util/throwable.d dwt/util/string.d 
 dwt/util/eventlistener.d dwt/util/eventobject.d dwt/graphics/gc.d 
 dwt/graphics/fontmetrics.d dwt/graphics/device.d dwt/graphics/fontdata.d 
 dwt/graphics/rectangle.d dwt/graphics/font.d dwt/graphics/imageloader.d 
 dwt/graphics/rgb.d dwt/graphics/imagedata.d dwt/graphics/cursor.d 
 dwt/graphics/color.d dwt/graphics/image.d dwt/graphics/gcdata.d 
 dwt/graphics/region.d dwt/graphics/palettedata.d dwt/graphics/point.d 
 dwt/graphics/devicedata.d dwt/graphics/IDrawable.d 
 dwt/events/disposelistener.d dwt/events/modifylistener.d 
 dwt/events/traverseevent.d dwt/events/mouselistener.d 
 dwt/events/helplistener.d dwt/events/keylistener.d 
 dwt/events/treeevent.d dwt/events/menuadapter.d 
 dwt/events/disposeevent.d dwt/events/shellevent.d 
 dwt/events/mousetrackadapter.d dwt/events/paintlistener.d 
 dwt/events/focusevent.d dwt/events/controlevent.d 
 dwt/events/mousetracklistener.d dwt/events/mousemovelistener.d 
 dwt/events/armlistener.d dwt/events/controllistener.d 
 dwt/events/selectionevent.d dwt/events/typedevent.d 
 dwt/events/modifyevent.d dwt/events/mouseadapter.d 
 dwt/events/keyadapter.d dwt/events/treeadapter.d 
 dwt/events/traverselistener.d dwt/events/treelistener.d 
 dwt/events/menuevent.d dwt/events/verifyevent.d 
 dwt/events/shelladapter.d dwt/events/verifylistener.d 
 dwt/events/menulistener.d dwt/events/paintevent.d 
 dwt/events/shelllistener.d dwt/events/focusadapter.d 
 dwt/events/armevent.d dwt/events/controladapter.d 
 dwt/events/focuslistener.d dwt/events/selectionadapter.d 
 dwt/events/mouseevent.d dwt/events/helpevent.d dwt/events/keyevent.d 
 dwt/events/selectionlistener.d dwt/widgets/synchronizer.d 
 dwt/widgets/caret.d dwt/widgets/item.d dwt/widgets/composite.d 
 dwt/widgets/menu.d dwt/widgets/display.d dwt/widgets/shell.d 
 dwt/widgets/decorations.d dwt/widgets/canvas.d dwt/widgets/button.d 
 dwt/widgets/layout.d dwt/widgets/imagelist.d dwt/widgets/runnablelock.d 
 dwt/widgets/control.d dwt/widgets/event.d dwt/widgets/scrollable.d 
 dwt/widgets/scrollbar.d dwt/widgets/menuitem.d dwt/widgets/widget.d 
 dwt/widgets/listener.d dwt/widgets/monitor.d dwt/widgets/eventtable.d 
 dwt/widgets/typedlistener.d HelloDWT.d
 /usr/bin/ld:dwt/dwt.d: file format not recognized; treating as linker 
 script
 /usr/bin/ld:dwt/dwt.d:22: syntax error
 collect2: ld returned 1 exit status
 scons: *** [HelloDWT] Error 1
 scons: building terminated because of errors.
 
 ... which is the same problem I originally had, where it's not 
 recognizing .d files as D source code.
 
 I have to be doing something stupidly wrong :) But I'm not sure what, 
 this is a clean install of scons straight from the RPM.
 
 Jason
 
 Brad Anderson wrote:
 
 Here's one that the author of SCons for D (Andy Friesen) modified a 
 few days ago:

 http://trac.dsource.org/projects/dwt/file/trunk/src/SConstruct

 It's long, because the project has some size to it, but maybe you 
 could boil it down.  I'll look around for a smaller one, too.

 BA


 Jason Jasmin wrote:

 I've got a question regarding D and SCons -- and since I saw the 
 author for the D module in SCons hangs out here, hopefully I can get 
 an answer :)

 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.

 I made an SConstruct file that looked like:

 Program('pi.d')

 Which didn't work. SCons tried to compile pi.d with gcc. After 
 searching the SCons mailing lists, I came up with the following (this 
 is from memory, but it should be fairly close):

 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')

 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(

 Could any kind soul please post a simple, working SConscript file 
 that I can use as a template to get stuff going?

 Thanks,

 Jason Jasmin



Jan 06 2005
parent reply Jason Jasmin <zod269-d yahoo.com> writes:
I wasn't trying to get DWT to work, per se. I just wanted to see if I 
could get it to build, using the SConstruct file that shipped with it. 
Alas, no luck :(

Brad Anderson wrote:
 All work on DWT to date (except for a very little bit) has been targeted 
 to the Win32 platform.  And even that is very early as far as readiness 
 to compile and even work.  The project was stalled due to some time 
 constraints as well as DMD compiler issues that may have been resolved 
 recently.
 
 Once we get Win32 working, then we'd start to focus on GTK for Linux. 
 But DWT is a long way off, I'm afraid.  Check the forums for more info 
 on the status...
 
 BA
 
 Jason Jasmin wrote:
 
 I downloaded the latest dwt from svn and tried to build it, but it 
 still doesn't work for me :( I'm running RHEL 3 with python 2.2.3 and 
 the latest scons, and it initially complained about the

 if 'win32' in sys.platform:

 line, with the following error:

 scons: Reading SConscript files ...
 TypeError: 'in <string>' requires character as left operand:
   File "SConstruct", line 21:
     if 'win32' in sys.platform:

 I removed the win32 stuff, and it ran, at least :) But then I get:

 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 gcc -o HelloDWT dwt/dwt.d dwt/accessibility/accessible.d 
 dwt/accessibility/acc.d dwt/internal/win32/tchar.d 
 dwt/internal/win32/os.d dwt/internal/win32/types.d 
 dwt/internal/win32/func.d dwt/internal/platform.d 
 dwt/internal/cloneablecompatibility.d dwt/internal/library.d 
 dwt/internal/ttypes.d dwt/internal/serializablecompatibility.d 
 dwt/internal/callbacktable.d dwt/internal/dwteventlistener.d 
 dwt/internal/dwteventobject.d dwt/internal/compatibility.d 
 dwt/internal/callback.d dwt/util/runnable.d dwt/util/util.d 
 dwt/util/system.d dwt/util/throwable.d dwt/util/string.d 
 dwt/util/eventlistener.d dwt/util/eventobject.d dwt/graphics/gc.d 
 dwt/graphics/fontmetrics.d dwt/graphics/device.d 
 dwt/graphics/fontdata.d dwt/graphics/rectangle.d dwt/graphics/font.d 
 dwt/graphics/imageloader.d dwt/graphics/rgb.d dwt/graphics/imagedata.d 
 dwt/graphics/cursor.d dwt/graphics/color.d dwt/graphics/image.d 
 dwt/graphics/gcdata.d dwt/graphics/region.d dwt/graphics/palettedata.d 
 dwt/graphics/point.d dwt/graphics/devicedata.d 
 dwt/graphics/IDrawable.d dwt/events/disposelistener.d 
 dwt/events/modifylistener.d dwt/events/traverseevent.d 
 dwt/events/mouselistener.d dwt/events/helplistener.d 
 dwt/events/keylistener.d dwt/events/treeevent.d 
 dwt/events/menuadapter.d dwt/events/disposeevent.d 
 dwt/events/shellevent.d dwt/events/mousetrackadapter.d 
 dwt/events/paintlistener.d dwt/events/focusevent.d 
 dwt/events/controlevent.d dwt/events/mousetracklistener.d 
 dwt/events/mousemovelistener.d dwt/events/armlistener.d 
 dwt/events/controllistener.d dwt/events/selectionevent.d 
 dwt/events/typedevent.d dwt/events/modifyevent.d 
 dwt/events/mouseadapter.d dwt/events/keyadapter.d 
 dwt/events/treeadapter.d dwt/events/traverselistener.d 
 dwt/events/treelistener.d dwt/events/menuevent.d 
 dwt/events/verifyevent.d dwt/events/shelladapter.d 
 dwt/events/verifylistener.d dwt/events/menulistener.d 
 dwt/events/paintevent.d dwt/events/shelllistener.d 
 dwt/events/focusadapter.d dwt/events/armevent.d 
 dwt/events/controladapter.d dwt/events/focuslistener.d 
 dwt/events/selectionadapter.d dwt/events/mouseevent.d 
 dwt/events/helpevent.d dwt/events/keyevent.d 
 dwt/events/selectionlistener.d dwt/widgets/synchronizer.d 
 dwt/widgets/caret.d dwt/widgets/item.d dwt/widgets/composite.d 
 dwt/widgets/menu.d dwt/widgets/display.d dwt/widgets/shell.d 
 dwt/widgets/decorations.d dwt/widgets/canvas.d dwt/widgets/button.d 
 dwt/widgets/layout.d dwt/widgets/imagelist.d 
 dwt/widgets/runnablelock.d dwt/widgets/control.d dwt/widgets/event.d 
 dwt/widgets/scrollable.d dwt/widgets/scrollbar.d 
 dwt/widgets/menuitem.d dwt/widgets/widget.d dwt/widgets/listener.d 
 dwt/widgets/monitor.d dwt/widgets/eventtable.d 
 dwt/widgets/typedlistener.d HelloDWT.d
 /usr/bin/ld:dwt/dwt.d: file format not recognized; treating as linker 
 script
 /usr/bin/ld:dwt/dwt.d:22: syntax error
 collect2: ld returned 1 exit status
 scons: *** [HelloDWT] Error 1
 scons: building terminated because of errors.

 ... which is the same problem I originally had, where it's not 
 recognizing .d files as D source code.

 I have to be doing something stupidly wrong :) But I'm not sure what, 
 this is a clean install of scons straight from the RPM.

 Jason

 Brad Anderson wrote:

 Here's one that the author of SCons for D (Andy Friesen) modified a 
 few days ago:

 http://trac.dsource.org/projects/dwt/file/trunk/src/SConstruct

 It's long, because the project has some size to it, but maybe you 
 could boil it down.  I'll look around for a smaller one, too.

 BA


 Jason Jasmin wrote:

 I've got a question regarding D and SCons -- and since I saw the 
 author for the D module in SCons hangs out here, hopefully I can get 
 an answer :)

 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.

 I made an SConstruct file that looked like:

 Program('pi.d')

 Which didn't work. SCons tried to compile pi.d with gcc. After 
 searching the SCons mailing lists, I came up with the following 
 (this is from memory, but it should be fairly close):

 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')

 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(

 Could any kind soul please post a simple, working SConscript file 
 that I can use as a template to get stuff going?

 Thanks,

 Jason Jasmin




Jan 06 2005
parent Brad Anderson <brad dsource.dot.org> writes:
Jason Jasmin wrote:

 I wasn't trying to get DWT to work, per se. I just wanted to see if I 
 could get it to build, using the SConstruct file that shipped with it. 
 Alas, no luck :(
 

gotcha. I think Andy was getting it to compile with this SConstruct, but then it segfaulted in HelloDWT.d somewhere. All of this was on Win32...
Jan 06 2005
prev sibling parent reply teqDruid <me teqdruid.com> writes:
A simple file like that works fine for me (just the Program line).  Two
points, however:
1)DMD support hasn't been in SCons for that many releases.  I'm using
v0.96.1... Get the latest version and try it again.
2)On linux, SCons will invoke gcc to link, so you should see a gcc line.

The output for a simple compile (on linux) looks like this:
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
dmd -I. -c -oftest.o test.d
gcc -o test test.o -lphobos -lpthread
scons: done building targets.

I don't know anything about the windows stuff.

SCons is great.  I use it for all of my projects.  It's much cleaner than
Makefiles (which probably isn't saying a lot) and it figures out how to do
clean-ups on it's own.  I'll generally write SConstruct files for all of
the D projects I'm trying to compile (even large ones that aren't mine) if
the Makefile that comes with them doesn't work off the bat... I can't work
with Makefiles anymore since SCons has me so spoiled.

John

On Thu, 06 Jan 2005 10:57:39 -0500, Jason Jasmin wrote:

 I've got a question regarding D and SCons -- and since I saw the author 
 for the D module in SCons hangs out here, hopefully I can get an answer :)
 
 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.
 
 I made an SConstruct file that looked like:
 
 Program('pi.d')
 
 Which didn't work. SCons tried to compile pi.d with gcc. After searching 
 the SCons mailing lists, I came up with the following (this is from 
 memory, but it should be fairly close):
 
 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')
 
 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(
 
 Could any kind soul please post a simple, working SConscript file that I 
 can use as a template to get stuff going?
 
 Thanks,
 
 Jason Jasmin

Jan 06 2005
parent reply Jason Jasmin <zod269-d yahoo.com> writes:
I'm using the latest and greatest scons, installed from the RPM 
distribution on a FC3 box:

SCons by Steven Knight et al.:
         script: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
         engine: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation

--------

I'm wondering if I am missing something here -- from what I read of 
SCons, it *should* be as easy as a Program() line. This SConstruct file:

Program('dhry.d')

gives the following output:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o dhry dhry.d
/usr/bin/ld:dhry.d: file format not recognized; treating as linker script
/usr/bin/ld:dhry.d:335: syntax error
collect2: ld returned 1 exit status
scons: *** [dhry] Error 1
scons: building terminated because of errors.


As you can see, it is trying to compile dhry.d with gcc :( I am 
wondering if there is something goofy with the RPM version of SCons, 
because I have tried this on two different (clean!) boxes with the same 
result. I'll grab a tarball and see if it works any differently.

Jason



teqDruid wrote:
 A simple file like that works fine for me (just the Program line).  Two
 points, however:
 1)DMD support hasn't been in SCons for that many releases.  I'm using
 v0.96.1... Get the latest version and try it again.
 2)On linux, SCons will invoke gcc to link, so you should see a gcc line.
 
 The output for a simple compile (on linux) looks like this:
 $ scons
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 dmd -I. -c -oftest.o test.d
 gcc -o test test.o -lphobos -lpthread
 scons: done building targets.
 
 I don't know anything about the windows stuff.
 
 SCons is great.  I use it for all of my projects.  It's much cleaner than
 Makefiles (which probably isn't saying a lot) and it figures out how to do
 clean-ups on it's own.  I'll generally write SConstruct files for all of
 the D projects I'm trying to compile (even large ones that aren't mine) if
 the Makefile that comes with them doesn't work off the bat... I can't work
 with Makefiles anymore since SCons has me so spoiled.
 
 John
 
 On Thu, 06 Jan 2005 10:57:39 -0500, Jason Jasmin wrote:
 
 
I've got a question regarding D and SCons -- and since I saw the author 
for the D module in SCons hangs out here, hopefully I can get an answer :)

I've never used SCons before, but it looks really nice and wanted to 
give it a whirl. However, I have had very little luck getting it to 
actually work.

I made an SConstruct file that looked like:

Program('pi.d')

Which didn't work. SCons tried to compile pi.d with gcc. After searching 
the SCons mailing lists, I came up with the following (this is from 
memory, but it should be fairly close):

env = Enviroment(tools=['Default', 'dmd'])
env.Program('pi.d')

which will recognize the file as a D file, and compile it using dmd. 
However, it won't link it :(

Could any kind soul please post a simple, working SConscript file that I 
can use as a template to get stuff going?

Thanks,

Jason Jasmin


Jan 06 2005
parent reply Jason Jasmin <zod269-d yahoo.com> writes:
Just tried the tarball version, same problems :(

Jason Jasmin wrote:
 I'm using the latest and greatest scons, installed from the RPM 
 distribution on a FC3 box:
 
 SCons by Steven Knight et al.:
         script: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
         engine: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
 Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
 
 --------
 
 I'm wondering if I am missing something here -- from what I read of 
 SCons, it *should* be as easy as a Program() line. This SConstruct file:
 
 Program('dhry.d')
 
 gives the following output:
 
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 gcc -o dhry dhry.d
 /usr/bin/ld:dhry.d: file format not recognized; treating as linker script
 /usr/bin/ld:dhry.d:335: syntax error
 collect2: ld returned 1 exit status
 scons: *** [dhry] Error 1
 scons: building terminated because of errors.
 
 
 As you can see, it is trying to compile dhry.d with gcc :( I am 
 wondering if there is something goofy with the RPM version of SCons, 
 because I have tried this on two different (clean!) boxes with the same 
 result. I'll grab a tarball and see if it works any differently.
 
 Jason
 
 
 
 teqDruid wrote:
 
 A simple file like that works fine for me (just the Program line).  Two
 points, however:
 1)DMD support hasn't been in SCons for that many releases.  I'm using
 v0.96.1... Get the latest version and try it again.
 2)On linux, SCons will invoke gcc to link, so you should see a gcc line.

 The output for a simple compile (on linux) looks like this:
 $ scons
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 dmd -I. -c -oftest.o test.d
 gcc -o test test.o -lphobos -lpthread
 scons: done building targets.

 I don't know anything about the windows stuff.

 SCons is great.  I use it for all of my projects.  It's much cleaner than
 Makefiles (which probably isn't saying a lot) and it figures out how 
 to do
 clean-ups on it's own.  I'll generally write SConstruct files for all of
 the D projects I'm trying to compile (even large ones that aren't 
 mine) if
 the Makefile that comes with them doesn't work off the bat... I can't 
 work
 with Makefiles anymore since SCons has me so spoiled.

 John

 On Thu, 06 Jan 2005 10:57:39 -0500, Jason Jasmin wrote:


 I've got a question regarding D and SCons -- and since I saw the 
 author for the D module in SCons hangs out here, hopefully I can get 
 an answer :)

 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.

 I made an SConstruct file that looked like:

 Program('pi.d')

 Which didn't work. SCons tried to compile pi.d with gcc. After 
 searching the SCons mailing lists, I came up with the following (this 
 is from memory, but it should be fairly close):

 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')

 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(

 Could any kind soul please post a simple, working SConscript file 
 that I can use as a template to get stuff going?

 Thanks,

 Jason Jasmin



Jan 06 2005
parent reply teqDruid <me teqdruid.com> writes:
That version is identical to the one I'm using.  Check to see if the
following two files exist:
/usr/lib/scons/SCons/Tool/dmd.py
/usr/lib/scons/SCons/Scanner/D.py

They chould also have associated .pyo and .pyc files.  If you look at the
man page, there are several debug modes you might want to try.  Also make
sure that dmd is in your path (which it probably is)... If none of this
helps, you probably want to inquire on one of the SCons lists, since it's
definately a SCons bug, or configuration error.

John

On Thu, 06 Jan 2005 20:23:03 -0500, Jason Jasmin wrote:

 Just tried the tarball version, same problems :(
 
 Jason Jasmin wrote:
 I'm using the latest and greatest scons, installed from the RPM 
 distribution on a FC3 box:
 
 SCons by Steven Knight et al.:
         script: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
         engine: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
 Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
 
 --------
 
 I'm wondering if I am missing something here -- from what I read of 
 SCons, it *should* be as easy as a Program() line. This SConstruct file:
 
 Program('dhry.d')
 
 gives the following output:
 
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 gcc -o dhry dhry.d
 /usr/bin/ld:dhry.d: file format not recognized; treating as linker script
 /usr/bin/ld:dhry.d:335: syntax error
 collect2: ld returned 1 exit status
 scons: *** [dhry] Error 1
 scons: building terminated because of errors.
 
 
 As you can see, it is trying to compile dhry.d with gcc :( I am 
 wondering if there is something goofy with the RPM version of SCons, 
 because I have tried this on two different (clean!) boxes with the same 
 result. I'll grab a tarball and see if it works any differently.
 
 Jason
 
 
 
 teqDruid wrote:
 
 A simple file like that works fine for me (just the Program line).  Two
 points, however:
 1)DMD support hasn't been in SCons for that many releases.  I'm using
 v0.96.1... Get the latest version and try it again.
 2)On linux, SCons will invoke gcc to link, so you should see a gcc line.

 The output for a simple compile (on linux) looks like this:
 $ scons
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 dmd -I. -c -oftest.o test.d
 gcc -o test test.o -lphobos -lpthread
 scons: done building targets.

 I don't know anything about the windows stuff.

 SCons is great.  I use it for all of my projects.  It's much cleaner than
 Makefiles (which probably isn't saying a lot) and it figures out how 
 to do
 clean-ups on it's own.  I'll generally write SConstruct files for all of
 the D projects I'm trying to compile (even large ones that aren't 
 mine) if
 the Makefile that comes with them doesn't work off the bat... I can't 
 work
 with Makefiles anymore since SCons has me so spoiled.

 John

 On Thu, 06 Jan 2005 10:57:39 -0500, Jason Jasmin wrote:


 I've got a question regarding D and SCons -- and since I saw the 
 author for the D module in SCons hangs out here, hopefully I can get 
 an answer :)

 I've never used SCons before, but it looks really nice and wanted to 
 give it a whirl. However, I have had very little luck getting it to 
 actually work.

 I made an SConstruct file that looked like:

 Program('pi.d')

 Which didn't work. SCons tried to compile pi.d with gcc. After 
 searching the SCons mailing lists, I came up with the following (this 
 is from memory, but it should be fairly close):

 env = Enviroment(tools=['Default', 'dmd'])
 env.Program('pi.d')

 which will recognize the file as a D file, and compile it using dmd. 
 However, it won't link it :(

 Could any kind soul please post a simple, working SConscript file 
 that I can use as a template to get stuff going?

 Thanks,

 Jason Jasmin




Jan 07 2005
parent reply Jason Jasmin <zod269-d yahoo.com> writes:
Got it working! I did have all the .pyc files, and reading the man page 
gave me a clue -- the relevent text: "If no tool list is specified, then 
SCons will auto-detect the installed tools using the PATH variable in 
the ENV construction variable and the platform  name  when  the 
Environment is constructed."

Well, just for grins, I modified my SConstruct to print env['PATH'] -- 
which returned /usr/bin;/usr/local/bin -- There's the problem -- DMD 
*is* in my path, just not in those directories :) Moved dmd to 
/usr/local/bin, and all is happy :)

Thanks for the assistance!

Jason (happily playing with D now!)


teqDruid wrote:
 That version is identical to the one I'm using.  Check to see if the
 following two files exist:
 /usr/lib/scons/SCons/Tool/dmd.py
 /usr/lib/scons/SCons/Scanner/D.py
 
 They chould also have associated .pyo and .pyc files.  If you look at the
 man page, there are several debug modes you might want to try.  Also make
 sure that dmd is in your path (which it probably is)... If none of this
 helps, you probably want to inquire on one of the SCons lists, since it's
 definately a SCons bug, or configuration error.
 
 John
 
 On Thu, 06 Jan 2005 20:23:03 -0500, Jason Jasmin wrote:
 
 
Just tried the tarball version, same problems :(

Jason Jasmin wrote:

I'm using the latest and greatest scons, installed from the RPM 
distribution on a FC3 box:

SCons by Steven Knight et al.:
        script: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
        engine: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation

--------

I'm wondering if I am missing something here -- from what I read of 
SCons, it *should* be as easy as a Program() line. This SConstruct file:

Program('dhry.d')

gives the following output:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o dhry dhry.d
/usr/bin/ld:dhry.d: file format not recognized; treating as linker script
/usr/bin/ld:dhry.d:335: syntax error
collect2: ld returned 1 exit status
scons: *** [dhry] Error 1
scons: building terminated because of errors.


As you can see, it is trying to compile dhry.d with gcc :( I am 
wondering if there is something goofy with the RPM version of SCons, 
because I have tried this on two different (clean!) boxes with the same 
result. I'll grab a tarball and see if it works any differently.

Jason



teqDruid wrote:


A simple file like that works fine for me (just the Program line).  Two
points, however:
1)DMD support hasn't been in SCons for that many releases.  I'm using
v0.96.1... Get the latest version and try it again.
2)On linux, SCons will invoke gcc to link, so you should see a gcc line.

The output for a simple compile (on linux) looks like this:
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
dmd -I. -c -oftest.o test.d
gcc -o test test.o -lphobos -lpthread
scons: done building targets.

I don't know anything about the windows stuff.

SCons is great.  I use it for all of my projects.  It's much cleaner than
Makefiles (which probably isn't saying a lot) and it figures out how 
to do
clean-ups on it's own.  I'll generally write SConstruct files for all of
the D projects I'm trying to compile (even large ones that aren't 
mine) if
the Makefile that comes with them doesn't work off the bat... I can't 
work
with Makefiles anymore since SCons has me so spoiled.

John

On Thu, 06 Jan 2005 10:57:39 -0500, Jason Jasmin wrote:



I've got a question regarding D and SCons -- and since I saw the 
author for the D module in SCons hangs out here, hopefully I can get 
an answer :)

I've never used SCons before, but it looks really nice and wanted to 
give it a whirl. However, I have had very little luck getting it to 
actually work.

I made an SConstruct file that looked like:

Program('pi.d')

Which didn't work. SCons tried to compile pi.d with gcc. After 
searching the SCons mailing lists, I came up with the following (this 
is from memory, but it should be fairly close):

env = Enviroment(tools=['Default', 'dmd'])
env.Program('pi.d')

which will recognize the file as a D file, and compile it using dmd. 
However, it won't link it :(

Could any kind soul please post a simple, working SConscript file 
that I can use as a template to get stuff going?

Thanks,

Jason Jasmin





Jan 07 2005
parent Andy Friesen <andy ikagames.com> writes:
Jason Jasmin wrote:
 Got it working! I did have all the .pyc files, and reading the man page 
 gave me a clue -- the relevent text: "If no tool list is specified, then 
 SCons will auto-detect the installed tools using the PATH variable in 
 the ENV construction variable and the platform  name  when  the 
 Environment is constructed."
 
 Well, just for grins, I modified my SConstruct to print env['PATH'] -- 
 which returned /usr/bin;/usr/local/bin -- There's the problem -- DMD 
 *is* in my path, just not in those directories :) Moved dmd to 
 /usr/local/bin, and all is happy :)
 
 Thanks for the assistance!

This has to do with the way SCons handles the system environment. As I understand it, the system path is, by default, ignored to improve the chance that a build will be correct on any given machine. What I typically do is completely subvert whatever reasoning this is intended to uphold by doing import os env = Environment(ENV=os.environ) -- andy
Jan 08 2005