[AUUG-Talk]: More Journeys with OpenSolaris...

David Lloyd lloy0076 at adam.com.au
Fri Jan 12 21:08:42 EST 2007


David,

> You said there were issues with Sun's versus GNU's linker.  Could you 
> expand on that?


Linkers seem to be tasked with finding functions within system or other 
libraries. Obviously, the linker needs to understand the libraries that 
it is searching and the naming scheme the linker uses needs to be the 
same OR the linker needs to be able to translate from one naming scheme 
to another.

So, for example, let's say I've made a library that exposes this function:

  int square_that(int i) {
      return i*i;
  }

If I now do something like this:

#include <square_that.h>

...
int x = square_that(2);
...

...clearly at some stage the system will need to go looking for a 
function called "square_that" that fits the one that I have called.

Herein lies the problem. Apparently, C++ mangles names and Sun Studio 
(Sun's compilers) and GNU's C++ mangle the names differently. 
Consequently, in older versions of NexentaOS, Firefox was built using 
the GNU toolchain but Sun built the Java plugin using the Sun Studio 
toolchain.

What I surmise would happen is this: Firefox would start, "know" that it 
was built using the GNU toolchain, use the GNU ld to link the Java 
plugin when needed ... and then summarily crash and burn.

There's a discussion about this at:

  * http://www.gnusolaris.org/phpbb/viewtopic.php?t=5430

Now, it seems that everything in Solaris in /usr/sfw is built using the 
GNU toolset. Building something that requires a library that lives in 
one of the library directories in /usr/sfw/ may or may not cause issues.

A hugely kludgy thing that occasionally works is to replace 
/usr/ccs/bin/ld with the GNU ld. It now seems that COMPILER_PATH would 
be the better option but at the time I had no idea that GCC understood 
an environment variable called "COMPILER_PATH".

See:

  * http://lists.kde.org/?l=kde-solaris&m=100290673506620&w=2

One thing that I have noticed is that GNU isn't Unix and it definitely 
isn't Solaris. Whether GNU stuff is "more Unix" than Solaris stuff is up 
for grabs; I would be inclined to suppose that Solaris is more Unix than 
GNU especially since GNU actually says it's not Unix.

I've found that if I can't get past a problem that looks like the linker 
is causing me issues, it's best to try to tackle the problem another 
way. Furthermore, Centos 3.8 runs perfectly fine under a Solaris BrandZ 
container and on a faster machine, the difference in speed between 
something running under a BrandZ zone and the global zone is negligible.

In fact, I actually run a local Squid proxy server in my Centos 3.8 
BrandZ zone. It's crazy but it works :)

DSL



More information about the Talk mailing list