www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Trouble with 'Build' (was: Newbie questions...)

reply Derek Parnell <derek psych.ward> writes:
On Sat, 12 Mar 2005 13:57:28 +0000 (UTC), jicman wrote:


[snip]

So all I can assume at this point is that we are testing with different
source code files.

No, it's the same source code.

source?
  Do I have to install it?  What I did was that I
 renamed build_win_1.12.exe to build.exe.  Then I moved it to c:dmd\bin and
typed
 build
 
 8:50:02.71>build
 Path and Version : c:\dmd\bin\build.exe v1.12(387)

This is fine. I just redid the same steps myself, and it still works fine here. [snip]
 
 By the way, great utility, though it's not working for me. :-(.

Well its not so great then ;-)
  Ok, here is the problem.  Say you tried to compile the same month.d with

 dmd month.d
 
 which is not going to work

?? Why not? It works here.
, but it's going to create an executable (which does
 not work) anyway, 

But build will not create an executable if it doesn't work. Do you have one lying around from some previous run of dmd? You can use the -full switch to force it to be recompiled.
 and then you type
 
 build month.d
 
 build replies with,
 
 8:56:36.25>build month.d
 Files are up to date, no compilation required.

I suspect that you get this message because you have created an executable some other way. Build is just saying that the month.exe file was created after the last change to month.d and jic.d, and that month.obj and jic.obj also exist and were created before month.exe. In other words, the files are up to date and nothing needs to be recompiled.
 Which is not really true, since month.exe gives you an Windows error.

And what Windows error would that be?
 What version of link are you running?  Here is mine:
 
 9:01:28.78>link
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 OPTLINK : Warning 23: No Stack
 OPTLINK : Warning 134: No Start Address

OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved OPTLINK : Warning 23: No Stack OPTLINK : Warning 134: No Start Address Can you run build with the -V switch and show me the output, plus the contents of month.rsp file? Before doing so, delete month,obj and jic.obj. For example, this is what I get ... C:\TEMP>build month -V >verb.txt C:\TEMP>type month.rsp "-op" "-If:\dmd\bin\..\src\phobos" "-unittest" "month.d" "jic.d" "-ofmonth.exe" C:\TEMP>type verb.txt f:\dmd\bin\..\..\dm\bin\link.exe month+jic,month.exe,,user32+kernel3 *** build v1.12 (build 387)*** Compiler installed in f:\dmd\bin\ Configuration File installed in f:\dmd\bin\ Active Version: 'X86' Active Version: 'Win32' Active Version: 'LittleEndian' Active Version: 'Windows' Active Version: 'build' Active Version: 'D_InlineAsm' Active Version: 'DigitalMars' Reading from config: f:\dmd\bin\sc.ini Line 1: [Version] Line 2: version=7.51 Build 020 Line 3: Line 4: [Environment] Line 5: LIB="f:\dmd\bin\..\lib";\dm\lib use LIB="f:\dmd\lib\";"\dm\lib\" Line 6: DFLAGS="-If:\dmd\bin\..\src\phobos" added root from config file f:\dmd\src\phobos\ Line 7: LINKCMD=f:\dmd\bin\..\..\dm\bin\link.exe Line 8: file->module month.d => month Time 2005/03/13 01:24:50 for month.d Time not recorded for month.obj Scanning month.d module->file std.stdio => f:\dmd\src\phobos\std\stdio.d module->file jic => jic.d Ignoring f:\dmd\src\phobos\std\stdio.d (module: phobos) file->module jic.d => jic Time 2005/03/12 16:55:44 for jic.d Time not recorded for jic.obj Scanning jic.d Module name set to 'jic' module->file std.string => f:\dmd\src\phobos\std\string.d Ignoring f:\dmd\src\phobos\std\string.d (module: phobos) source file[0] month.d Newer time: from not recorded to 2005/03/13 01:24:50 source file[1] jic.d Building target 'month.exe' Time 2005/03/13 01:26:42 for month.exe (target) Time 2005/03/13 01:24:50 (most recent) month.d newer than its object file jic.d newer than its object file Compiling with .......... "-op" "-If:\dmd\bin\..\src\phobos" "-unittest" "month.d" "jic.d" "-ofmonth.exe" Running 'f:\dmd\bin\dmd.exe month.rsp' Successful build args: ............... [ 0]: -V compiler args: ................ [ 0]: -op [ 1]: -If:\dmd\bin\..\src\phobos [ 2]: -unittest command line files: ............... [ 0]: month.d declared source files: ............... [ 0]: month.d [ 1]: jic.d import roots: ................. [ 0]: f:\dmd\src\phobos\ C:\TEMP> -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build 13/03/2005 1:32:15 AM
Mar 12 2005
next sibling parent jicman <jicman_member pathlink.com> writes:
Let's take this one at a time. :-)

