Linkers hate me

I have been making pretty rapid progress as of late. And because I have been unable to install linux on my main computer I have been developing on windows.

It has been working just fine but today I decided to check to see if my project still builds on Linux. I mean one of my project goals is to have this thing build on as many platforms as possible and Linux happens to be my operating system of choice.

So, um guess what it didn't build at all both the client and server failed.

The first problem was that I included enet in the project instead of using a library. This was mostly because making the library on windows was a pain in the butt. However that requires a couple windows only libraries to be linked. And of course on the Linux side the linker would fail because it couldn't find either of those libraries.

So to solve that problem I build the library on the windows side and removed the enet sources from the project. I also modified the linker options. That solved that problem. That worked because I already had the enet package installed on my linux computer.

Next on the list is the postgresql stuff I added on the server. I used mixed case on the include and of course that isn't correct. So I made it all lower case and installed the postgresql virtual package and it that part worked.

Now for the real problem. The openSSL stuff that I just added to hash the password wasn't linking. That code is in both the client and server because they both use the login request message.

See appearently on windows the library is called eay32 and on Linux it is called crypto. Sigh, well as you can imagine this is a bit of a problem. So My solution is not quite as simple as the others.

I modified my projects for the client and the server and broke it up into 4 targets instead of two. There are now release & debug targets for both win32 & Linux. This allows me to pass different libraries to the linker and also different compiler flags. I can also define things for using in conditional compiling later.

So now that I have done this you need to switch the one of the linux targets to build on linux and one of the windows targets to build on windows. Previously you could build for either with the same target. However that is now proving to be inpratical.

So in the end I guess the moral to the story is that the trick to cross platform code has more to do with the linker & compiler than the code. Because I'm linking against cross platform libraries but I have to use the build tools to account for some differences in the envirnments.

Just so all of you know I'm probably going to be lazy about testing this on platforms other than win32 for a while. Probably at least up until I get 0.3.0 out the door. Thats going to be a while though so don't hold your breath.

Comments

Popular posts from this blog

VK9 - Milestone8 Completed

VK9 - Milestone13 Completed

VK9 - Milestone16 Completed