Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
March 03, 2006 std.boxer linker error | ||||
---|---|---|---|---|
| ||||
On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't tracked down just yet. $ cat test_box.d import std.boxer; int main() { Box foo = box(1); int bar = unbox!(int)(foo); return 0; } $ dmd -g -v test_box.d parse test_box semantic test_box semantic2 test_box semantic3 test_box code test_box generating code for function 'main' generating code for function 'unbox' generating code for function 'unboxCastInteger' gcc test_box.o -o test_box -g -lphobos -lpthread -lm -Xlinker -L/workplace/bradrob/dmd-0.148/dmd/lib test_box.o(.gnu.linkonce.t_D3std5boxer24__T16unboxCastIntegerTiZ16unboxCastIntegerFS3std5boxer3BoxZi+0x18): In function `_D3std5boxer24__T16unboxCastIntegerTiZ16unboxCastIntegerFS3std5boxer3BoxZi': /workplace/bradrob/d-playground/test_box.d:5: undefined reference to `_assert_3std5boxer' collect2: ld returned 1 exit status --- errorlevel 1 Commenting out the assert in std/boxer.d inside unboxCastInteger(T) at line 429 allows the link to succeed. Similarly, if I use something other than an int and hit one of the other unboxCast[pick a type] templates I get the same problem. Thoughts? Thanks, Brad |
March 03, 2006 Re: std.boxer linker error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Roberts | On Thu, 2 Mar 2006 17:38:00 -0800, Brad Roberts wrote: > On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't tracked down just yet. On Windows, you have to compile anything that imports std.boxer with the "-release" switch to get the linker happy. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 3/03/2006 3:18:27 PM |
March 03, 2006 Re: std.boxer linker error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | On Fri, 3 Mar 2006, Derek Parnell wrote:
> On Thu, 2 Mar 2006 17:38:00 -0800, Brad Roberts wrote:
>
> > On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't tracked down just yet.
>
> On Windows, you have to compile anything that imports std.boxer with the "-release" switch to get the linker happy.
>
> --
> Derek
> (skype: derek.j.parnell)
> Melbourne, Australia
> "Down with mediocracy!"
> 3/03/2006 3:18:27 PM
Not a bad temporary work around, but only temporary since that disables all asserts.
Thanks,
Brad
|
March 03, 2006 Re: std.boxer linker error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | Derek Parnell wrote:
> On Thu, 2 Mar 2006 17:38:00 -0800, Brad Roberts wrote:
>
>> On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't tracked down just yet.
>
> On Windows, you have to compile anything that imports std.boxer with the
> "-release" switch to get the linker happy.
Do we know the reason for that? Has it been reduced to a minimal test case?
|
March 05, 2006 Re: std.boxer linker error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston Attachments: | Don Clugston schrieb am 2006-03-03: > Derek Parnell wrote: >> On Thu, 2 Mar 2006 17:38:00 -0800, Brad Roberts wrote: >> >>> On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't tracked down just yet. >> >> On Windows, you have to compile anything that imports std.boxer with the "-release" switch to get the linker happy. > > Do we know the reason for that? DMD generates different symbols depending on the state of the "-release" switch. > Has it been reduced to a minimal test case? Not as far as I know. Thomas |
March 05, 2006 Re: std.boxer linker error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | On Sun, 5 Mar 2006, Thomas Kuehne wrote:
> Don Clugston schrieb am 2006-03-03:
> > Derek Parnell wrote:
> >> On Thu, 2 Mar 2006 17:38:00 -0800, Brad Roberts wrote:
> >>
> >>> On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't tracked down just yet.
> >>
> >> On Windows, you have to compile anything that imports std.boxer with the "-release" switch to get the linker happy.
> >
> > Do we know the reason for that?
>
> DMD generates different symbols depending on the state of the "-release" switch.
>
> > Has it been reduced to a minimal test case?
>
> Not as far as I know.
>
> Thomas
I tried a little bit to reduce the problem. If you're looking for a single file contained test case then I'm not sure that's doable. I suspect this might relate to the other threads going on right now about symbols changing visibility based on compiler options.
Random thought: Now that dmd can produce .di files, THOSE are what should be used now rather than the full .d's during subsequent compilation. I haven't checked their output, but I assume that the unused paths around version, debug, release, etc are omitted such that the .di file _exactly_ matches the .o/.obj files produced.
Later,
Brad
|
Copyright © 1999-2021 by the D Language Foundation