Derek Parnell says...
Well its not so great then ;-)

Well, it's probably my system. It has so much "complicated" stuff on it. :-) I am running XP, by the way.
  Ok, here is the problem.  Say you tried to compile the same month.d with

 dmd month.d
 
 which is not going to work

?? Why not? It works here.

Wait a second, mate! Are you saying that if you run dmd month.d it works for you? It should not. That was my original question. I get 10:14:27.58>dmd month.d c:\dmd\bin\..\..\dm\bin\link.exe month,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved month.obj(month) Error 42: Symbol Undefined _D3jic6CallMeFAaZAa month.obj(month) Error 42: Symbol Undefined _D3jic9CallMeTooFAaZAa --- errorlevel 2 Which then creates these files: 03/12/2005 10:17 AM 88,604 month.exe 03/12/2005 10:17 AM 2,529 month.map 03/12/2005 10:17 AM 836 month.obj
 Which is not really true, since month.exe gives you an Windows error.

And what Windows error would that be?

Attached montherror.bmp
Mar 12 2005
prev sibling next sibling parent jicman <jicman_member pathlink.com> writes:
Derek Parnell asks...
But build will not create an executable if it doesn't work. Do you have one
lying around from some previous run of dmd? You can use the -full switch to
force it to be recompiled.

This is also wrong, my friend. For example, take a look at my directory right now: 10:26:17.02>dir Volume in drive D is DATA Volume Serial Number is 241D-5C0B Directory of D:\myprograms\d\jic 03/12/2005 10:26 AM <DIR> . 03/12/2005 10:26 AM <DIR> .. 03/11/2005 08:49 PM 209 jic.d 03/11/2005 08:35 PM 145 month.d 2 File(s) 354 bytes 2 Dir(s) 1,380,347,904 bytes free Watch the magic of jic... :-) 10:27:03.98>build month.d c:\dmd\bin\..\..\dm\bin\link.exe month,month.exe,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved month.obj(month) Error 42: Symbol Undefined _D3jic6CallMeFAaZAa month.obj(month) Error 42: Symbol Undefined _D3jic9CallMeTooFAaZAa --- errorlevel 2 10:27:11.42>dir Volume in drive D is DATA Volume Serial Number is 241D-5C0B Directory of D:\myprograms\d\jic 03/12/2005 10:27 AM <DIR> . 03/12/2005 10:27 AM <DIR> .. 03/11/2005 08:49 PM 209 jic.d 03/11/2005 08:35 PM 145 month.d 03/12/2005 10:27 AM 88,604 month.exe 03/12/2005 10:27 AM 2,529 month.map 03/12/2005 10:27 AM 836 month.obj 03/12/2005 10:27 AM 72 month.rsp 6 File(s) 92,395 bytes 2 Dir(s) 1,380,249,600 bytes free Well, it created 4 files: 1. month.exe 2. month.map 3. month.obj 4. month.rsp So, you may think this works, but if I run month.exe, I get the same message that you got on the last post I sent.
Mar 12 2005
prev sibling next sibling parent reply jicman <jicman_member pathlink.com> writes:
Derek Parnell also asked...
 8:56:36.25>build month.d
 Files are up to date, no compilation required.

