text="#EAF5FF">
 
 
 
Blog
About
Dev_Environment
Projects
MUD_Snippets
CS_1.6_Maps
Links
Contact
   

64 bit compiling = pain in the rear

So, I finally figured out how to compile 64 bit binaries on all the platforms we support native libraries for. And on Solaris and AIX it was pretty simple, adding -maix64 and similar flags on Solaris. On HP-UX it wasn't to bad, I had to install a 64 bit specific version of gcc/g++. On Windows and Linux.. well...

Let's start with windows. You have to use a recent version of Visual Studio to do this, or one of their dev kits, I forget what they called them. But then, One of our libraries couldn't be compiled because of some bug in VS. So we have to use 3 different build environments to build all our Windows natives. We have Visual Studio 6 for the 32 bit stuff, which we probably could upgrade to a newer version of VS, but, that would require some code changes so we haven't done that yet. And we have 2 separate environments for the C++ and C libraries.

Linux, oh boy.. well apparently, you don't need to compile objects with position independent code, to statically link them in on x86. However, you do need this if you're on x86_64. I don't quite understand how it can work on 32 but not 64. But anyways, you get this weird error about "relocation R_X86_64_32" and then complaining about the particular object file, or object file in an archive. So, I had to add -fPIC to the CXXFLAGS in the makefile that compiles all the objects for libstdc++ archive. This took me awhile to figure out. I don't understand why this hasn't been 'fixed' in newer versions of gcc, as it appears to be a fairly common and understood problem. And when you build gcc, it certainly knows you're on a 64 bit platform, and you're building 64 bit libs (and 32) so why it doesn't add the flag for you? I understand if it affects performance to not do it for the 32 bit stuff, but.. I don't know, I'm confused.

Anyhow, every time I do native development, I like AIX more and more. Solaris and Linux used to be my favorite platforms to develop on, but, Linux has proven to be a pain, and Solaris I don't think does things quite as well as AIX in some aspects of their system API's. It's close though. My one shame is I have done no system level programming on *BSD. I want to, one of these days.
Fri Jan 5 20:45:46 PST 2007

Website templates