build issues with c++ code on OpenBSD

Hello, cfe-dev!

I've been playing around with clang apis for some time lately
both on Mac OS X (built with usual ./configure && make) and OpenBSD
(built system g++ (4.2.1) with linker version scripts turned off
(binutils 2.15) and --enable-targets=host,cbe,cpp).

While clang++ builds example C++ code (using some stl) just fine
(using includes and libstdc++ from gcc 4.2.4), it bails out with a
bunch of 'undefined references' at link time on OpenBSD (OS X is just
fine with same flags)

Compiler output is included at the bottom.
I would be really glad if you take a look at it and tell me where to
look at to have linkage completed.

Thank you.

While clang++ builds example C++ code (using some stl) just fine
(using includes and libstdc++ from gcc 4.2.4), it bails out with a
bunch of 'undefined references' at link time on OpenBSD (OS X is just
fine with same flags)

...

/usr/bin/ld: warning: libc.so.55.0, needed by /usr/local/lib/libestdc++.so.11.0, may conflict with libc.so.56.0

This looks really suspicious, it is some sort of locally installed
libstdc++? Try removing the package that installed it, and using the
system's libstdc++ instead.

I would guess that you need to properly sort your link line. The Darwin linker doesn't require -l options to be topologically sorted by dependence, but most other linkers do.

John.

That was it! GNU ld manuals say I have to sort libraries in order of
depedence, in my case the compiled object needed to go first (it was the
last on the command line).