D packages, include directories, and rdmd

Andrew Pennebaker andrew.pennebaker at gmail.com
Thu Oct 27 15:42:41 PDT 2011


In addition, I can't even use a naked -I directive without all the
dmd.conf/DFLAGS stuff.

My module code is in ~/Desktop/src/dashcheck. But even with the -Ipath
directive, dmd still can't find it.

$ dmd example.d -I~/Desktop/src/dashcheck
Undefined symbols for architecture i386:
  "_D9dashcheck12__ModuleInfoZ", referenced from:
      _D7example12__ModuleInfoZ in example.o
  "_D9dashcheck9genStringFZAya", referenced from:
      anon in example.o
  "_D9dashcheck6genIntFZi", referenced from:
      anon in example.o
      _D7example7genEvenFZi in example.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
--- errorlevel 1

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Thu, Oct 27, 2011 at 6:28 PM, Nick Sabalausky <a at a.a> wrote:

> "Andrew Pennebaker" <andrew.pennebaker at gmail.com> wrote in message
> news:mailman.543.1319752640.24802.digitalmars-d at puremagic.com...
> > I've got a single-file D module,
> > dashcheck.d<https://github.com/mcandre/dashcheck>,
> > that I'd like to install as a local package. In other words, I'd like to
> > be
> > able to "import dashcheck;" from any directory.
> >
> > I put dashcheck.d in ~/.d/, and I put export DFLAGS=-I~/.d in ~/.profile,
> > but when I try to run example.d from another directory, I get:
> >
> > $ ./example.d
> > ./example.d(3): Error: module dashcheck is in file 'dashcheck.d' which
> > cannot be read
> > import path[0] = /usr/local/Cellar/dmd/2.051/src/phobos
> > import path[1] = /usr/local/Cellar/dmd/2.051/src/druntime/importCheers,
> >
> > It appears that rdmd ignores $DFLAGS.
> >
>
> I guess DFLAGS isn't an env var (which actually surprises me, it probably
> should be, is there already an enhancement request in bugzilla for that? Is
> is there some deliberate reason for this?).
>
> DFLAGS is normally set in your dmd.conf file (sc.ini on Windows). Do a
> "which dmd" to see where your dmd binary is, and your dmd.conf will be in
> the same directory (at least if you used the .zip releases or DVM, I don't
> know where the distros will put dmd.conf).
>
> Another approach that many of us use is to just pass the -Ipath option to
> dmd or rdmd in your buildscript to tell dmd/rdmd where to look for look for
> imports (sort of the D counterpart to Java's classpaths).
>
> > Also, when I change the shebang in example.d to #!/usr/bin/env rdmd
> > $DFLAGS,
> > I get:
> >
> > $ ./example.d
> > sh: -I~/.d.d.deps: No such file or directory
> >
> > So I'm not using import directives correctly. How do I generate
> > dashcheck.d.deps?
> >
>
> Part of the problem here is the same as above, DFLAGS needs to be set in
> dmd.conf, not an env var. But also, when you use rdmd as a shebang, you
> should use the --shebang option (always as the first argument), ie:
>
> #!/usr/bin/env rdmd --shebang {whatever other options here}
>
> Apperently, shebangs tend to mess up the params that get sent to rdmd, and
> the --shebang makes it use an alternate approach made specifically for that
> situation.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111027/e2d5640e/attachment.html>


More information about the Digitalmars-d mailing list