I suspect that you get this message because you have created an executable some other way. Build is just saying that the month.exe file was created after the last change to month.d and jic.d, and that month.obj and jic.obj also exist and were created before month.exe. In other words, the files are up to date and nothing needs to be recompiled.

Ok, then. It works as designed. Nonetheless, the executable is not good. Which is a problem with dmd. But that's another post. (It's coming, Walter. :-))
Can you run build with the -V switch and show me the output, plus the
contents of month.rsp file? Before doing so, delete month,obj and jic.obj.

Ok, again here is the contect if my directory: 10:30:38.60>del *.exe *.map *.obj *.rsp 10:37:17.85>dir Volume in drive D is DATA Volume Serial Number is 241D-5C0B Directory of D:\myprograms\d\jic 03/12/2005 10:37 AM <DIR> . 03/12/2005 10:37 AM <DIR> .. 03/11/2005 08:49 PM 209 jic.d 03/11/2005 08:35 PM 145 month.d 2 File(s) 354 bytes 2 Dir(s) 1,380,339,712 bytes free 10:37:19.61>build -V month.d > build.txt Here is build.txt... c:\dmd\bin\..\..\dm\bin\link.exe month,month.exe,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved month.obj(month) Error 42: Symbol Undefined _D3jic6CallMeFAaZAa month.obj(month) Error 42: Symbol Undefined _D3jic9CallMeTooFAaZAa --- errorlevel 2 *** build v1.12 (build 387)*** Compiler installed in c:\dmd\bin\ Configuration File installed in c:\dmd\bin\ Active Version: 'X86' Active Version: 'Win32' Active Version: 'LittleEndian' Active Version: 'Windows' Active Version: 'build' Active Version: 'D_InlineAsm' Active Version: 'DigitalMars' Reading from config: c:\dmd\bin\sc.ini Line 1: [Version] Line 2: version=7.51 Build 020 Line 3: Line 4: [Environment] Line 5: LIB="c:\dmd\bin\..\lib";\dm\lib use LIB="c:\dmd\lib\";"\dm\lib\" Line 6: DFLAGS="-Ic:\dmd\bin\..\src\phobos" added root from config file c:\dmd\src\phobos\ Line 7: LINKCMD=c:\dmd\bin\..\..\dm\bin\link.exe Line 8: file->module month.d => month Time 2005/03/11 20:35:32 for month.d Time not recorded for month.obj Scanning month.d module->file std.stdio => c:\dmd\src\phobos\std\stdio.d module->file jic => c:\dmd\src\phobos\jic.d Ignoring c:\dmd\src\phobos\std\stdio.d (module: phobos) Ignoring c:\dmd\src\phobos\jic.d (module: phobos) source file[0] month.d Newer time: from not recorded to 2005/03/11 20:35:32 Building target 'month.exe' Time not recorded for month.exe (target) Time 2005/03/11 20:35:32 (most recent) month.d newer than its object file Compiling with .......... "-op" "-Ic:\dmd\bin\..\src\phobos" "-unittest" "month.d" "-ofmonth.exe" Running 'c:\dmd\bin\dmd.exe month.rsp' Failed. Return code: 2 build args: ............... [ 0]: -V compiler args: ................ [ 0]: -op [ 1]: -Ic:\dmd\bin\..\src\phobos [ 2]: -unittest command line files: ............... [ 0]: month.d declared source files: ............... [ 0]: month.d import roots: ................. [ 0]: c:\dmd\src\phobos\ and here is month.rsp... 10:41:30.61>type month.rsp "-op" "-Ic:\dmd\bin\..\src\phobos" "-unittest" "month.d" "-ofmonth.exe"
For example, this is what I get ...

