rdmd

Adam D. Ruppe destructionator at gmail.com
Sun Jul 5 09:23:34 PDT 2009


Forgive me for being a bit chatty in this message. I'm typing it up
as I try the program.



I got a bunch of optlink errors when running rdmd on my Vista laptop.

rdmd itself compiled perfectly. The file I tried to compile was a import
std.stdin; hello world program. Nothing special. Compiling it with
dmd hello.d works as expected.

Anyway, here's the output:


==============

c:\Users\me\Desktop>rdmd --chatty hello.d
chdir "." && dmd  -v -o- "hello.d" >hello.d.deps
dmd  -of"C:\Users\me\AppData\Local\Temp/.rdmd\hello.d.ED85692521C0A87990BB1B70BE
E0046C" -od"C:\Users\me\AppData\Local\Temp/.rdmd\rdmd-hello.d-ED85692521C0A87990
BB1B70BEE0046C" "hello.d"
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
OPTLINK : Warning 9: Unknown Option : .RDMD\RDMD
OPTLINK : Warning 9: Unknown Option : HELLO.D
OPTLINK : Warning 9: Unknown Option : ED85692521C0A87990BB1B70BEE0046C\HELLO.D
OPTLINK : Warning 9: Unknown Option : .RDMD\HELLO.D.ED85692521C0A87990BB1B70BEE0
046C
user32.def(0) : Error 2: File Not Found user32.def
--- errorlevel 1

c:\Users\me\Desktop>dmd hello.d

c:\Users\me\Desktop>hello
Hello, world!

===========================


And the fix seems trivial enough. Notice how the errors start when it sees
a / in the path.

On line 195 and 196 of rdmd.d, change the /'s to \'s.


Not out of the woods yet!

=============


c:\Users\me\Desktop>rdmd --chatty hello.d
chdir "." && dmd  -v -o- "hello.d" >hello.d.deps
dmd  -of"C:\Users\me\AppData\Local\Temp\.rdmd\hello.d.ED85692521C0A87990BB1B70BE
E0046C" -od"C:\Users\me\AppData\Local\Temp\.rdmd\rdmd-hello.d-ED85692521C0A87990
BB1B70BEE0046C" "hello.d"
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
C:\Users\me\AppData\Local\Temp\.rdmd\rdmd-hello.d-ED85692521C0A87990BB1B70BEE004
6C\hello.d
 Error 2: File Not Found C:\Users\me\AppData\Local\Temp\.rdmd\rdmd-hello.d-ED856
92521C0A87990BB1B70BEE0046C\hello.d
--- errorlevel 1

===========


OPTLINK can't find the object file. Looking at the temp folder, that's
because it isn't there under that name - it is hello.d.obj instead.

I tried running rdmd hello (without the .d) and got the same result.

But copying the file to the different name works:

cd tmp/rdmd/whatever
copy hello.d.obj hello.d
popd
rdmd hello.d

Hello world!

So it is a filename woe.

... though clearing the files and doing the same thing again gives me this:

c:\Users\me\Desktop>rdmd --chatty hello.d
chdir "." && dmd  -v -o- "hello.d" >hello.d.deps
dmd  -of"C:\Users\me\AppData\Local\Temp\.rdmd\hello.d.ED85692521C0A87990BB1B70BE
E0046C" -od"C:\Users\me\AppData\Local\Temp\.rdmd\rdmd-hello.d-ED85692521C0A87990
BB1B70BEE0046C" "hello.d"
std.file.FileException: In std\file.d(689), data file C:\Users\me\AppData\Local\
Temp\.rdmd\rdmd-hello.d-ED85692521C0A87990BB1B70BEE0046C: The operation complete
d successfully.

That might be a phobos bug.


Then running the program once more executes the program:


c:\Users\me\Desktop>rdmd --chatty hello.d
chdir "." && dmd  -v -o- "hello.d" >hello.d.deps

c:\Users\me\Desktop>Hello, world!


(A bit strange that it puts out the prompt before the program's output,
 but everything works.)



Anyway, exception on success is weird, but back to the first problem:
hello.d - file not found.

Looking at the source to try and figure this out. Line 281 (function d2obj)
has a potential bug: it assumes the object file is .o.
On Windows, it will be .obj.



I wonder if dmd is sending the wrong filename to link? Running

rdmd -v --chatty hello

Snipping most the output......

======

c:\dm\bin\link.exe "C:\Users\me\AppData\Local\Temp\.rdmd\rdmd-hello.d-ED85692521
C0A87990BB1B70BEE0046C\hello.d","C:\Users\me\AppData\Local\Temp\.rdmd\hello.d.ED
85692521C0A87990BB1B70BEE0046C",,user32+kernel32/noi;

==========



DMD might be making the mistake here. It takes hello.d on its command line,
outputs hello.d.obj, then doesn't inform link of the new .obj extension.


Aside from the little things noted above, rdmd looks like it should be
correct. Is dmd's behavior here expected, or is that a bug?


Little things I'm noticing:

rdmd --man doesn't work on my box either. (no web browser is in my PATH, so
partially my fault, but I don't think one is in the path on a normal Windows
install, so something else should probably be done for this.)

And the file it outputs if I fix the object file manually doesn't have
the .exe extension. It works when I run it from the command line, but
without the .exe, the Windows gui will get lost.





I've gotta run and take care of some other stuff. I'll attack it again
next time I'm free.



-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list