FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug with paths

 
Post new topic   Reply to topic     Forum Index -> Build
View previous topic :: View next topic  
Author Message
Deewiant



Joined: 26 Dec 2005
Posts: 21
Location: Finland

PostPosted: Mon Dec 26, 2005 12:56 pm    Post subject: Bug with paths Reply with quote

This is on Windows XP, SP2, with Build 2.9.

I have the following two files:
Code:
C:\Main\foo\a\file.d
C:\Main\foo\b\file.d

Their contents are:
Code:
module foo.a.file;

import foo.b.file;

void main() {
   foo.b.file.helloWorld();
}

and
Code:
module foo.b.file;

private import std.stdio;

void helloWorld() { writefln("Hello, world!"); }

I open up a command prompt and try the following:
Code:
C:\Main\foo\a>build file -I..\..

Which works fine. However, if I add the -od switch to the mix:
Code:
C:\Main\foo\a>build file -I..\.. -odobj


OPTLINK complains "Error 2: File Not Found obj\C:\Main\foo\b\file.obj". Of course it didn't find it, that's an invalid path. Build tries to invoke the following command when linking, and naturally fails:
Code:
C:\dmd\bin\..\..\dm\bin\link.exe obj\file+obj\C:\Main\foo\b\file,file.exe,,user32+kernel32,obj\file.
def/noi;

Since that's an autogenerated path I can't see a way out of the dilemma other than to post a bug report here and await enlightenment or a bug fix. Wink
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Mon Dec 26, 2005 2:09 pm    Post subject: Reply with quote

Think you're gonna' run into another problem, since the two modules (with the same name) will collide via the -odobj compiler switch ~ I believe you'll end up with one obj file instead of two?
Back to top
View user's profile Send private message
Deewiant



Joined: 26 Dec 2005
Posts: 21
Location: Finland

PostPosted: Tue Dec 27, 2005 4:30 am    Post subject: Reply with quote

I get one file.obj in C:\Main\foo\b and another in C:\Main\foo\a\obj after running "build file -I..\.. -odobj". If I leave out -odobj the other is in C:\Main\foo\a. So it works fine, but the other .obj file doesn't end up in the obj directory. I don't really mind, especially since -cleanup removes it even though it's elsewhere.

Edit: the other obj file remains in C:\Main\foo\b even if I change the filename. Another bug, or intentional?

It's moot point in my case anyway, since in the non-simplified situation where I ran into the problem originally the modules don't share a name. That they do in the original post is a tribute to my laziness. Embarassed

Oh, and to make a completely different point: it says nowhere in the docs that the Build configuration file should be called build.cfg nor where it should be placed. I found the information by searching this forum, but methinks that should be in the documentation Wink
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Tue Dec 27, 2005 6:19 am    Post subject: Reply with quote

Deewiant wrote:
I get one file.obj in C:\Main\foo\b and another in C:\Main\foo\a\obj after running "build file -I..\.. -odobj". If I leave out -odobj the other is in C:\Main\foo\a. So it works fine, but the other .obj file doesn't end up in the obj directory. I don't really mind, especially since -cleanup removes it even though it's elsewhere.

Edit: the other obj file remains in C:\Main\foo\b even if I change the filename. Another bug, or intentional?

It's moot point in my case anyway, since in the non-simplified situation where I ran into the problem originally the modules don't share a name. That they do in the original post is a tribute to my laziness. Embarassed


This is a bug in Build. I assumed (wrongly) that -od caused dmd to write all object files in the named directory, however it seems that it only applies to source files that have been specified relative to the current directory. And Build supplies the fully specified path for any file that is not in a subfolder of the current directory.

If you had of moved to C:\Main folder and typed in
Code:
build foo\a\file  -odobj

it would have worked, even with same-named files. Because in this case, it creates 'obj' as a sub folder of the current folder (Main) and then created the same directory structure as the source files to place the objects into.

Deewiant wrote:
Oh, and to make a completely different point: it says nowhere in the docs that the Build configuration file should be called build.cfg nor where it should be placed. I found the information by searching this forum, but methinks that should be in the documentation Wink

Yep, I forgot this small point Embarassed
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Build All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group