digitalmars.D - std.boxer broken?
- Daniel Keep <daniel.keep.lists gmail.com> Apr 13 2006
- "Derek Parnell" <derek psych.ward> Apr 13 2006
- Daniel Keep <daniel.keep.lists gmail.com> Apr 14 2006
- Sean Kelly <sean f4.ca> Apr 14 2006
- Brad Roberts <braddr puremagic.com> Apr 14 2006
- Victor Nakoryakov <nail-mail mail.ru> Apr 14 2006
- David L. Davis <SpottedTiger yahoo.com> Apr 14 2006
- Kyle Furlong <kylefurlong gmail.com> Apr 14 2006
- Daniel Keep <daniel.keep.lists gmail.com> Apr 14 2006
Oh, look--it's me and something's not working again :P
Ok, I'm using dmd 0.153 and the included phobos. When I try to compile
the following:
import std.boxer;
import std.stdio;
int main()
{
Box x = box(42);
writefln("The answer to life, the universe, "
"and everything is: %d", unbox!(int)(x));
return 0;
}
I get the following error message:
e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
boxtest.obj(boxtest)
Error 42: Symbol Undefined _assert_3std5boxer
--- errorlevel 1
Anyone have any idea what I stuffed up? Other stuff, including
writefln, seems to work fine (well, apart from MinTL but we've already
covered that one), so I'm fairly sure it's linking in phobos.lib properly.
Any advice would be greatly appreciated.
-- Daniel.
--
v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D
a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Apr 13 2006
On Fri, 14 Apr 2006 15:30:05 +1000, Daniel Keep <daniel.keep.lists gmail.com> wrote:Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated.
To compile using the std.boxer you should always use the "-release" switch. This has been a mistake in the Phobos library for almost a year now. Walter, why can't this low-hanging-fruit be fixed ASAP. -- Derek Parnell Melbourne, Australia
Apr 13 2006
Aaah, I see. I actually had a poke around the .lib files after I wrote that, and noticed that phobos didn't have a debug .lib -- is that what causes it? If that is the case, would I be able to compile my own so that I can produce a debug version of my executables? I just spent the last week or so trying to get gdb with D support; to finally get it working and then not be able to produce debug executables would *really* annoy me :P Anyway, thanks for the heads up. -- Daniel Derek Parnell wrote:On Fri, 14 Apr 2006 15:30:05 +1000, Daniel Keep <daniel.keep.lists gmail.com> wrote:Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated.
To compile using the std.boxer you should always use the "-release" switch. This has been a mistake in the Phobos library for almost a year now. Walter, why can't this low-hanging-fruit be fixed ASAP. --Derek Parnell Melbourne, Australia
-- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Apr 14 2006
Daniel Keep wrote:Aaah, I see. I actually had a poke around the .lib files after I wrote that, and noticed that phobos didn't have a debug .lib -- is that what causes it?
Yes. Template code is kind of weird in that it isn't compiled until instantiated, but the DMD compiler generates non-template functions to handle in/out clauses and asserts. So if you use a debug app with template code containing asserts and such from a library that wasn't built with -debug set, then the assert functions won't exist in that library. The easiest way around this for library programmers making mixed-mode libraries is to always compile modules containing templates with -debug set, but this is only feasible if the module *only* contains templates. This isn't the case for std.boxer, so there are two options: * ship release and debug builds of Phobos * fix the compiler to always generate debug code for templates and rely on it being thrown out by the linker if it is not neededIf that is the case, would I be able to compile my own so that I can produce a debug version of my executables?
Yes. Sean
Apr 14 2006
On Fri, 14 Apr 2006, Daniel Keep wrote:Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated. -- Daniel.
This looks like http://d.puremagic.com/bugzilla/show_bug.cgi?id=8 There's a work around suggested in the report, compile with -release. Ugly, but.. Later, Brad
Apr 14 2006
Daniel Keep wrote:Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated. -- Daniel.
Another solution is to copy std/boxer.d to your project, in this case you haven't to always use -release. -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Apr 14 2006
In article <e1nc14$1gb5$1 digitaldaemon.com>, Daniel Keep says...Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated. -- Daniel.
Daniel, adding the "extern (C) void assert_3std5boxer() { }" line below which Burton shared with us many moons ago will also work (without the need for -release switch) and you can add unittests as well. # // daniel1.d - tested with WinXP SP1 D v0.154 # // Unittest: dmd daniel1.d -unittest # // Compile : dmd daniel1.d # # private import std.boxer; # private import std.stdio; # # // Burton Radons <burton-radons[at]smocky[dot]com> # // This entry allows -unittest for testing, and/or no need # // for the -release switch # extern (C) void assert_3std5boxer() { } # # int main() # { # Box x = box(42); # writefln("The answer to life, the universe, " # "and everything is: %d", unbox!(int)(x)); # # return 0; # } # # unittest # { # Box x = box(42); # assert(42 == unbox!(int)(x)); # writefln("unittest done."); # } Output: ------------ C:\dmd>dmd daniel1.d C:\dmd\bin\..\..\dm\bin\link.exe daniel1,,,user32+kernel32/noi; C:\dmd>daniel1 The answer to life, the universe, and everything is: 42 C:\dmd> David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Apr 14 2006
David L. Davis wrote:In article <e1nc14$1gb5$1 digitaldaemon.com>, Daniel Keep says...Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated. -- Daniel.
Daniel, adding the "extern (C) void assert_3std5boxer() { }" line below which Burton shared with us many moons ago will also work (without the need for -release switch) and you can add unittests as well. # // daniel1.d - tested with WinXP SP1 D v0.154 # // Unittest: dmd daniel1.d -unittest # // Compile : dmd daniel1.d # # private import std.boxer; # private import std.stdio; # # // Burton Radons <burton-radons[at]smocky[dot]com> # // This entry allows -unittest for testing, and/or no need # // for the -release switch # extern (C) void assert_3std5boxer() { } # # int main() # { # Box x = box(42); # writefln("The answer to life, the universe, " # "and everything is: %d", unbox!(int)(x)); # # return 0; # } # # unittest # { # Box x = box(42); # assert(42 == unbox!(int)(x)); # writefln("unittest done."); # } Output: ------------ C:\dmd>dmd daniel1.d C:\dmd\bin\..\..\dm\bin\link.exe daniel1,,,user32+kernel32/noi; C:\dmd>daniel1 The answer to life, the universe, and everything is: 42 C:\dmd> David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Thats really not the right solution though. Thats a hack to replace the symbol with an empty function. What is needed is a debug build of phobos with the right function.
Apr 14 2006
Excellent! Thanks for that. Too bad I just lost my excuse to not do unit tests <grumble, grumble> :P. -- Daniel David L. Davis wrote:In article <e1nc14$1gb5$1 digitaldaemon.com>, Daniel Keep says...Oh, look--it's me and something's not working again :P Ok, I'm using dmd 0.153 and the included phobos. When I try to compile the following: import std.boxer; import std.stdio; int main() { Box x = box(42); writefln("The answer to life, the universe, " "and everything is: %d", unbox!(int)(x)); return 0; } I get the following error message: e:\Bin\Bin\link.exe boxtest,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxtest.obj(boxtest) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 Anyone have any idea what I stuffed up? Other stuff, including writefln, seems to work fine (well, apart from MinTL but we've already covered that one), so I'm fairly sure it's linking in phobos.lib properly. Any advice would be greatly appreciated. -- Daniel.
Daniel, adding the "extern (C) void assert_3std5boxer() { }" line below which Burton shared with us many moons ago will also work (without the need for -release switch) and you can add unittests as well. # // daniel1.d - tested with WinXP SP1 D v0.154 # // Unittest: dmd daniel1.d -unittest # // Compile : dmd daniel1.d # # private import std.boxer; # private import std.stdio; # # // Burton Radons <burton-radons[at]smocky[dot]com> # // This entry allows -unittest for testing, and/or no need # // for the -release switch # extern (C) void assert_3std5boxer() { } # # int main() # { # Box x = box(42); # writefln("The answer to life, the universe, " # "and everything is: %d", unbox!(int)(x)); # # return 0; # } # # unittest # { # Box x = box(42); # assert(42 == unbox!(int)(x)); # writefln("unittest done."); # } Output: ------------ C:\dmd>dmd daniel1.d C:\dmd\bin\..\..\dm\bin\link.exe daniel1,,,user32+kernel32/noi; C:\dmd>daniel1 The answer to life, the universe, and everything is: 42 C:\dmd> David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
-- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Apr 14 2006









Sean Kelly <sean f4.ca> 