C:\TEMP>build month -V >verb.txt

C:\TEMP>type month.rsp
"-op"
"-If:\dmd\bin\..\src\phobos"
"-unittest"
"month.d"
"jic.d"
"-ofmonth.exe"

C:\TEMP>type verb.txt
f:\dmd\bin\..\..\dm\bin\link.exe month+jic,month.exe,,user32+kernel3
*** build v1.12 (build 387)***
Compiler installed in f:\dmd\bin\
Configuration File installed in f:\dmd\bin\
Active Version: 'X86'
Active Version: 'Win32'
Active Version: 'LittleEndian'
Active Version: 'Windows'
Active Version: 'build'
Active Version: 'D_InlineAsm'
Active Version: 'DigitalMars'
Reading from config: f:\dmd\bin\sc.ini
 Line 1: [Version]
 Line 2: version=7.51 Build 020
 Line 3:
 Line 4: [Environment]
 Line 5: LIB="f:\dmd\bin\..\lib";\dm\lib
 use LIB="f:\dmd\lib\";"\dm\lib\"
 Line 6: DFLAGS="-If:\dmd\bin\..\src\phobos"
 added root from config file f:\dmd\src\phobos\
 Line 7: LINKCMD=f:\dmd\bin\..\..\dm\bin\link.exe
 Line 8:
 file->module month.d => month
Time 2005/03/13 01:24:50 for month.d
Time not recorded for month.obj
Scanning month.d
 module->file std.stdio => f:\dmd\src\phobos\std\stdio.d
 module->file jic => jic.d
Ignoring f:\dmd\src\phobos\std\stdio.d (module: phobos)
 file->module jic.d => jic
Time 2005/03/12 16:55:44 for jic.d
Time not recorded for jic.obj
Scanning jic.d
Module name set to 'jic'
 module->file std.string => f:\dmd\src\phobos\std\string.d
Ignoring f:\dmd\src\phobos\std\string.d (module: phobos)
source file[0] month.d
Newer time: from not recorded to 2005/03/13 01:24:50
source file[1] jic.d

Building target 'month.exe'
Time 2005/03/13 01:26:42 for month.exe (target)
Time 2005/03/13 01:24:50 (most recent)
month.d newer than its object file
jic.d newer than its object file
Compiling with ..........
"-op"
"-If:\dmd\bin\..\src\phobos"
"-unittest"
"month.d"
"jic.d"
"-ofmonth.exe"


Running 'f:\dmd\bin\dmd.exe  month.rsp'
Successful


build args: ...............
 [ 0]: -V

compiler args: ................
 [ 0]: -op
 [ 1]: -If:\dmd\bin\..\src\phobos
 [ 2]: -unittest

command line files: ...............
 [ 0]: month.d

declared source files: ...............
 [ 0]: month.d
 [ 1]: jic.d

import roots: .................
 [ 0]: f:\dmd\src\phobos\

C:\TEMP>


-- 
Derek Parnell
Melbourne, Australia
http://www.dsource.org/projects/build
13/03/2005 1:32:15 AM

Mar 12 2005
parent reply Derek Parnell <derek psych.ward> writes:
On Sat, 12 Mar 2005 15:37:30 +0000 (UTC), jicman wrote:

 Derek Parnell also asked...

 Ok, again here is the contect if my directory:
 
 10:30:38.60>del *.exe *.map *.obj *.rsp
 
 10:37:17.85>dir
 Volume in drive D is DATA
 Volume Serial Number is 241D-5C0B
 
 Directory of D:\myprograms\d\jic
 
 03/12/2005  10:37 AM    <DIR>          .
 03/12/2005  10:37 AM    <DIR>          ..
 03/11/2005  08:49 PM               209 jic.d
 03/11/2005  08:35 PM               145 month.d
 2 File(s)            354 bytes
 2 Dir(s)   1,380,339,712 bytes free

