Jump to page: 1 2 3
Thread overview
Program exited with code -11
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
Adam D. Ruppe
Jun 23, 2015
Adam D. Ruppe
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
weaselcat
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
Baz
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
anonymous
Jun 23, 2015
Charles Hawkins
Jun 23, 2015
Baz
Jun 24, 2015
weaselcat
Jun 24, 2015
Charles Hawkins
Jun 24, 2015
weaselcat
Help the old man learn D
Jun 26, 2015
Charles Hawkins
Jun 26, 2015
Marc Schütz
Jun 26, 2015
Charles Hawkins
Jun 26, 2015
Charles Hawkins
Jun 26, 2015
Marc Schütz
Jun 27, 2015
Charles Hawkins
June 23, 2015
My first attempt at a significant D program and I'm getting:
Error executing command run:
Program exited with code -11

How do I find out what that means?
June 23, 2015
On Tuesday, 23 June 2015 at 02:34:17 UTC, Charles Hawkins wrote:
> How do I find out what that means?

Many return codes have a meaning in the linux documentation:

http://www.tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF

(it lists them as unsigned, but you got a signed result. 128 == -1, so -11 falls under the 128+ section in that table)


-11 means it exited with signal 11. Do "man 7 signal" in linux to get the signal documentation overview. One of the lines there is:

       SIGSEGV      11       Core    Invalid memory reference


Signal #11 is segmentation fault.



Since you're a D newbie, I'm guessing you made the mistake of forgetting to new a class before using it:

class Foo {}

void main() {
   Foo foo;
   foo.something(); // this will segfault, killing the program
}


That's different than C++, D's classes are more like Java. You need to:

Foo foo = new Foo();

or

auto foo = new Foo();

so it isn't a null reference.
June 23, 2015
On Tuesday, 23 June 2015 at 02:45:24 UTC, Adam D. Ruppe wrote:
> 128 == -1

I'm sorry, I need to stop posting these things without thinking. -1 is actually 255 when you cast it, but I'm pretty sure the shell just does that subtraction from 128 because of the signal reservation codes. I stand by the rest of the post...
June 23, 2015
Thanks, Adam.  I'm coming from OCaml and haven't seen a seg fault in years.  Didn't recognize it. :D  Hopefully I can figure it out from here.
June 23, 2015
On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote:
> Thanks, Adam.  I'm coming from OCaml and haven't seen a seg fault in years.  Didn't recognize it. :D  Hopefully I can figure it out from here.

Try to compile with either ldc or gdc and the -g flag, it should give you a backtrace. dmd seems to not like linux wrt backtraces.
June 23, 2015
On Tuesday, 23 June 2015 at 03:31:37 UTC, weaselcat wrote:
> On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote:
>> Thanks, Adam.  I'm coming from OCaml and haven't seen a seg fault in years.  Didn't recognize it. :D  Hopefully I can figure it out from here.
>
> Try to compile with either ldc or gdc and the -g flag, it should give you a backtrace. dmd seems to not like linux wrt backtraces.

Thanks.  I wish!  I haven't had any success in compiling with anything but dub.  gdc, dmd, rdmd always give me "module mylib is in file 'mylib.d' which cannot be read" on my "import mylib;" statement.  I've tried every permutation of -I and -L that I can think of.  It almost appears that one either uses dub for everything or nothing and I'm getting pretty frustrated with it as well.  Perhaps I should just go back to old-fashioned make files?
June 23, 2015
On Tuesday, 23 June 2015 at 06:50:28 UTC, Charles Hawkins wrote:
> On Tuesday, 23 June 2015 at 03:31:37 UTC, weaselcat wrote:
>> On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote:
>>> Thanks, Adam.  I'm coming from OCaml and haven't seen a seg fault in years.  Didn't recognize it. :D  Hopefully I can figure it out from here.
>>
>> Try to compile with either ldc or gdc and the -g flag, it should give you a backtrace. dmd seems to not like linux wrt backtraces.
>
> Thanks.  I wish!  I haven't had any success in compiling with anything but dub.  gdc, dmd, rdmd always give me "module mylib is in file 'mylib.d' which cannot be read" on my "import mylib;" statement.  I've tried every permutation of -I and -L that I can think of.  It almost appears that one either uses dub for everything or nothing and I'm getting pretty frustrated with it as well.  Perhaps I should just go back to old-fashioned make files?

in dmd you have to pass
- the .lib/.a files a source
- the path to the lib source with '-I'. Sometimes when the path is not well indicated you get the error you talk about. This is because the '-I' path must follow carefully the structure of the lib, e.g

'import myLib.package.moduleThis':
the '-I' must point to the folder that contains the folder 'myLib'.


June 23, 2015
On Tuesday, 23 June 2015 at 07:25:05 UTC, Baz wrote:
> On Tuesday, 23 June 2015 at 06:50:28 UTC, Charles Hawkins wrote:
>> On Tuesday, 23 June 2015 at 03:31:37 UTC, weaselcat wrote:
>>> On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote:
>>>> Thanks, Adam.  I'm coming from OCaml and haven't seen a seg fault in years.  Didn't recognize it. :D  Hopefully I can figure it out from here.
>>>
>>> Try to compile with either ldc or gdc and the -g flag, it should give you a backtrace. dmd seems to not like linux wrt backtraces.
>>
>> Thanks.  I wish!  I haven't had any success in compiling with anything but dub.  gdc, dmd, rdmd always give me "module mylib is in file 'mylib.d' which cannot be read" on my "import mylib;" statement.  I've tried every permutation of -I and -L that I can think of.  It almost appears that one either uses dub for everything or nothing and I'm getting pretty frustrated with it as well.  Perhaps I should just go back to old-fashioned make files?
>
> in dmd you have to pass
> - the .lib/.a files a source
> - the path to the lib source with '-I'. Sometimes when the path is not well indicated you get the error you talk about. This is because the '-I' path must follow carefully the structure of the lib, e.g
>
> 'import myLib.package.moduleThis':
> the '-I' must point to the folder that contains the folder 'myLib'.

Sigh.  I'm probably doing something stupid.  I tried full paths:
dmd -I+/home/charles/projects/d/mylib/source/mylib/ myprog.d /home/charles/projects/d/mylib/build/libmylib.a
Same result.
myprog.d(4) Error: module mylib is in file 'mylib.d' which cannot be read
Statement in myprog is:
import mylib;

I used tab expansion so I'm confident everything is spelled correctly.  Since dub will compile it, I also tried copying and pasting its entry from the local packages file (leaves off the "source/mylib/").  Is there a way to find out what command dub is passing to dmd?
June 23, 2015
Ok, I think I've answered my own question.  dub -v tells me what I need to know.  Looks like I need to do a separate compile & link, make file like, just like the old days, or have a very complicated command line.  However, if there is a simple way to do the above, which it seems there should be, please let me know.
June 23, 2015
On Tuesday, 23 June 2015 at 07:25:05 UTC, Baz wrote:
> in dmd you have to pass
> - the .lib/.a files a source

I meant "as source", actually. you pass the .lib or .a file without switch as if it's a main source.

« First   ‹ Prev
1 2 3