[openbeos] Re: Hit a wall with cygwin

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 14 Nov 2006 17:53:39 +0100

On 2006-11-14 at 06:52:46 [+0100], Urias McCullough <umccullough@xxxxxxxxx> 
wrote:
> On 11/13/06, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx> wrote:
> >
> >
> > You can easily prove this theory by manually running a link command line
> > with the *_kit.o files substituted by the individual object files they are
> > made of.
> >
> 
> Did not work :( possibly I did something wrong, but I'll paste a file here
> showing what i ran and what it produced
> 
> I also tried the --allow-multiple-definition option - but that didn't seem
> to produce any different results.

Weird. That should have fixed it, since it is supposed to force the linker to 
silently accept multiple definitions of a symbol and just use the first 
occurrence for linking. You probably know, that unless the frontend directly 
supports the option, you have to prepend -Xlinker to pass it to ld.

> I did read somewhere that ld -r (used to create the _kit.o files) was
> basically broken in cygwin - but the message I read was from 1997 and I sort
> of hope they figured it out since then.

Well, since you tested linking without the *_kit.o files that obviously isn't 
the main problem.

> I'll keep digging when I get time.

You can also try to reproduce the problem with a small test setup. Something 
like this:

a.cpp:

#include <new>

int*
a()
{
        try {
                return new int(1);
        } catch (std::bad_alloc exception) {
                return 0;
        }
}

---------------------------------------
b.cpp:

#include <new>

int* a();

int*
b()
{
        try {
                return new int(2);
        } catch (std::bad_alloc exception) {
                return a();
        }
}
---------------------------------------

Build a liba.so from a.cpp and a libb.so from b.cpp. libb.so should be linked 
against liba.so, and either library should be linked against libstdc++.a. I 
would expect linking libb.so to fail just like linking libbe_build.so fails. 
If it does, you have a small example you can play with. I suppose it 
shouldn't be to hard to find out how to build C++ libraries under cygwin.

Alternatively to get a small failing example you can as well start with the 
libbe_build.so build and remove files/functions/code blocks, first from libbe 
then from libroot, until you have only one small source file per library left.

CU, Ingo

Other related posts: