D tool ddemangle.d doesn't change output from DMD+GNU ld linking Errors

91 views Asked by At

I'm trying to demangle my linking errors such as

dmd -debug -gc -unittest -D -Dd/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/cognia/ -w  ~/Work/cognia/t_geometry.d -of/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/cognia/t_geometry
/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/cognia/t_geometry.o:(.data+0x6d8): undefined reference to `_D4gl3n6linalg12__ModuleInfoZ'
/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/cognia/t_geometry.o: In function `_D4gl3n6linalg16__T6VectorTfVi4Z6Vector19__unittestL103_7189FNaNbNfZv':
/home/per/Work/cognia/gl3n/linalg.d:104: undefined reference to `_D4gl3n6linalg15__unittest_failFiZv'
/home/per/Work/cognia/gl3n/linalg.d:105: undefined reference to `_D4gl3n6linalg15__unittest_failFiZv'

by using ddemangle.d from dtools repo on github as

same_command_as_above | ddemangle

but I get the same output using both DMD 2.063.2 and git master.

Is ddemangle.d not uptodate?

Update: Ok. Thanks!

same_command_as_above 2>&1 | ddemangle

demangles the majority of the messages but not all of them. I wonder why. Here's some lines

/home/per/Work/cognia/gl3n/linalg.d:1814: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi2Vi2Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi2Vi2Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:1815: undefined reference to `void gl3n.linalg.__unittest_fail(int)'

Clues anyone?

2

There are 2 answers

0
Vladimir Panteleev On BEST ANSWER

Make sure you are filtering the output stream that the program is emitting. Errors are commonly written to the standard error stream, but the line above only filters standard output stream.

Try changing your command to:

same_command_as_above 2>&1 | ddemangle

2>&1 will redirect stderr to stdout, allowing ddemangle to filter both stdout and stderr.

2
Nordlöw On

Ok. Thanks!

same_command_as_above 2>&1 | ddemangle

demangles the majority of the messages but not all of them. I wonder why. Here's some lines

/home/per/Work/cognia/gl3n/linalg.d:1814: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi2Vi2Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi2Vi2Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:1815: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:1817: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:1818: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi4Vi4Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi4Vi4Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:1820: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi4Vi4Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi4Vi4Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:1821: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi4Vi4Z6Matrix6__initZ'
/home/per/Work/cognia/gl3n/linalg.d:1823: undefined reference to `void gl3n.linalg.__unittest_fail(int)'
/home/per/Work/cognia/gl3n/linalg.d:695: undefined reference to `_D4gl3n6linalg19__T6MatrixTfVi4Vi4Z6Matrix6__initZ'

Clues anyone?