www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - internal error toObjFile()

reply Jay Dresser <dmd jaydresser.us> writes:
Since I'm a newbie, I thought I'd ask here before submitting a bug 
report.  Maybe I'm doing something stupid.

I just installed and started playing this week.  I have tried dmd and 
gdc (gdmd) and I apparently cannot use dmd as I am on a amd64 (Opteron) 
Ubuntu platform.  dmd can't handle the 64bit world yet, so I'm stuck 
with gdc.

I wanted to do something with popen() so I took some code I found on the 
newsgroups here for popen.d and compile it into my library.  It will 
compile with dmd, but then the main program won't link with it if the 
main program is from gdc (that's expected, right?).

So when I compile it with gdmd I get this:

gdmd -c -I/home/jay/Ddev/src/phobos -I/home/jay/Ddev/src/phobos/std 
-L-L/home/jay/Ddev/lib popen.d
cc1d: ../../gcc-4.1.1/gcc/d/dmd/toobj.c:417: virtual void 
ClassDeclaration::toObjFile(): Assertion `classinfo->structsize == 
CLASSINFO_SIZE' failed.
popen.d:97: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [popen.o] Error 1

I'll attach the popen.d code.

If you need any other information, I'd be happy to supply it.

Thanks.

-- jay
May 27 2007
next sibling parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Jay Dresser wrote:
 Since I'm a newbie, I thought I'd ask here before submitting a bug 
 report.  Maybe I'm doing something stupid.
 
 I just installed and started playing this week.  I have tried dmd and 
 gdc (gdmd) and I apparently cannot use dmd as I am on a amd64 (Opteron) 
 Ubuntu platform.  dmd can't handle the 64bit world yet, so I'm stuck 
 with gdc.
DMD works just fine in a 32-bit chroot on my 64-bit Ubuntu. The Ubuntu forums have a thread (I think it's http://ubuntuforums.org/showthread.php?t=24575) explaining how to set this up. Be sure to install 32-bit gcc etc. in the chroot environment.
 I wanted to do something with popen() so I took some code I found on the 
 newsgroups here for popen.d and compile it into my library.  It will 
 compile with dmd, but then the main program won't link with it if the 
 main program is from gdc (that's expected, right?).
 
 So when I compile it with gdmd I get this:
 
 gdmd -c -I/home/jay/Ddev/src/phobos -I/home/jay/Ddev/src/phobos/std 
 -L-L/home/jay/Ddev/lib popen.d
 cc1d: ../../gcc-4.1.1/gcc/d/dmd/toobj.c:417: virtual void 
 ClassDeclaration::toObjFile(): Assertion `classinfo->structsize == 
 CLASSINFO_SIZE' failed.
 popen.d:97: internal compiler error: Aborted
[snip] Looks like you're using the wrong version of Phobos with your gdmd. (Likely DMD's version) I'm pretty sure you shouldn't need to specify include paths for phobos, GDC should know where gphobos (the version of Phobos it comes with) is installed.
May 28 2007
parent reply Jay Dresser <dmd jaydresser.us> writes:
Frits van Bommel wrote:
 Jay Dresser wrote:
 Since I'm a newbie, I thought I'd ask here before submitting a bug 
 report.  Maybe I'm doing something stupid.

 I just installed and started playing this week.  I have tried dmd and 
 gdc (gdmd) and I apparently cannot use dmd as I am on a amd64 
 (Opteron) Ubuntu platform.  dmd can't handle the 64bit world yet, so 
 I'm stuck with gdc.
