G++ and GCC don’t mix

My boss recently volunteered me to work with another group having problems calling a library via JNI on a Solaris box. I know Linux, so I wasn’t totally out of my depth, but I’ve never done JNI, and the GNU commands on Solaris (SunOS 5.8) behaves a bit differently than what I’m used to. I was a bit surprised, but said I’d try my best – and found myself enjoying the return to actual code a great deal. Thank goodness they had bash in addition to the default ksh, though.

Running the Java program, the only information was an exception java.lang.UnsatisifiedLinkError with the method name. There was also a line above that stated that the library in question couldn’t be used. Not very helpful. The Solaris box wasn’t under my control, so no attaching a debugger or installing packages. The library being used had been generated on a different Solaris box (same SunOS version); the box I was using didn’t even have GCC installed.

I won’t go through everything I did (four hours, with lots of red herrings), but I’ll mention a few of the things that helped.

  • Ran the java app with jdb. jdb is pretty minimal, but the major debugger functions are there. In particular, narrowing down to the exact line where the exception was thrown (through a mixture of source code inspection, and trial and error) helped a lot. I accidentally picked up an earlier UnsatisifiedLinkException that was involved in the printing of that single line error message. It turned out that the code (auto-generated?) was swallowing an exception and printing to System.out without any information from the causal exception – important details disappeared.
  • Reproduced the problem by creating a test application that did something similar. In this case, a little searching revealed the System.loadLibrary(String) function, where it’s pretty clear that if used to load a native library, should reasonably reproduce such a fatal error. Interestingly, the exception message was quite a lot different, “symbol __gxx_personality_v0: referenced symbol not found“. Some searching revealed a conversation that suggested this had to do with a C++ symbol not being pulled in. This was the tidbit that triggered the discovery of the fatal flaw: the compilation instructions used g++ for the first two steps, and then gccfor the last. Using g++ throughout fixed the problem.
  • Walked through the Java runtime source code to enlighten me what was involved in loading a native library. Doing that, and some searches, helped me understand what the filename of the library on Solaris had to be, the way it was searched for, etc. Not totally necessary, but it helped me to understand the whole situation.
  • This may have been a red herring, but I add it for completeness. The original compilation process was done on SunOS 5.8, but with v3.2 of GCC. The libgcc_s.so.1 on the target box was v3.3. To address that, I went to this site that hosts many precompiled Solaris binaries and found v3.3 for Solaris 8. The site is incredibly slow, however, so a search on the package name turned up a Sunfreeware mirror that was many times faster. A quick trip to the newsgroups taught me that Solaris uses a pkg scheme, and that I had to use pkgtrns to extract the binaries out. Oh, and I also learned that IE can have trouble downloading a gzipped file, treating it like text and corrupting it for some odd reason.

To be honest, I had a lot of fun. There’s something about being able to call on heterogenous types and sources of information to find a proper solution that’s quite enjoyable for me.

A birthday vacation?

Chatting with my chiropractor, the topic of my birthday came up. I realized that the day and my age matched this time around, and my chiropractor suggested that I should actually take some vacation for once – a kind of “champagne birthday”.1

I thought about it and I agree. I’m not one for numerology, but sometimes ideas and suggestions resonate logically and emotionally. I think this is one of those times. It wasn’t just a “why not” thought, but an actual, “yeah, I think I’d like to” internal consensus.

For those who are unaware, I typically don’t take vacations. Usually I take time off only to avoid having my accumulated time expire, and even then I usually skip work but don’t travel. The vacations that I have taken were invariably for the purpose of visiting or meeting up with people.

This time, however, I’m imagining flying somewhere for my own sake (or with friends, if any are interested). I haven’t decided if I want one, two, or three weeks. I also haven’t decided where, although I’m thinking I’d like to cross an ocean or a superpower at least. I don’t think I’ll sweat the monetary details much either; if I’m going to do this, I may as well “go for broke”. :)

Any suggestions? Japan, Taiwan, Western/Central Europe, and Cancun have come to mind.

1. A “champagne birthday” is when the last two digits of the year and the age match.

Mimosa Grille

I couldn’t stray too far away from where I was, so with a sudden restaurant decision on my hands, I went to the old Redwood Grille, recently reborn as the Mimosa Cafe and Grille. The decor hasn’t changed much, but the menu has taken a different flavour.

It began with the Trio of Soups (I love samplers, C$8):
Trio of soups
From left to right, the soups are a butternut squash, potato leek (?), and a french onion. The french onion was quite terrible (so watery!), the potato leek was not memorable, and the butternut squash was quite good. I think I just like butternut squash soup in general.

After that came a tapa, Shrimp Fritter with Garlic Aioli (C$5):
Shrimp fritter
This was quite a surprise. The shrimp were thick, juicy, and tender, quite delectable throughout. I’ve often experienced a slightly funny taste with large shrimp, but this was a treat through and through. Didn’t much care for the dipping sauce, though.

Lastly, the entree was a Seafood Crepe – sauteed tiger shrimps, scallops, mussels, baby peas, mushrooms (C$19.50):
Seafood crepe
The shrimp was every bit as enjoyable as it was in the tapa. The mussels were pretty typical, but the the scallops were good. The peas and the mushrooms, combined with the cream sauce, were quite delicious atop the crepe, though the crepe took some unravelling to get proper exposure to the sauce.

Whatever the name, this restaurant is still pretty good. I’ll remember it for the excellent shrimp, and pass on the soups next time.

  • Go to Random Post

  • Recent Posts

  • Recent Comments

    Ressie Nuncio on Getting Dell 1700 laser printe…
    GJ on Slow XPath evaluation for larg…
    Osvaldo on Slow XPath evaluation for larg…
    GJ on Slow XPath evaluation for larg…
    GJ on Slow XPath evaluation for larg…