Home      Updates      RSS Feed      About      Code      Contact

  Joint project with Girmrad May 11 2011  9:05 AM EST

Well, I've started yet another joint project with Nolan (girmrad). This one is once again in D, but it's actually going to stick that way this time. It's going to be another simulator sort of thing, where various elements can be bonded in different ways, and will hopefully allow some cool manipulation of the planet you're on.

As before, all the needed libraries and compiler were a pain in the arse to set up. Now, almost all of this is likely due to my incompetence. The last time I set everything up it literally took about four hours a day for a week. Then, the same setup would not work on Girmrad's computer, so it was almost entirely a flop. This time, the total amount of time invested from start to finish was only in the order of about four hours, on one day. A huge improvement, which I give almost entirely to the work of others. I couldn't have gotten that much better at fixing compile and linker errors in the year or so since the last time, especially seeing as most of the time in between was spent working with Java, C#, C and C++. The first two had nearly no errors to debug, and the latter two I've worked with enough to have very few to start with. Without further ado, a large rant :)

A new AUR (Arch User Repository) package for the mercurial version of gdc2 is out, so I used that. That part went surprisingly smoothly. It has support for D 2.0, which means I wasn't going to bother getting Tango set up again. Tango is an alternative to the standard core library, Phobos. A year or so ago I thought Tango was worth the hassle to get set up, but as far as I know Phobos has caught up quite a bit due to D 2.0, and Tango is a horrendous pain to set up.

After that was installed, it was a quick hop over to getting Derelict (D bindings for things like SDL, OpenGL, etc.) set up. Last time, I had to create a package build for DSSS, Tango, and Derelict all together to get things working (partially). This time, there was a nice derelict2-svn PKGBUILD available for use. Of course, the packager makes it depend on a script they made to abstract away the compiler portion (as there are several competing D compilers out there). Unfortunately, with my D compiler (gdc2-hg), it didn't like an implicit cast that was happening. One line of sed in the build function later and that was installed.

Now, we get back up to compiling Derelict. It's going swell, cruising along, -- oh, wait. It doesn't like an implicit cast DerelictOgg is making. >_> Another line of sed in this build function, and it compiles too. Yes! OK, now we have a compiler, the Derelict libraries, and we're good to go, right?

Not quite! I mentioned using DSSS before. That was a program to figure out the linker flags and what else might need imported for a program to work. Turns out that was a tremendous help last time, as this time it didn't want to do anything. My first problem as it turns out was that gdc couldn't find includes. Well, dammit. After some finagling with it's own set of flags (why not use the same as gcc?), it starts compiling. Oh, now a bunch of linker problems. OK, so, how do you use linker flags? Oh, I should be using gdmd instead of gdc directly, OK, let's fix that. More problems with includes. "I thought I fixed that?" Oh, gdmd uses yet another set of flags. OK, fine, fix that. Back to the linker problems. OK, it wants DerelictUtil, for loading the libraries, fine. Oh, that wants libdl to use dlopen, etc. [thank you manpage for dlopen] Finally, it compiles! Yay! And it works! Yay!

Now that I had everything set up to this point, I decided to do some experimenting. At some point in here I saw that there were now SFML bindings in Derelict. "Sweet!" I thought. I'd much rather use that than SDL. Let's see here, this isn't working, all sorts of problems. Guess I'll read some documentation. Documentation? What documentation. Apparently, these bindings are very incomplete, as there is no documentation that I could find. Eventually, I found a random forum post about it. Eww, these things look nothing like good ol' C++ SFML. In fact, it was downright ugly. In my opinion, at least. Back to SDL it is then, at least until these bindings can be improved and gain some documentation. On that note, I may look into helping out, as SFML has now moved to git (and github)!

 

My name is Jeff Chapman; You can reach me at: [email protected]