Okay! I've found the problem. You have two (2) jic.d files. One in D:\myprograms\d\ and another in c:\dmd\src\phobos\ I got the clue from the -V display...
 10:37:19.61>build -V month.d > build.txt
 
 Here is build.txt...
 
 c:\dmd\bin\..\..\dm\bin\link.exe month,month.exe,,user32+kernel32/noi;
 
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 month.obj(month) 
 Error 42: Symbol Undefined _D3jic6CallMeFAaZAa
 month.obj(month) 
 Error 42: Symbol Undefined _D3jic9CallMeTooFAaZAa
 --- errorlevel 2
 *** build v1.12 (build 387)***
 Compiler installed in c:\dmd\bin\
 Configuration File installed in c:\dmd\bin\
 Active Version: 'X86'
 Active Version: 'Win32'
 Active Version: 'LittleEndian'
 Active Version: 'Windows'
 Active Version: 'build'
 Active Version: 'D_InlineAsm'
 Active Version: 'DigitalMars'
 Reading from config: c:\dmd\bin\sc.ini
 Line 1: [Version]
 Line 2: version=7.51 Build 020
 Line 3: 
 Line 4: [Environment]
 Line 5: LIB="c:\dmd\bin\..\lib";\dm\lib
 use LIB="c:\dmd\lib\";"\dm\lib\"
 Line 6: DFLAGS="-Ic:\dmd\bin\..\src\phobos"
 added root from config file c:\dmd\src\phobos\
 Line 7: LINKCMD=c:\dmd\bin\..\..\dm\bin\link.exe
 Line 8: 
 file->module month.d => month
 Time 2005/03/11 20:35:32 for month.d
 Time not recorded for month.obj
 Scanning month.d
 module->file std.stdio => c:\dmd\src\phobos\std\stdio.d

*****************************************
 module->file jic => c:\dmd\src\phobos\jic.d
 Ignoring c:\dmd\src\phobos\std\stdio.d (module: phobos)
 Ignoring c:\dmd\src\phobos\jic.d (module: phobos)

As you can see above, build found a jic.d in the phobos package and as it ignores stuff there, it didn't put it in the command line for dmd. So the dmd command line just had month.d on it and not jic.d as well. By default, build does not compile stuff in the phobos package, so if you take jic.d out of the phobos package, it should work. -- Derek Parnell Melbourne, Australia 13/03/2005 9:02:46 AM
Mar 12 2005
parent jicman <jicman_member pathlink.com> writes:
Derek Parnell says...

Okay! I've found the problem. You have two (2) jic.d files. One in
D:\myprograms\d\ and another in c:\dmd\src\phobos\

I got the clue from the -V display...

Yep. That was it. sorry. That was a few hours before the post. I was trying to make it work with dmd month.d. My sincere apologies. Thanks...
As you can see above, build found a jic.d in the phobos package and as it
ignores stuff there, it didn't put it in the command line for dmd. So the
dmd command line just had month.d on it and not jic.d as well.

By default, build does not compile stuff in the phobos package, so if you
take jic.d out of the phobos package, it should work. 

Yep! That did it. Thanks again and I join the whole gang who said thanks to you for the wonderful utility. josť
Mar 12 2005
prev sibling parent jicman <jicman_member pathlink.com> writes:
Derek Parnell says...
 No, it's the same source code.

source?

Here is is... 10:41:36.33>type jic.d module jic; private import std.string; char[] CallMe(char[] mon) { char[] mm = "CallMe " ~ mon; return(mm); } char[] CallMeToo(char[] mon) { char[] mm = "CallMeToo " ~ mon; return(mm); } 10:44:40.45>type month.d import std.stdio; import jic; void main (char[][] args) { char[] d; writefln(jic.CallMe("Jan")); writefln(jic.CallMeToo("Feb")); }
Mar 12 2005