Thread overview
Re: Linking error with locale symbols
Sep 07, 2012
Andrej Mitrovic
Sep 08, 2012
Iain Buclaw
Sep 08, 2012
Iain Buclaw
Sep 08, 2012
Andrej Mitrovic
September 07, 2012
On 9/7/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> I'm having linking errors on win32 for a couple of static members in C++ stdlib.

I can see now why, g++ by default links statically to stdlib, but gdc links dynamically. The import lib for stdlib doesn't have the '_S_lc_ctype_c_locale' symbol. I'm not sure why though.. shouldn't the static and dynamic libs both have the same exported symbols?

As a workaround, how do I force the LD linker to link to the static rather than the dynamic library?
September 08, 2012
On 7 September 2012 22:57, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> On 9/7/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
>> I'm having linking errors on win32 for a couple of static members in C++ stdlib.
>
> I can see now why, g++ by default links statically to stdlib, but gdc links dynamically. The import lib for stdlib doesn't have the '_S_lc_ctype_c_locale' symbol. I'm not sure why though.. shouldn't the static and dynamic libs both have the same exported symbols?
>
> As a workaround, how do I force the LD linker to link to the static rather than the dynamic library?

>From 'man gcc'

Linker Options
   object-file-name  -llibrary -nostartfiles  -nodefaultlibs
-nostdlib -pie -rdynamic -s  -static  -static-libgcc
-static-libstdc++
   -shared -shared-libgcc  -symbolic -T script  -Wl,option  -Xlinker
option -u symbol


I would place a bet on -static-libstdc++   :^)


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 08, 2012
On 8 September 2012 07:40, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
> On 7 September 2012 22:57, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
>> On 9/7/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
>>> I'm having linking errors on win32 for a couple of static members in C++ stdlib.
>>
>> I can see now why, g++ by default links statically to stdlib, but gdc links dynamically. The import lib for stdlib doesn't have the '_S_lc_ctype_c_locale' symbol. I'm not sure why though.. shouldn't the static and dynamic libs both have the same exported symbols?
>>
>> As a workaround, how do I force the LD linker to link to the static rather than the dynamic library?
>
> From 'man gcc'
>
> Linker Options
>    object-file-name  -llibrary -nostartfiles  -nodefaultlibs
> -nostdlib -pie -rdynamic -s  -static  -static-libgcc
> -static-libstdc++
>    -shared -shared-libgcc  -symbolic -T script  -Wl,option  -Xlinker
> option -u symbol
>
>
> I would place a bet on -static-libstdc++   :^)
>
>

Actually (It's 7am in the morning and I'm not yet awake) -  This would need to be implemented in gdc's driver.  I'll send a fix to recognise this, in the meantime though, you'd use -Wl to send the correct linker options.


-Wl,-Bstatic,-lstdc++,-Bdynamic


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 08, 2012
On 9/8/12, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
> -Wl,-Bstatic,-lstdc++,-Bdynamic

Thanks. I think the issue is the import library is probably outdated. It wouldn't surprise me since the WinAPI import libs are also very outdated.

I have to figure out how to make an import library from the libc++ DLL on win32. I've tried using dlltool/pexports to make a .def file and then the import lib but LD would complain the resulting lib wasn't compatible. Someone with more windoze-wizardry might know better than me. There's a bunch of websites describing doing this but the tools referenced either lead to 404 pages or don't work properly, or I'm using them improperly.