digitalmars.D.learn - rdmd & exception def & multiple files
- Charles Hixson (40/40) Aug 29 2012 Is the following expected?
- Dmitry Olshansky (5/22) Aug 29 2012 It should work with plain rdmd --main -unittest avl.d that's the whole
- Charles Hixson (4/25) Aug 29 2012 You were right. That worked. Where should I look to better understand
- Andrei Alexandrescu (5/8) Aug 29 2012 http://dlang.org/rdmd.html
- Charles Hixson (22/30) Aug 29 2012 Thank you. Unfortunately, that page doesn't address the symptoms that
- Andrei Alexandrescu (4/31) Aug 29 2012 You should be able to use rdmd for that dependency pattern, and if not
- Charles Hixson (3/37) Aug 29 2012 The only one I have is about 450 lines long. If you want I could send
- Dmitry Olshansky (9/50) Aug 30 2012 This is the place to report bugs (including big and obscure ones):
- Charles Hixson (16/68) Aug 30 2012 Perhaps I don't know enough to file a decent bug report...at least when
- cal (10/13) Aug 30 2012 Dustmite refers to this tool:
- Charles Hixson (8/19) Aug 31 2012 Thank you for the pointer to DustMite. It looks like it might be quite
- cal (2/4) Aug 31 2012 And does rdmd compilation still fail with the reduced case?
- Charles Hixson (15/19) Aug 31 2012 No. But there were even more complex versions in which it also didn't
- anonymous (9/20) Aug 31 2012 A big test is worse than a small one, but still better than no
- Charles Hixson (21/48) Aug 29 2012 Well, it worked until I started "depending on it". Then it stopped.
- Philippe Sigaud (8/13) Aug 29 2012 FWIW, in my own projects, I started having *lots* of linker errors
Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line, next ); } } In the same file as the rest of the program, rdmd --main -unittest avl.d had no trouble with it, but when I put it in a separate file, while: dmd -c -unittest avl.d utils.d accepted it without complaint, rdmd responded with: rdmd --main -unittest avl.d utils.d /tmp/.rdmd-1000/rdmd-avl.d-EFC2A8F3F9817BAA59A3A00532D5696F/objs/avl.o: In function `_D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3avl3AVL4Node': /tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3 vl3AVL4Node+0x10d): undefined reference to `_D5utils10LogicError7__ClassZ' /tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3 vl3AVL4Node+0x144): undefined reference to `_D5utils10LogicError6__ctorMFAyamC6object9ThrowableZC5utils10LogicError' /tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3 vl3AVL4Node+0x273): undefined reference to `_D5utils10LogicError7__ClassZ' /tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3 vl3AVL4Node+0x2aa): undefined reference to `_D5utils10LogicError6__ctorMFAyamC6object9ThrowableZC5utils10LogicError' /tmp/.rdmd-1000/rdmd-avl.d-EFC2A8F3F9817BAA59A3A00532D5696F/objs/avl.o: In function `_D3avl3AVL9delLftBalMFKC3avl3AVL4NodeKbZC3avl3AVL4Node': /tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL9delLftBalMFKC3avl3AVL4NodeKbZC avl3AVL4Node+0x3f): undefined reference to `_D5utils10LogicError7__ClassZ' /tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL9delLftBalMFKC3avl3AVL4NodeKbZC avl3AVL4Node+0x76): undefined reference to `_D5utils10LogicError6__ctorMFAyamC6object9ThrowableZC5utils10LogicError' collect2: ld returned 1 exit status --- errorlevel 1 Is this expected?
Aug 29 2012
On 30-Aug-12 00:14, Charles Hixson wrote:Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line, next ); } } In the same file as the rest of the program, rdmd --main -unittest avl.d had no trouble with it, but when I put it in a separate file, while: dmd -c -unittest avl.d utils.d accepted it without complaint, rdmd responded with: rdmd --main -unittest avl.d utils.dIt should work with plain rdmd --main -unittest avl.d that's the whole point of rdmd actually. -- Olshansky Dmitry
Aug 29 2012
On 08/29/2012 01:36 PM, Dmitry Olshansky wrote:On 30-Aug-12 00:14, Charles Hixson wrote:You were right. That worked. Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line, next ); } } In the same file as the rest of the program, rdmd --main -unittest avl.d had no trouble with it, but when I put it in a separate file, while: dmd -c -unittest avl.d utils.d accepted it without complaint, rdmd responded with: rdmd --main -unittest avl.d utils.dIt should work with plain rdmd --main -unittest avl.d that's the whole point of rdmd actually.
Aug 29 2012
On 8/29/12 3:47 PM, Charles Hixson wrote:Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html Andrei
Aug 29 2012
On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:On 8/29/12 3:47 PM, Charles Hixson wrote:Thank you. Unfortunately, that page doesn't address the symptoms that I've been experiencing, which while they don't halt development certainly confuse it. It's starting to look as if while I use rdmd I'll need to keep everything in one file, as otherwise I can't share exceptions between classes. (And I'm only guessing that the problem is limited to exceptions, as I haven't tested with other functions.) Since the small test programs DO call successfully between different files (including for exceptions) I don't really have a clue as to what's going on, except that it appears to happen during linking. And combining the routines into one file appears to "fix" the problem. And that dmd doesn't seem to have the same problem. (I.e., if I add a dummy main routine to the avl.d file, then dmd -unittest avl.d utils.d compiles and executes without problems, even though it doesn't do anything. FWIW: charles mandala1:~$ dmd DMD64 D Compiler v2.060 Copyright (c) 1999-2012 by Digital Mars written by Walter Bright Documentation: http://www.dlang.org/index.html Usage:Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html Andrei
Aug 29 2012
On 8/29/12 4:52 PM, Charles Hixson wrote:On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:You should be able to use rdmd for that dependency pattern, and if not there's a bug in it. However, nobody can work on that without a test case. AndreiOn 8/29/12 3:47 PM, Charles Hixson wrote:Thank you. Unfortunately, that page doesn't address the symptoms that I've been experiencing, which while they don't halt development certainly confuse it. It's starting to look as if while I use rdmd I'll need to keep everything in one file, as otherwise I can't share exceptions between classes. (And I'm only guessing that the problem is limited to exceptions, as I haven't tested with other functions.) Since the small test programs DO call successfully between different files (including for exceptions) I don't really have a clue as to what's going on, except that it appears to happen during linking. And combining the routines into one file appears to "fix" the problem. And that dmd doesn't seem to have the same problem. (I.e., if I add a dummy main routine to the avl.d file, then dmd -unittest avl.d utils.d compiles and executes without problems, even though it doesn't do anything.Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html Andrei
Aug 29 2012
On 08/29/2012 06:46 PM, Andrei Alexandrescu wrote:On 8/29/12 4:52 PM, Charles Hixson wrote:The only one I have is about 450 lines long. If you want I could send it to you. (I probably shouldn't just post it.)On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:You should be able to use rdmd for that dependency pattern, and if not there's a bug in it. However, nobody can work on that without a test case. AndreiOn 8/29/12 3:47 PM, Charles Hixson wrote:Thank you. Unfortunately, that page doesn't address the symptoms that I've been experiencing, which while they don't halt development certainly confuse it. It's starting to look as if while I use rdmd I'll need to keep everything in one file, as otherwise I can't share exceptions between classes. (And I'm only guessing that the problem is limited to exceptions, as I haven't tested with other functions.) Since the small test programs DO call successfully between different files (including for exceptions) I don't really have a clue as to what's going on, except that it appears to happen during linking. And combining the routines into one file appears to "fix" the problem. And that dmd doesn't seem to have the same problem. (I.e., if I add a dummy main routine to the avl.d file, then dmd -unittest avl.d utils.d compiles and executes without problems, even though it doesn't do anything.Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html Andrei
Aug 29 2012
On 30-Aug-12 09:40, Charles Hixson wrote:On 08/29/2012 06:46 PM, Andrei Alexandrescu wrote:This is the place to report bugs (including big and obscure ones): http://d.puremagic.com/issues/ The only requirement is to clear reproducible problem statement like this command fails with this on dmd version xx. As for size, well there is dustmite test case reduction tool that sometimes does miracles. -- Olshansky DmitryOn 8/29/12 4:52 PM, Charles Hixson wrote:The only one I have is about 450 lines long. If you want I could send it to you. (I probably shouldn't just post it.)On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:You should be able to use rdmd for that dependency pattern, and if not there's a bug in it. However, nobody can work on that without a test case. AndreiOn 8/29/12 3:47 PM, Charles Hixson wrote:Thank you. Unfortunately, that page doesn't address the symptoms that I've been experiencing, which while they don't halt development certainly confuse it. It's starting to look as if while I use rdmd I'll need to keep everything in one file, as otherwise I can't share exceptions between classes. (And I'm only guessing that the problem is limited to exceptions, as I haven't tested with other functions.) Since the small test programs DO call successfully between different files (including for exceptions) I don't really have a clue as to what's going on, except that it appears to happen during linking. And combining the routines into one file appears to "fix" the problem. And that dmd doesn't seem to have the same problem. (I.e., if I add a dummy main routine to the avl.d file, then dmd -unittest avl.d utils.d compiles and executes without problems, even though it doesn't do anything.Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html Andrei
Aug 30 2012
On 08/30/2012 09:17 AM, Dmitry Olshansky wrote:On 30-Aug-12 09:40, Charles Hixson wrote:Perhaps I don't know enough to file a decent bug report...at least when I can't reduce the test case that shows it significantly. I think you know a lot more than I do. E.g., "dustmite test case reduction" doesn't mean much of anything to me. Google, as expected, leads me to a bunch of adds for insect control. (Well, not literally, as mites aren't insects.) Even though Google had to add a space into dustmite and ignore the search term "computer program". I can sort of tell what you mean from context, but "sort of" doesn't lead to an idea of how to proceed. (FWIW, even debuggers are tools that I'm rather unfamiliar with. I generally finesse that by using print statements. But anything fancier and I don't even understand the terminology. I may have programmed Fortran on 7094 IBSYS, but I came to D from Python and Ruby, and I've never learned the compiler code tools on Linux. I'd have better luck debugging CDC Fortran...and that's 3-4 decades ago.)On 08/29/2012 06:46 PM, Andrei Alexandrescu wrote:This is the place to report bugs (including big and obscure ones): http://d.puremagic.com/issues/ The only requirement is to clear reproducible problem statement like this command fails with this on dmd version xx. As for size, well there is dustmite test case reduction tool that sometimes does miracles.On 8/29/12 4:52 PM, Charles Hixson wrote:The only one I have is about 450 lines long. If you want I could send it to you. (I probably shouldn't just post it.)On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:You should be able to use rdmd for that dependency pattern, and if not there's a bug in it. However, nobody can work on that without a test case. AndreiOn 8/29/12 3:47 PM, Charles Hixson wrote:Thank you. Unfortunately, that page doesn't address the symptoms that I've been experiencing, which while they don't halt development certainly confuse it. It's starting to look as if while I use rdmd I'll need to keep everything in one file, as otherwise I can't share exceptions between classes. (And I'm only guessing that the problem is limited to exceptions, as I haven't tested with other functions.) Since the small test programs DO call successfully between different files (including for exceptions) I don't really have a clue as to what's going on, except that it appears to happen during linking. And combining the routines into one file appears to "fix" the problem. And that dmd doesn't seem to have the same problem. (I.e., if I add a dummy main routine to the avl.d file, then dmd -unittest avl.d utils.d compiles and executes without problems, even though it doesn't do anything.Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html Andrei
Aug 30 2012
On Friday, 31 August 2012 at 04:00:34 UTC, Charles Hixson wrote:Perhaps I don't know enough to file a decent bug report...at least when I can't reduce the test case that shows it significantly.Dustmite refers to this tool: https://github.com/CyberShadow/DustMite Basically it tries to compile your program, and while compilation continues to fail, it repeatedly tries to strip away parts of the program until your are left with the minimal amount of code required for compilation to fail. It is rather neat. You could throw your code up on http://dpaste.dzfl.pl/new or something and someone could take a look, it is just hard to speculate without seeing any code...
Aug 30 2012
On 08/30/2012 10:46 PM, cal wrote:On Friday, 31 August 2012 at 04:00:34 UTC, Charles Hixson wrote:Thank you for the pointer to DustMite. It looks like it might be quite useful in other cases. But... So I tried to use DustMite. This just got weirder. Apparently if the name of the containing folder isn't Parser (I was working with a copy), then the error doesn't occur. If I ran DustMite on the original, the program got reduced down to "void main () { }" (with some extra whitespace). N.B.: dmd doesn't have a problem with the code, only rdmd.Perhaps I don't know enough to file a decent bug report...at least when I can't reduce the test case that shows it significantly.Dustmite refers to this tool: https://github.com/CyberShadow/DustMite Basically it tries to compile your program, and while compilation continues to fail, it repeatedly tries to strip away parts of the program until your are left with the minimal amount of code required for compilation to fail. It is rather neat. You could throw your code up on http://dpaste.dzfl.pl/new or something and someone could take a look, it is just hard to speculate without seeing any code...
Aug 31 2012
On Friday, 31 August 2012 at 17:14:25 UTC, Charles Hixson wrote:If I ran DustMite on the original, the program got reduced down to "void main () { }" (with some extra whitespace).And does rdmd compilation still fail with the reduced case?
Aug 31 2012
On 08/31/2012 11:28 AM, cal wrote:On Friday, 31 August 2012 at 17:14:25 UTC, Charles Hixson wrote:No. But there were even more complex versions in which it also didn't fail. For instance I could import utils.d (the addition of which caused the original to stop working) and throw a LogicError (defined in utils.d) and it didn't crash. So I only have the large case...and even there, I've been working on the project, as dmd doesn't give any problems, and so I can't guarantee without checking again that it still fails. But since nobody wants a 500 line test case (and I don't blame them...particularly since it appears that if I move it into a folder with a different name it stops failing), I haven't been preserving the case. Last time I checked it still failed with rdmd in the Parser folder, but that was hours ago. There haven't been many changes, but there've been some. And I can't even preserve it by copying it into another folder, because then it stops failing.If I ran DustMite on the original, the program got reduced down to "void main () { }" (with some extra whitespace).And does rdmd compilation still fail with the reduced case?
Aug 31 2012
On Friday, 31 August 2012 at 20:20:42 UTC, Charles Hixson wrote:So I only have the large case...and even there, I've been working on the project, as dmd doesn't give any problems, and so I can't guarantee without checking again that it still fails. But since nobody wants a 500 line test case (and I don't blame them...particularly since it appears that if I move it into a folder with a different name it stops failing), I haven't been preserving the case. Last time I checked it still failed with rdmd in the Parser folder, but that was hours ago. There haven't been many changes, but there've been some. And I can't even preserve it by copying it into another folder, because then it stops failing.A big test is worse than a small one, but still better than no test case whatsoever. If you provide your 500 lines, someone might be able to spot an already known issue (e.g. you may be hitting issue 7016 [1]), or someone is willing to reduce it further. At the very least, it's in the database and can be dealt with sooner or later. [1] "local import does not create -deps dependency" - http://d.puremagic.com/issues/show_bug.cgi?id=7016
Aug 31 2012
On 08/29/2012 03:47 PM, Charles Hixson wrote:On 08/29/2012 01:36 PM, Dmitry Olshansky wrote:Well, it worked until I started "depending on it". Then it stopped. So I guess that, at least for exceptions, they need to be defined within the same file that they are used for rdmd to be happy with them, though clearly that's not true for the standard libraries. And I don't know where the boundaries are. This is particularly weird, because when I try to create a simple example case it doesn't display the problem. Not too surprisingly it depends on the presence of the unittest parameter, though even that's a little surprising as I haven't yet added any unit tests. Still, without the unittest it isn't even thinking of executing anything. Still, for some reason if the exception is defined in a separate file (utils.d) it can't find the symbol. I even tried including utils.o instead of utils.d. No change. FWIW, I invoke the exception with: default: assert (false, "internal logic error"); throw new LogicError (); in a few places. As I said, I haven't written the unittests yet, so even the assert has never been called. Still, that's a consideration that happens much after linking.On 30-Aug-12 00:14, Charles Hixson wrote:You were right. That worked. Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach.Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line, next ); } } In the same file as the rest of the program, rdmd --main -unittest avl.d had no trouble with it, but when I put it in a separate file, while: dmd -c -unittest avl.d utils.d accepted it without complaint, rdmd responded with: rdmd --main -unittest avl.d utils.dIt should work with plain rdmd --main -unittest avl.d that's the whole point of rdmd actually.
Aug 29 2012
On Thu, Aug 30, 2012 at 1:09 AM, Charles Hixson <charleshixsn earthlink.net> wrote:Well, it worked until I started "depending on it". Then it stopped. So I guess that, at least for exceptions, they need to be defined within the same file that they are used for rdmd to be happy with them, though clearly that's not true for the standard libraries. And I don't know where the boundaries are.FWIW, in my own projects, I started having *lots* of linker errors with rdmd recently, when I changed to 2.060. I don't know if that comes from dmd proper or rdmd, but now half my compilation cycles fail and I had to downgrade to using DMD directly. And I'm not using exception, nor classes but lot of templates. I think it'll be Dustmite time.
Aug 29 2012