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

build - working with paths?

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


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Wed Feb 23, 2005 3:38 pm    Post subject: build - working with paths? Reply with quote

I'm trying to build a small app that I'm going to convert from PHP to Mango servlets. Here's the layout of my project directory:

Code:

/koth
 /src
  /org
   /dsource
    /test.d
    /otherfile1.d
    /otherfile2.d
    /otherfile3.d


in test.d, which is just a hello world with writefln, I've made it a module. See the code here:
http://trac.dsource.org/projects/koth/file/trunk/src/org/dsource/koth/test.d

It appears that dmd compiles just fine (from /koth/src/):
Code:

> dmd org/dsource/koth/test.d
gcc test.o -o test -lphobos -lpthread -lm
>


but with build:
Code:

> build org/dsource/koth/test.d
module org.dsource.koth.test is in multiple packages org.dsource.koth.test
>


Thoughts? Is it because I'm specifying a file with a path as the arg for build?

BA
Back to top
View user's profile Send private message
Derek Parnell



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

PostPosted: Wed Feb 23, 2005 5:30 pm    Post subject: Reply with quote

I can't explain it either except the directory structure you show is different from the package name used.

I just tried it on my Windows XP machine and Build run without error.

This is what I did...

I created the path C:\dparnell\org\dsource\koth

In there I created the file test.d which contained ...
Code:

module org.dsource.koth.test;

import std.stdio;

void main() {
writefln("Hello World!");
}


I then set my current working directory to C:\dparnell and run this...

Code:

build org\dsource\koth\test -V

I used the verbose switch to see what was happening.

Build created a response file for dmd containing ...
Code:

-op -IC:\DPARNELL\DMD\BIN\..\src\phobos -IC:\dparnell\dlibs -unittest
org\dsource\koth\test.d
org\dsource\koth\test.exe


It then ran DMD successfully and created test.exe in that new path.
Code:

Running 'dmd.exe @org\dsource\koth\test.rsp'
C:\DPARNELL\DMD\BIN\..\..\dm\bin\link.exe org\dsource\koth\test,org\dsource\koth
\test.exe,,user32+kernel32/noi;
Successful

Code:

C:\dparnell>org\dsource\koth\test
Hello World!

_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Wed Feb 23, 2005 9:43 pm    Post subject: Reply with quote

Derek Parnell wrote:
I can't explain it either except the directory structure you show is different from the package name used.


Yeah, I just mistyped it in the forum post. You recreated it on your local the proper way.

Here's my -V spewing:

Code:

module org.dsource.koth.test is in multiple packages org.dsource.koth.test
*** build v1.3 (build 198)***
Compiler installed in /usr/bin/
Configuration File installed in /usr/bin/
Active Version: 'X86'
Active Version: 'LittleEndian'
Active Version: 'Posix'
Active Version: 'build'
Active Version: 'D_InlineAsm'
Active Version: 'linux'
Active Version: 'DigitalMars'
Reading from config: /usr/bin/dmd.conf
 Line 1:
 Line 2: [Environment]
 Line 3:
 Line 4: DFLAGS=-I/opt/dmd/src/phobos -I/dv/d/mango
 added root from config file /opt/dmd/src/phobos/
 added root from config file /dv/d/mango/
 Line 5:
 file->module org/dsource/koth/test.d => org.dsource.koth.test
Time 1109199759 for org/dsource/koth/test.d
Time not recorded for org/dsource/koth/test.o
New Source org/dsource/koth/test.d [1]
Module name set to 'org.dsource.koth.test'
 module->file std.stdio => /opt/dmd/src/phobos/std/stdio.d

Building org/dsource/koth/test.d
source file[0] = org/dsource/koth/test.d
Time not recorded for org/dsource/koth/test (target)
Time 1109199759 (most recent)
org/dsource/koth/test.d newer than its object file
Compiling with ..........
-op -version=Posix -I/opt/dmd/src/phobos -I/dv/d/mango -I/dv/d/mango -unittest  org/dsource/koth/test.d org/dsource/koth/test

