Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building using --rdmd flag ignores mainSourceFile build setting #255

Closed
nomad-software opened this issue Feb 18, 2014 · 12 comments
Closed
Labels
Milestone

Comments

@nomad-software
Copy link

Here is my package.json file:

{
    "name": "tkd",
    "description": "GUI toolkit for the D programming language based on Tcl/Tk",
    "homepage": "https://github.com/nomad-software/tkd",
    "authors": ["Gary Willoughby"],
    "copyright": "Copyright (c) 2014 Gary Willoughby",
    "license": "MIT",
    "dependencies": {
        "tcltk": "~master",
    },
    "configurations": [
        {
            "name": "library",
            "targetType": "library",
            "excludedSourceFiles": ["source/example.d"],
        },
        {
            "name": "example",
            "targetType": "executable",
            "mainSourceFile": "source/example.d",
            "lflags-windows": ["/subsystem:windows"],
            "dflags": ["-Jmedia"],
        },
    ],
}

If i build using the following command, all works as expected:

dub --config=example

but if i build using the following command, i get an error:

dub --rdmd --config=example
Error: cannot read file source/app.d
Failed: 'dmd' '-Jmedia' '-debug' '-g' '-w' '-version=Have_tkd' '-version=Have_tcltk' '-version=Have_x11' '-Isource' '-I../../../../../home/gary/.dub/packages/tcltk-master/source' '-I../../../../../home/gary/.dub/packages/x11-master/source' '-L-ltcl' '-L-ltk' '-v' '-o-' 'source/app.d' '-Isource'
Error: Build command failed with exit code 1

Why should it look for source/app.d when i've specified source/example.d as my mainSourceFile?

@vuaru vuaru mentioned this issue Feb 25, 2014
@s-ludwig
Copy link
Member

Seems to work correctly on DUB 0.9.21 (with #263 out of the way).

@s-ludwig s-ludwig added the fixed label Feb 26, 2014
@nomad-software
Copy link
Author

I still can't get it to build my project, maybe you could take a look?

Download the project from here: https://github.com/nomad-software/tcltk

building works with:

dub

but the following fails:

dub --rdmd
x11: ["x11"]
tcltk: ["tcltk", "x11"]
Building configuration tcltk-import, build type debug
Running rdmd...
Error: cannot read file ../../.dub/packages/x11-master/source/app.d
Failed: 'dmd' '-debug' '-g' '-w' '-version=Have_x11' '-I../../.dub/packages/x11-master/source' '-lib' '-v' '-o-' '../../.dub/packages/x11-master/source/app.d' '-I../../.dub/packages/x11-master/source'
Error executing command run: Build command failed with exit code 1

It looks like it expects all dependencies to have an existing app.d file.

@s-ludwig
Copy link
Member

I see, there are two issues:

  1. DUB should imply --combined for --rdmd because building dependencies separately would just be wasted work and most libraries won't have the required "mainSourceFile" anyway.
  2. The package.json in the repository in this case actually has no "mainSourceFile" defined, but with one, compilation works using dub --rdmd --combined

I'll fix 1 now.

s-ludwig added a commit that referenced this issue Feb 27, 2014
Since RDMD already builds everything at once, this would be useless
work and many dependencies don't have the required
mainSourceFile, so that it would make the compilation fail.
@nomad-software
Copy link
Author

I've tried building my repo at https://github.com/nomad-software/tkd using dub --rdmd --combined --config=example and i still get lots of errors. See if you have any joy.

@s-ludwig s-ludwig removed the fixed label Apr 1, 2014
@s-ludwig s-ludwig added this to the 0.9.22 milestone Apr 1, 2014
@s-ludwig s-ludwig added the bug label Apr 21, 2014
@s-ludwig
Copy link
Member

Works for me with the latest GIT master of DUB, also without --combined. I had to fix the example config, though: "mainSourceFile": "source/examples/example5.d",

@nomad-software
Copy link
Author

Hmmm.. i've just tried with git master and get this:

$ dub --rdmd --config=example5
x11: ["x11"]
tcltk: ["tcltk", "x11"]
tkd: ["tkd", "tcltk", "x11"]
Building configuration library, build type debug
Running rdmd...
Error: cannot read file ../../../../../home/gary/.dub/packages/x11-master/source/app.d
Failed: ["dmd", "-debug", "-g", "-w", "-version=Have_x11", "-I../../../../../home/gary/.dub/packages/x11-master/source", "-lib", "-v", "-o-", "../../../../../home/gary/.dub/packages/x11-master/source/app.d", "-I../../../../../home/gary/.dub/packages/x11-master/source"]
Error executing command run: Build command failed with exit code 1

@s-ludwig
Copy link
Member

Hm OK, my test was on Windows. Will retry on Linux.

@s-ludwig
Copy link
Member

This is my result on Linux:

WARNING: A deprecated branch based version specification is used for the dependency tcltk. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
Building configuration example5, build type debug
Running rdmd...
/tmp/.rdmd-1000/rdmd-example5.d-ABE07F288BB66948A897BD3B8908F579/objs/example5.o: In Funktion `Tcl_Main':
/home/sludwig/develop/tkd/../../.dub/packages/tcltk-master/source/tcltk/tcl.d:2116: Nicht definierter Verweis auf `Tcl_MainEx'
collect2: error: ld returned 1 exit status
--- errorlevel 1
Error executing command run: Build command failed with exit code 1

with DUB version 0.9.22-beta.2+40-g4a777ea

Maybe there is something wrong with the cached packages and a rm -rf ~/.dub/packages helps?

@nomad-software
Copy link
Author

Thanks, i'll take another look tomorrow.

@nomad-software
Copy link
Author

I removed all the cached packages and things seem to build fine now. :) I just get the following warning, i'm not sure what this means:

WARNING: A deprecated branch based version specification is used for the dependency tcltk. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.

What exactly does this mean?

@s-ludwig
Copy link
Member

It's a warning message to start the migration to a purely version based package system. See also this thread for the rationale. There is no immediate need for action, but the idea is that at some point all packages will have version tags and reference each other using version based dependencies.

There are a few facilities in place to make this as painless as possible when working with git working copies (local overrides, treating checked out branches as the latest tagged version which they originate of, allowing branch based dependencies in dub.selections.json). I'll write a proper text with explanations and instructions for the next DUB release.

@nomad-software
Copy link
Author

Ah right, good! I've updated my packages to use versions. Much more sane idea! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants