digitalmars.D - finding a circular dependency
- Steven Schveighoffer (13/13) Jun 21 2010 I've been trying to get a modified version of std.process to compile (wi...
- Ellery Newcomer (3/16) Jun 21 2010 A long time ago I wrote a utility that finds these cycles. I'll see if I...
- Robert Jacques (5/18) Jun 21 2010 Templates and particularly type inference (i.e. auto variables and auto ...
- torhu (3/13) Jun 21 2010 Did you add any imports at all? Try commenting them and any code that
- Rory McGuire (4/17) Jun 22 2010 doesn't -verbose list the modules dmd is importing? Perhaps it stops at ...
- Steven Schveighoffer (4/27) Jun 22 2010 It's a runtime issue, not a compiler issue.
- Rory McGuire (7/36) Jun 22 2010 Doh! now I remember, its because of the static constructors having a
- Lars T. Kyllingstad (12/31) Jun 22 2010 I think the only places that exception can be thrown are lines 1770 and
- Steven Schveighoffer (7/37) Jun 22 2010 This is a good idea.
- Ellery Newcomer (3/16) Jun 24 2010 Hey Steve, if you haven't found your cycle yet, could you send me the
- Steven Schveighoffer (15/37) Jun 24 2010 I did find it, and I will eventually incorporate my code which prints th...
I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -Steve
Jun 21 2010
On 06/21/2010 01:51 PM, Steven Schveighoffer wrote:I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -SteveA long time ago I wrote a utility that finds these cycles. I'll see if I can't kick-start it for D2.
Jun 21 2010
On Mon, 21 Jun 2010 14:51:01 -0400, Steven Schveighoffer <schveiguy yahoo.com> wrote:I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -SteveTemplates and particularly type inference (i.e. auto variables and auto returns, etc) are common sources of forward reference, etc issues. Also, I'd recommend diff-ing the code bases to see exactly what you changed.
Jun 21 2010
On 21.06.2010 20:51, Steven Schveighoffer wrote:I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle?Did you add any imports at all? Try commenting them and any code that depends on them out.
Jun 21 2010
On Mon, 21 Jun 2010 20:51:01 +0200, Steven Schveighoffer <schveiguy yahoo.com> wrote:I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -Stevedoesn't -verbose list the modules dmd is importing? Perhaps it stops at the offending module?
Jun 22 2010
On Tue, 22 Jun 2010 03:14:38 -0400, Rory McGuire <rmcguire neonova.co.za> wrote:On Mon, 21 Jun 2010 20:51:01 +0200, Steven Schveighoffer <schveiguy yahoo.com> wrote:It's a runtime issue, not a compiler issue. -SteveI've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -Stevedoesn't -verbose list the modules dmd is importing? Perhaps it stops at the offending module?
Jun 22 2010
On Tue, 22 Jun 2010 13:02:53 +0200, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Tue, 22 Jun 2010 03:14:38 -0400, Rory McGuire <rmcguire neonova.co.za> wrote:Doh! now I remember, its because of the static constructors having a specific order (from tdpl). And it only does construction when you run the app, not when compiling. (elaborating on your reply). ThanksOn Mon, 21 Jun 2010 20:51:01 +0200, Steven Schveighoffer <schveiguy yahoo.com> wrote:It's a runtime issue, not a compiler issue. -SteveI've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -Stevedoesn't -verbose list the modules dmd is importing? Perhaps it stops at the offending module?
Jun 22 2010
On Mon, 21 Jun 2010 14:51:01 -0400, Steven Schveighoffer wrote:I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -SteveI think the only places that exception can be thrown are lines 1770 and 1830 of object.d. Luckily there are a few debug(PRINTF)printf()s nearby. You could try building druntime with -debug=PRINTF. When the static constructors are run, hopefully you'll see something like ... module[x] = std.stdio ... module[y] = module.depending.cyclically.on.stdio module[z] = std.stdio object.Exception: Cyclic dependency in module std.stdio. -Lars
Jun 22 2010
On Tue, 22 Jun 2010 05:04:18 -0400, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:On Mon, 21 Jun 2010 14:51:01 -0400, Steven Schveighoffer wrote:This is a good idea. I'm going to look at the runtime to see if I can add code that prints the cycle only on failure. I think such code could be invaluable. I wonder if a stack trace would be enough... -SteveI've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -SteveI think the only places that exception can be thrown are lines 1770 and 1830 of object.d. Luckily there are a few debug(PRINTF)printf()s nearby. You could try building druntime with -debug=PRINTF. When the static constructors are run, hopefully you'll see something like ... module[x] = std.stdio ... module[y] = module.depending.cyclically.on.stdio module[z] = std.stdio object.Exception: Cyclic dependency in module std.stdio.
Jun 22 2010
On 06/21/2010 01:51 PM, Steven Schveighoffer wrote:I've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -SteveHey Steve, if you haven't found your cycle yet, could you send me the source code? My utility is a bit of a mess, but I think it's working now.
Jun 24 2010
On Thu, 24 Jun 2010 10:27:29 -0400, Ellery Newcomer <ellery-newcomer utulsa.edu> wrote:On 06/21/2010 01:51 PM, Steven Schveighoffer wrote:I did find it, and I will eventually incorporate my code which prints the cycle when it's found (it will be completely non-intrusive and not affect the startup performance unless a cycle is found). However, in trying to print the cycle, I've found a really disturbing bug that needs to be addressed first http://d.puremagic.com/issues/show_bug.cgi?id=4384 Also, equally disappointing, I found that the reason the cycle was added was to workaround a bug in dmd (specifically http://d.puremagic.com/issues/show_bug.cgi?id=3979). Without the code that creates the cycle, phobos doesn't compile. With the code, any program linked with phobos fails. Lovely... Great, I just gave myself more work when I was trying to just finish std.process! -SteveI've been trying to get a modified version of std.process to compile (with Lars K's changes) for windows, and phobos finally compiled. So I built a little test program, compiled it, and I get the following error message: object.Exception: circular dependency in module std.stdio. Great. How did that happen? Being that I didn't write std.stdio, only modified it slightly (and certainly didn't change any imports), I haven't the foggiest where this problem is. Given that the runtime can prove there is a circular dependency, and apparently knows the names of the modules, how about showing me the cycle? :P I do not look forward to tracking this one down... -SteveHey Steve, if you haven't found your cycle yet, could you send me the source code? My utility is a bit of a mess, but I think it's working now.
Jun 24 2010