Running 'dmd -op -version=Posix -I/opt/dmd/src/phobos -I/dv/d/mango -I/dv/d/mango -unittest  org/dsource/koth/test.d org/dsource/koth/test '
Failed. Return code: 256


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

compiler args: ................
 [ 0]: -op
 [ 1]: -version=Posix
 [ 2]: -I/opt/dmd/src/phobos -I/dv/d/mango
 [ 3]: -I/dv/d/mango
 [ 4]: -unittest

command line files: ...............
 [ 0]: org/dsource/koth/test.d

declared source files: ...............
 [ 0]: org/dsource/koth/test.d

import roots: .................
 [ 0]: /opt/dmd/src/phobos/
 [ 1]: /dv/d/mango/
 [ 2]: org/dsource/koth/


It appears to duplicate some things, like the mango include from dmd.conf (it's only there once in the .conf file), and more importantly, it duplicates test.d

This may be a linux-only thing... Thanks for looking into it.

BA
Back to top
View user's profile Send private message
Derek Parnell



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

PostPosted: Wed Feb 23, 2005 10:54 pm    Post subject: Reply with quote

The repeated -I switch was because I didn't parse the config file for whitespace delimited entries. Now fixed.

The apparently repeated 'test' is kinda due to a linux thing. If this was a Windows run you would have seen ...

org/dsource/koth/test.d
org/dsource/koth/test.exe

because executables in Windows have the .exe suffix.

Anyhow I've fixed this by using the -of switch on the dmd commandline now.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Wed Feb 23, 2005 11:14 pm    Post subject: Reply with quote

Nice. Thanks.

Code:
gcc org/dsource/koth/test.o -o org/dsource/koth/test -lphobos -lpthread -lm
*** build v1.4 (build 223)***
Compiler installed in /usr/bin/
Configuration File installed in /usr/bin/
Active Version: 'X86'
Active Version: 'LittleEndian'
Active Version: 'Posix'
Active Version: 'build'
Active Version: 'D_InlineAsm'
Active Version: 'linux'
Active Version: 'DigitalMars'
Reading from config: /usr/bin/dmd.conf
 Line 1:
 Line 2: [Environment]
 Line 3:
 Line 4: DFLAGS=-I/opt/dmd/src/phobos -I/dv/d/mango
 added root from config file /opt/dmd/src/phobos/
 added root from config file /dv/d/mango/
 Line 5:
 file->module org/dsource/koth/test.d => org.dsource.koth.test
Time 1109199759 for org/dsource/koth/test.d
Time not recorded for org/dsource/koth/test.o
New Source org/dsource/koth/test.d [1]
Module name set to 'org.dsource.koth.test'
 module->file std.stdio => /opt/dmd/src/phobos/std/stdio.d

Building org/dsource/koth/test.d
source file[0] = org/dsource/koth/test.d
Time not recorded for org/dsource/koth/test (target)
Time 1109199759 (most recent)
org/dsource/koth/test.d newer than its object file
Compiling with ..........
-op -version=Posix -I/opt/dmd/src/phobos -I/dv/d/mango -unittest org/dsource/koth/test.d -oforg/dsource/koth/test

Running 'dmd -op -version=Posix -I/opt/dmd/src/phobos -I/dv/d/mango -unittest org/dsource/koth/test.d -oforg/dsource/koth/test '
Successful


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

compiler args: ................
 [ 0]: -op
 [ 1]: -version=Posix
 [ 2]: -I/opt/dmd/src/phobos
 [ 3]: -I/dv/d/mango
 [ 4]: -unittest

command line files: ...............
 [ 0]: org/dsource/koth/test.d

declared source files: ...............
 [ 0]: org/dsource/koth/test.d

import roots: .................
 [ 0]: /opt/dmd/src/phobos/
 [ 1]: /dv/d/mango/
 [ 2]: org/dsource/koth/


and even better:
Code:

> ./test
Hello World!
>


BA
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