www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compile Phobos library ?

reply GG <g g.com> writes:
DMD2.040 on linux:

When I try to build phobos library with make -f linux.mak, I got :
dmd -w -O -release -nofloat -d  -lib -ofobj/posix/release/libphobos2.a crc32.d
std/algorithm.d std/array.d std/atomics.d std/base64.d std/bigint.d
std/bitmanip.d std/boxer.d std/compiler.d std/complex.d std/contracts.d
std/conv.d std/cpuid.d std/cstream.d std/ctype.d std/date.d std/datebase.d
std/dateparse.d std/demangle.d std/encoding.d std/file.d std/format.d
std/functional.d std/getopt.d std/intrinsic.d std/iterator.d std/json.d
std/loader.d std/math.d std/md5.d std/metastrings.d std/mmfile.d std/numeric.d
std/outbuffer.d std/path.d std/perf.d std/process.d std/random.d std/range.d
std/regex.d std/regexp.d std/signals.d std/socket.d std/socketstream.d
std/stdint.d std/stdio.d std/stdiobase.d std/stream.d std/string.d
std/syserror.d std/system.d std/traits.d std/typecons.d std/typetuple.d
std/uni.d std/uri.d std/utf.d std/variant.d std/xml.d std/zip.d std/zlib.d
std/c/stdarg.d std/c/stdio.d etc/c/zlib.d std/c/linux/linux.d
std/c/linux/socket.d obj/posix/release/etc/c/zlib/adler32.o
obj/posix/release/etc/c/zlib/compress.o obj/posix/release/etc/c/zlib/crc32.o
obj/posix/release/etc/c/zlib/gzio.o obj/posix/release/etc/c/zlib/uncompr.o
obj/posix/release/etc/c/zlib/deflate.o obj/posix/release/etc/c/zlib/trees.o
obj/posix/release/etc/c/zlib/zutil.o obj/posix/release/etc/c/zlib/inflate.o
obj/posix/release/etc/c/zlib/infback.o obj/posix/release/etc/c/zlib/inftrees.o
obj/posix/release/etc/c/zlib/inffast.o libdruntime.a
make: *** [obj/posix/release/libphobos2.a] Segmentation fault (core dumped)

libdruntime.a is needed, so I compiled it and got no error, but libphobos2.a
doesn't build.
Am I missing something ?

Thanks !
GG
Feb 17 2010
next sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 02/17/2010 07:09 PM, GG wrote:
 DMD2.040 on linux:

 When I try to build phobos library with make -f linux.mak, I got :
 dmd -w -O -release -nofloat -d  -lib -ofobj/posix/release/libphobos2.a crc32.d
std/algorithm.d std/array.d std/atomics.d std/base64.d std/bigint.d
std/bitmanip.d std/boxer.d std/compiler.d std/complex.d std/contracts.d
std/conv.d std/cpuid.d std/cstream.d std/ctype.d std/date.d std/datebase.d
std/dateparse.d std/demangle.d std/encoding.d std/file.d std/format.d
std/functional.d std/getopt.d std/intrinsic.d std/iterator.d std/json.d
std/loader.d std/math.d std/md5.d std/metastrings.d std/mmfile.d std/numeric.d
std/outbuffer.d std/path.d std/perf.d std/process.d std/random.d std/range.d
std/regex.d std/regexp.d std/signals.d std/socket.d std/socketstream.d
std/stdint.d std/stdio.d std/stdiobase.d std/stream.d std/string.d
std/syserror.d std/system.d std/traits.d std/typecons.d std/typetuple.d
std/uni.d std/uri.d std/utf.d std/variant.d std/xml.d std/zip.d std/zlib.d
std/c/stdarg.d std/c/stdio.d etc/c/zlib.d std/c/linux/linux.d
std/c/linux/socket.d obj/posix/release/etc/c/zlib

 make: *** [obj/posix/release/libphobos2.a] Segmentation fault (core dumped)

 libdruntime.a is needed, so I compiled it and got no error, but libphobos2.a
doesn't build.
 Am I missing something ?

 Thanks !
 GG

fwiw, I tried compiling a project I wrote last semester with 2.040 (and 2.038) a few days ago and got the same output. Something in DMD seems to have broken since 2.035
Feb 17 2010
prev sibling parent reply BCS <none anon.com> writes:
Hello GG,

 DMD2.040 on linux:
 
 When I try to build phobos library with make -f linux.mak, I got :
 