DMD works just fine in a 32-bit chroot on my 64-bit Ubuntu. The Ubuntu forums have a thread (I think it's http://ubuntuforums.org/showthread.php?t=24575) explaining how to set this up. Be sure to install 32-bit gcc etc. in the chroot environment.
Thanks but I don't think I want to bother with the trouble of chroot. I'll use gdc until dmd is ready to use.
 I wanted to do something with popen() so I took some code I found on 
 the newsgroups here for popen.d and compile it into my library.  It 
 will compile with dmd, but then the main program won't link with it if 
 the main program is from gdc (that's expected, right?).

 So when I compile it with gdmd I get this:

 gdmd -c -I/home/jay/Ddev/src/phobos -I/home/jay/Ddev/src/phobos/std 
 -L-L/home/jay/Ddev/lib popen.d
 cc1d: ../../gcc-4.1.1/gcc/d/dmd/toobj.c:417: virtual void 
 ClassDeclaration::toObjFile(): Assertion `classinfo->structsize == 
 CLASSINFO_SIZE' failed.
 popen.d:97: internal compiler error: Aborted
[snip] Looks like you're using the wrong version of Phobos with your gdmd. (Likely DMD's version) I'm pretty sure you shouldn't need to specify include paths for phobos, GDC should know where gphobos (the version of Phobos it comes with) is installed.
From the file gdc-0.23-x86_64-linux-gcc-4.1.1.tar.bz2 I am using lib64/libgphobos.a. Which one should I be using? --J
May 28 2007
parent Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Jay Dresser wrote:
 Frits van Bommel wrote:
 Jay Dresser wrote:
 So when I compile it with gdmd I get this:

 gdmd -c -I/home/jay/Ddev/src/phobos -I/home/jay/Ddev/src/phobos/std 
 -L-L/home/jay/Ddev/lib popen.d
 cc1d: ../../gcc-4.1.1/gcc/d/dmd/toobj.c:417: virtual void 
 ClassDeclaration::toObjFile(): Assertion `classinfo->structsize == 
 CLASSINFO_SIZE' failed.
 popen.d:97: internal compiler error: Aborted
[snip] Looks like you're using the wrong version of Phobos with your gdmd. (Likely DMD's version) I'm pretty sure you shouldn't need to specify include paths for phobos, GDC should know where gphobos (the version of Phobos it comes with) is installed.
From the file gdc-0.23-x86_64-linux-gcc-4.1.1.tar.bz2 I am using lib64/libgphobos.a. Which one should I be using?
That's probably the right binary file, but I actually meant the Phobos sources. In particular, the "-I/home/jay/Ddev/src/phobos" on your command line seems to put the sources to a Phobos version in the import path. I suspect that directory contains either DMD Phobos sources or perhaps a different (old?) version of the GDC gphobos sources.
May 29 2007
prev sibling parent reply Regan Heath <regan netmail.co.nz> writes:
Just thought I'd mention that I wrote a ProcessStream implementation a while
back and posted it to this newsgroup.  

It uses system calls which give you more control than popen.

You might find it interesting.  

I recall there being a number of small bugs in it (because I couldn't test on
UNIX at the time).

I dont have it with me (I have moved countries and stupidly left many things
behind) so I did a google for it:

http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=IRFA,IRFA:2005-52,IRFA:en&q=site%3adigitalmars%2ecom+%22Regan+Heath%22+process%2ed

and found the following, and more...
http://www.digitalmars.com/d/archives/digitalmars/D/learn/3421.html

http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=581&header

http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=3156

Regan
May 28 2007
parent reply Jay Dresser <dmd jaydresser.us> writes:
That sounds like the one I'm using.  It's a ProcessStream and it had a 
small number of bugs.  :)

Being new to D, I'm not sure why I need all this stuff wrapped around 
popen(), I could just use the C one, right?  But I trust there is a reason.

Regan Heath wrote:
 Just thought I'd mention that I wrote a ProcessStream implementation a while
back and posted it to this newsgroup.  
 
 It uses system calls which give you more control than popen.
 
 You might find it interesting.  
 
 I recall there being a number of small bugs in it (because I couldn't test on
UNIX at the time).
 
 I dont have it with me (I have moved countries and stupidly left many things
behind) so I did a google for it:
 
 http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=IRFA,IRFA:2005-52,IRFA:en&q=site%3adigitalmars%2ecom+%22Regan+Heath%22+process%2ed
 
 and found the following, and more...
 http://www.digitalmars.com/d/archives/digitalmars/D/learn/3421.html
 
 http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=581&header
 
 http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=3156
 
 Regan
May 28 2007
parent Regan Heath <regan netmail.co.nz> writes:
Jay Dresser Wrote:
 That sounds like the one I'm using.  It's a ProcessStream and it had a 
 small number of bugs.  :)
Really.. the code you posted looks different to the one I wrote. For starters I didn't use popen.
 Being new to D, I'm not sure why I need all this stuff wrapped around 
 popen(), I could just use the C one, right?  But I trust there is a reason.
Im not sure what options popen gives you but there are several things you can do when you do it manually, like: - setting the enviroment variables the process sees - have access to stderr handles (popen gives a FILE* which lets you read and/or write stdin and stdout but not stderr?) - have more control over the handles you create. Important if you do/do not want the child process to inherit your handles. There may be other things, not sure. Basically if popen does everything you want I can't see why you wouldn't use it. Regan
May 28 2007