[...]
 
 make: *** [obj/posix/release/libphobos2.a] Segmentation fault (core
 dumped)
 
 libdruntime.a is needed, so I compiled it and got no error, but
 libphobos2.a doesn't build. Am I missing something ?

can you try that with a debug build of DMD under GDB and get a stack trace? It might help finding/fixing the error.
 Thanks !
 GG

... <IXOYE><
Feb 17 2010
parent reply GG <g g.com> writes:
Hello !
I have already used gdb to debug program compiled with dmd, but never link gdb
with DMD at same time.
I found on google something like this : nameofprogram -g -d gdb
But when I try with DMD like : DMD -g -d gdb [...] , the compiler DMD look for
a .d file (cannot read file gdb.d) Of course, it's normal.
So could you explain me how to link gdb with DMD ? Is there an option parameter
to pass to DMD?

Thanks !
GG
Feb 17 2010
parent reply BCS <none anon.com> writes:
Hello GG,

 Hello !
 
 I have already used gdb to debug program compiled with dmd, but never
 link gdb with DMD at same time.
 
 I found on google something like this : nameofprogram -g -d gdb
 
 But when I try with DMD like : DMD -g -d gdb [...] , the compiler DMD
 look for a .d file (cannot read file gdb.d) Of course, it's normal.
 
 So could you explain me how to link gdb with DMD ? Is there an option
 parameter to pass to DMD?
 

I was suggesting running DMD under the debugger as you would any other program: gdb dmd r -g -d files.d You might have to make a debug build of DMD but that's easy (a one line change in linux.mak and run it) -- ... <IXOYE><
Feb 17 2010
parent reply GG <g g.com> writes:
Thanks you very much for your explanation ! I got it work with gdb and got this:

If I pass to dmd : r -g -d -lib -ofobj/posix/release/libphobos2.a [all .d and
.o files] ../druntime/libdruntime.a, I get this :

Program received signal SIGSEGV, Segmentation fault.
---Type <return> to continue, or q <return> to quit---
0x0816c5d8 in StringTable::lookup (this=0x96a4618, s=0x81f518c "object", len=6)
    at root/stringtable.c:100
100	    se = *(StringEntry **)search(s,len);
------------------------------

But if I try pass to dmd : r -g -d [all .d and .o files], I get this :
Program received signal SIGSEGV, Segmentation fault.
0x0816c6b3 in Dchar::memcmp (s1=0x81f517c "object", s2=0x96a47cc "object", 
---Type <return> to continue, or q <return> to quit---
    nchars=6) at root/dchar.h:161
161	    static int memcmp(const dchar *s1, const dchar *s2, int nchars) {
return ::memcmp(s1, s2, nchars); }
------------------------------

I hope it can help !
Thanks !
GG
Feb 18 2010
parent reply BCS <none anon.com> writes:
Hello GG,

 Thanks you very much for your explanation ! I got it work with gdb and
 got this:
 

I don't know enough about the internals to be able to help you beyond maybe converting the seg-v into an assert (but you should be able to do that yourself). Someone else might be able to do something with a stack trace but if you can get a reproducible test case, post it to the bugzilla. Oh, and if you can convert it to an assert, post a patch for that to the bugzilla as well. PS. It's generally a good idea to keep some context (at least the auto generated "so and so wrote:" line) from the post you are responding to as it makes it easier for people to find replies to what they posted. -- ... <IXOYE><
Feb 18 2010
parent GG <g g.com> writes:
Hello BCS !

 Hello GG,
 
 Thanks you very much for your explanation ! I got it work with gdb and
 got this:
 

I don't know enough about the internals to be able to help you beyond maybe converting the seg-v into an assert (but you should be able to do that yourself). Someone else might be able to do something with a stack trace but if you can get a reproducible test case, post it to the bugzilla. Oh, and if you can convert it to an assert, post a patch for that to the bugzilla as well. PS. It's generally a good idea to keep some context (at least the auto generated "so and so wrote:" line) from the post you are responding to as it makes it easier for people to find replies to what they posted. -- ... <IXOYE><

Ok ! It's a good idea ! I will keep the auto generated text. Today I thought about that, and I realized that the only thing that I changed is this : http://d.puremagic.com/issues/show_bug.cgi?id=3692, I applied the patch (download mtype.c and replace file to /dmd2/src/dmd) After that, I compiled a new DMD and put DMD to my environement path. And next, try to compile libphobos, give me segmentation fault ! And if I roll back the patch, I can compile libphobos without any error ! So the problem is localized, at now I have no idea to solve this bug. Thanks ! GG
Feb 18 2010