Dead Carrot Barrel

A year(-ish) ago, we got married and moved into the Nuthaus (me first).

I set up a few SIPs to try to grow a few tomatoes and peppers. And a bucket to try to grow some carrots.

We did manage to get a few tomatoes and peppers before the Texas heat really kicked in last year. I think we were all looking forward to trying again this year, but my day job just left me too brain-dead on the weekends to even think about it.

The carrots were weird. They sort of arrived this spring, in little baby batches.

Oh, and we also picked up a hibiscus to leave in a pot to cover up a spot on the porch where the tile is falling apart.

We got absolutely slammed with a torrential rainstorm 2 nights ago. The lightning was popping around the way it does on a normal tornado-season weekend in Stillwater. The rain…

I’ve read about rain cascading down in sheets since I was a little kid. This was the second time I’ve seen it in my life. Daphne sat up with me to watch until around 1 am.

She asked about pulling the hibiscus and carrot barrels out of the downpour. I felt sorry for the hibiscus, but the carrots were all dead anyway. So I saved one, but not the other.

When I headed to work yesterday morning, Laura pointed out that the pot we’d set up for the carrots had a blow-out. It was some stupid-ugly container left over from my bachelor days, so I told her to just throw it out and forget about it.

She tried to save the soil that was in it.

I feel like such an ass.

I get attached to some things. They help me remember events that I simply would not without them. I’ve tried to explain this to her to help explain why I hoard things. It’s why she’s promised to never throw away anything without my permission.

She carried this over to a plastic planter full of dirt. I feel like I’ve gone over the top in trying to protect the remnants of my old life (which I know is gone) when she’s this worried about protecting something that’s this worthless.

I can only imagine how painful and frustrating it was for her to try to drag this out of sight, with little bits and pieces of cheap plastic snapping off in her hands every step of the way.

Laura did this for me, on the off-chance that I might care about some of this broken useless crap. I can imagine how frustrating it must have been, and I really wish I’d been there to shrug and let her know that it just isn’t worth wasting our time over dirt.

But I’m humbled and honored (and a little scared) that she put that much effort into something that she knew was useless because she thought it might possibly matter to me.

 

Agents, tools.namespace, and core.async

TL;DR: don’t mix (shutdown-agents) with clojure.tools.namespace.

I just spent most of a frustrating weekend dealing with a really strange behavior in clojure.

I’ve been a huge fan of Stuart Sierra’s Workflow, pretty much since the day I discovered it. I tend to make a bunch of related changes all at once without stopping to verify each one individually. Which, really, probably cuts down on my overall productivity when I’m hacking in clojure.

I admit that I still have a lot of bad habits left over from inferior languages. It would have gotten beat out of me very quickly, if I hadn’t discovered this workflow about the same time that I was able to justify spending significant time on clojure projects.

I just went through the process of changing a symbol to a magic string in about 8 different places. I realize that I should have changed it into a function call instead, so I’ll never have to do this again (programmers who work with me get irritated about how far I’ll take this sort of refactoring), but I was in hacker mode anyway.

I’m intellectually aware that I should have made the change in one place, evaled it, tested it, and rinse/repeat. Except that none of the changes made sense individually. It was really an all-or-none thing. Which is at least a hint of an architectural smell, but…hacker mode. It was quick and painless enough to just run (reset) and then verify that the problem was solved. (For anyone who’s curious: keywords that are stored in monger automatically get converted to strings. Querying for those keywords later is going to fail. Yes, I’m very new to MongoDB).

Well, it would have been quick and painless. Except that my clojure session kept dying on the command after running a (reset). The error was a helpful “SocketException The transport’s socket appears to have lost its connection to the nREPL server”.

Actually, I suspect the server was dying at the end of the reset. But the client didn’t realize it until I tried to run the next command. And it seems like the problem usually happened after the second reset.

Yeah, weird. And horribly painful. I didn’t have a clue where to point the blame. tools.namespace has always seemed rock-solid to me.

I’m working on a brand-new (to me) linux distro that has been incredibly frustrating and painful because nothing seems to work properly. I was half-way inclined to blame it, but I was having a similar problem on my Ubuntu box. (Actually, the reason I switched to the weird server in the first place was because of this: I thought it might have something to do with the monger client because I didn’t have a database to connect it to).

I spent the weekend trying to work around this. I was very conscientious about eval’ing changes right after I made them. Until it got painful enough to really dig in and isolate the issue.

When I got rid of the namespace that uses core.async, the problem went away (along with pretty much all my functionality). For a while, I really believed that was the issue: I just upgraded to a brand-spanking-new version of an alpha-quality library, after all. Of course, it’s really only alpha-quality in the world of heavy-hitting clojure developers.

Long story made short: somewhere along the line, when I was setting up all the basics, I got the impression that calling (shutdown-agents) would be a good idea when things were exiting. Something about the program hanging for a minute or so waiting for work to time out. I mistakenly thought that meant it would be a good idea to do this in my (stop!) code.

That seems to have been the problem. In retrospect, I think I vaguely remember that the whole Workflow Reloaded thing uses an agent for the restart. And I can’t find any documentation about actually restarting this thread pool after you’ve killed it (I haven’t had any real reason to ever use an agent in anger, so this is really my first exposure to any of the associated gotchas).

I can’t say for sure that this was my pain point. But I haven’t had any issues since I commented that line out. So it seemed worth writing down to hopefully help me remember to never do that again.

Rooby Has a Brain!

And a spinal column. And all sorts of various things that most of us never thing twice about.

Like a gallbladder. Apparently, all 4 quadrants of the gall bladder are present. Which seems cool, but I’m a little surprised that it rated so much more coverage than the heart or the blood vessels in the umbilical cord.

I think the placenta got more screen-time, but not by much.

Then we have this mysterious-looking murky ink-blot shot labeled “gender.” The tech very nearly didn’t take it at all, because she didn’t want to give anything away if we didn’t want to know. But *I’m* the one who wants to be surprised. Laura wants to know now, and she seems to be turning the whole thing into a game of wheedling me down so we know before-hand.

It’s part of the basic agreement we have. I tell her what I want, she figures out how to make it happen, and then I get to enjoy this brilliant, seamless, seemingly effortless experience that she’s arranged for me.

It seems pretty one-sided to me, but she isn’t screaming too loudly yet about how unfair the whole situation is.

This may change in the fairly near future. Right now, she’s being nice and friendly about the whole thing.

But the midwife has warned us that, at this point, the placenta is in complete and total control of her hormones. Laura is, by far, the sweetest, kindest, most caring and considering individual I’ve ever met.

But I don’t think any of us are above playing that sort of trump card.

She’s already warned me that she probably been trying to fiddle with the envelope and feels discouraged about how well the tech fulfilled our request about sealing the whole thing up. In a sincere moment, she admitted that she’d tell me if she actually knows…then she promptly switched back to conniving and threatened me with Daphne’s tears if I didn’t relent and tear open the envelope immediately.

Since I’m such a cruel, heartless person, this amused me to no end. I’m tempted to come up with some analogy about lapping up Daphne’s tears like mother’s milk, but the humor falls flat on lots of different levels.

The truth of the matter is that, right now at least, Daphne probably couldn’t care less. By the time Rooby starts getting interesting, D will be heading off into her own life. I think the age gap is pretty similar between my mother and my Aunt Glenda. We might be able to bribe D into playing baby-sitter on occasion, but, mostly, she’s going to be busy figuring out puberty while Rooby’s figuring out diapers.

We will not be posting any pictures of any ultrasounds. I think they’re pretty cool, but Laura’s all shy about the whole thing. Go figure. I’m pretty sure this is a male/female thing. I’ll talk about weird things my body does all day long, but you have to be part of my inner circle before I’ll give you the first hint about how something makes me feel.

C’mon, What About The Gender?

We don’t know. If I have my way, no one will find out until Rooby is born. Honestly, this part matters so little to me that I just don’t care. I’ve seen enough to know that Rooby’s plumbing and Rooby’s mind may totally disagree about this whole thing. (Hopefully not, of course, but considering all the alternatives we looked at this morning…as a parent, would you rather have a child born gay, or one that has an upside-down gall bladder?)

Whatever happens will be OK with me. No matter what, Laura and I will be there for Rooby, just exactly like we are for Daphne. We love them both, and we want them both to be healthy, happy adults. I’m thrilled by what I saw this morning.

No, seriously, about the gender!

There’s one picture in the entire sequence that, reportedly, shows Rooby’s anatomical gender. The tech labeled it that way.

Laura says she thinks it looks like a baby playing with toy dinosaurs. I think it looks like a text-book anatomical diagram of the female reproductive system. The tech who did the scan switched to the pronoun “he” very shortly after we got the supposed porn shot.

We’ve been debating whether that was a Freudian slip or just the sort of royal “We” that professionals use so they don’t call your baby an “It.”

After all, it seems to be a UT fan (based on the sign language it was sharing), and…honestly, how much worse can it get?

Especially since I suggested moving back to Oklahoma and re-indoctrinating it to the One True Sooner Way, and Laura totally shot that idea down.

And, seriously. Would you rather be remembered for cattle drives and the Alamo or screwing the government (not to mention the indigents) out of the land that you were stealing in the first place?

I’m sorry, Khrys, but…Hook’em!

Trusty Painless Ubuntu…and Candy!

Yesterday, I spent another long evening of wrestling with getting ubuntu installed. The big thing I changed was just mounting /dev/sda1 as /boot and giving ubuntu permission to overwrite it (after I backed it up, of course). I wound up with exactly the same error. So I shut it down in disgust and went to bed.

I was at least halfway ready to file a bug report this morning, but Canonical’s requirements for that include using the latest daily build first. It seemed reasonable, so I found the time to burn that. Windows claimed the burn failed, and it didn’t look like it had been burned, but I’ve seen that before. All the data seemed to be there.

Except that it wasn’t actually bootable.

Fortunately, it didn’t matter. Sometime between then and when I got from work this evening (after hanging out with my delightful wife and a gaggle of chocolate-crazed harridans at the pre-grand-opening for See’s Candy), it seems to have more or less fixed itself. lightdm.conf took me into a more-or-less functional X, behind nouveau. I was able to tweak the system settings and get nvidia drivers installed. Getting rid of lightdm.conf again left me with a broken unity…but I really don’t have much interest in using that lame GUI anyway.

So now I’m going back through the steps to try to get unprivileged linux containers working on my shiny new box. Which is now as lovely and awesome as the one I’m used to…except for the slowdown from all the bloat that Canonical is foisting on me. I’m getting a little tired of living on the bleeding edge. Especially since most of the pain points don’t actually seem to be improvements.

edit 3 minutes later:

Of course I spoke too soon. Trying to run `apt-cache upgrade` left me with an error from the hicolor-icon-theme:

(gtk-update-icon-cache-3.0:22778): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file ‘/usr/lib/x86_64-linux-gnu/gdk/pixbuf-2.0/2.10.0/loaders.cache’: No such file or directory

This likely means that your installation is broken.

Try running the command

gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk/pixbuf-2.0/2.10.0/loaders.cache

to make things work again for the time being.

That package isn’t installed, and the dependencies seem to be broken. Luckily, I couldn’t care less about this one. It does seem like an ominous error to be cropping up this close to release, but it really seems like just a minor little nuisance glitch.

Even for the people who actually want those silly icons installed in the first place.

edit an hour later:

Sadly, it wasn’t that simple. Of course.

The problem seems to be that the isc-dhcp-client package is broken. And dpkg is choking on everything else I try to do because of it. The basic error messages I’m getting recommend running `apt-get -f install` with no arguments to fix the problem.

That tells me that it’s going to install, and upgrade, the problem package.

But it fails with this error:

/var/lib/dpkg/tmp.ci/preinst: 17: /var/lib/dpkg/tmp.ci/preinst: Syntax error: “fi” unexpected (expecting “then”)

dpkg: error processing archive /var/cache/apt/archives/isc-dhcp-client_4.2.4-7ubuntu10_amd64.deb (–unpack):

subprocess new pre-installation script returned error exit status 2

Hopefully they get this fixed before I get another chance to dink around with it. For now, it’s late, I’m tired, and I feel like I’ve spent enough time beating my head against walls today.

Trusty Ubuntu Pain

This post is very time-sensitive and will probably be out-of-date almost instantly. Hopefully.

I’m working on some stuff that’s really only practical with Ubuntu 14. Which won’t really be released for another couple of weeks. One of the Enterprise-y types from the office is screaming that we should be using RedHat instead, but they he doesn’t seem to realize that he wants us to do cutting-edge stuff.

Not that ubuntu’s actually ahead of redhat what it comes to “cutting edge.” At this point, it seems like every other distro is tripping over its own feet to catch up with redhat. At least in terms of major, ground-breaking changes, redhat’s the upstream for basically everything foundational in linux. It’s just fun to pick on them.

My redhat-fan co-worker spent a long time a few days ago cussing about things he hates in Ubuntu. I didn’t have the time to explain that those changes are all coming from redhat. It’s just that he’s used to working with the ancient software that they’ve already beta-tested in the more forward-thinking distros.

Since I’m a gentoo user, I should probably mention that it gets beta-tested in the Luddite distros as well. Although, in the past 15 years, I have seen Red Hat come out with bleeding edge technology once or maybe even twice. In this case, the new stuff probably qualifies as a good idea.

That’s just background. If I thought anyone else would ever read this, I’d probably edit it away. But I haven’t gotten to truly indulge my inner writer instincts since NaNoWriMo, so I’m leaving it.

If only for the sake of word count.

So, anyway. To the point.

I decided, for various reasons (mostly those mentioned above), to try to install ubuntu to a second hard drive. The livecd forced me to choose somewhere to put a bootloader (I don’t know why…there really should have been an “I know what I’m doing” option that let me update my existing bootloader). And then the installation failed when it tried to install that bootloader to /dev/sdb1 the way I told it to.

Which was fine. I’m quite happy with the bootloader I have on /dev/sda1, and I really don’t want ubuntu to screw with it. I’m not in their target market of clueless newbs. I’d be right on the verge of switching over to Fedora (as much as I despise Red Hat) if the people who are doing interesting stuff there were able to get their stuff published.

Open Source politics are amusing. At least no one’s shooting anyone else.

That’s beside the point. After the ubuntu install failed, I booted back into my real system where I’ll continue doing almost all my work. I rebooted from there, got to the login screen, and…fade to black.

Fucking Canonical.

They boot up into X by default, and they don’t give any options for alternatives. This is why I *hate* letting computers make the decisions. When things go wrong, there’s never an obvious recovery path. The first step I took that actually made any useful difference was moving lightdm.conf out of /etc/init/ so the useless thing didn’t try to load up X and then crash.

I’ve wasted the evening trying to deal with the fact that this install is just broken now. I should probably do the install the way Canonical intended (with my real drive unplugged), and then adjust the bootloader appropriately.

But that’s the kind of garbage that I go through when I have to mess with Windows. And, pardon my French, fuck that. (Sorry, Mom!)

So I’ve booted back and forth about a dozen times this evening. The best hints I’ve been able to gather so far indicate that I need to use something like nvidia-xconfig to generate an xorg.conf.

Unfortunately, I can’t find a single suggestion about how to install that stupid program. It looks like it’s supposed to be part of the nvidia-settings package, but actual experimentation says that it isn’t so.

Maybe I’m running into a situation where the video card company isn’t going to release *anything* for this version until it has the official stamp of approval?

If that were the situation, it seems like the nouveau drivers should have worked. Even if they did work slowly.

Meh. Those modules are still active. So I don’t think that can possibly be the problem.

(“The Problem” == “I’d like to start X”…since I got past the “OS boots to black screen” thing earlier)

The bottom-line error that I’m running into is:

“Using system config directory “/usr/share/x11/xorg.conf.d” Number of created screens does not match number of detected devices. Configuration failed.”

Which is turning out to be completely useless on google.

At this point, I’d break down and install Fedora on this drive instead. If redhat weren’t stuck in the point of being obsolete just by their very nature. It’s more than a little ironic that they drive innovation in the rest of user-space linux.

I wouldn’t normally install something as corporate as ubuntu on my own time. Much less redhat. But I don’t see a way around it.

Except that they seem to have rigged the whole stupid thing so that it simply does not work.

I feel like I’m chasing my tail here. It’s past time to switch to something different and let it percolate in my subconscious.

New, Improved LXC on Gentoo

So I’ve cloned the lxc repository to try to get the latest version running (because I can be stupid that way).

One of the first problems I ran into was getting the configure script to recognize that I truly do have python (and, since it’s gentoo, all the associated development pieces) installed.

I don’t know much about autogen, et al. But fireeye’s chapter on PKG_CHECK_MODULES led me to the “solution”.

That module (in this case) winds up using pkg-config to compare versions. In this situation, it’s looking for version details in /usr/lib/pkgconfig/python3.pc to see whether I have 3.2 or later installed. That file doesn’t exist on my system.

What does exist is /usr/lib/pkgconfig/python-3.3.pc which should happily inform the config system that I’m good to go.

I’m almost inclined to label this a bug in gentoo’s eselect mechanism. But it could be architectural differences of opinion. Whatever. `ln -s /usr/lib/pkgconfig python-3.3.pg python3.pc` got me moving forward.

Gentoo Hosts, LXC, and Ubuntu 14 Guests

Why

I’m trying to get the beta version of Ubuntu 14 running as some sort of virtualized guest inside a gentoo host (don’t judge…I have valid reasons). This post will probably become obsolete very quickly.

Start With the Obvious

Canonical has tentatively released a preliminary Vagrant box of their cloud version of Trusty. So I tried it first. I can’t seem to get networking going over NAT at all. Virtual Box errors out when I try to set up host-only networking. For anyone who cares, the error from the GUI is:

Failed to create the host-only network interface.

VBoxNetAdpCtl: Error while adding new interface: VBoxNetAdpCtl: ioctl failed for 
/dev/vboxnetctl: Invalid argument

.

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: HostNetworkInterface
Interface: IHostNetworkInterface {87a4153d-6889-4dd6-9654-2e9ff0ae8dec}

I get the same basic error code from vagrant.

Trying to use bridged networking winds up basically taking down my host. I suspect it has something to do with not releasing loopbacks…basic terminal commands quit returning, hard disk writes block, etc. Years ago, I had a job at a company that used dial-up for internet access. I tried running linux, very briefly. I had the same sorts of errors where doing something basic would freeze, wait for the corporate modem to do its thing, and then play nicely until that connection timed out and it would happen all over again.

It may be something totally different, but it feels like something similar. (The actual problem would be pretty difficult to trouble-shoot: I’m running a heavily customized kernel, and docker is setting up its own bridged connection, even though the actual docker daemon crashes because of some problem with that connection…this is why you should always do development work inside a VM from the get-go).

New Old-School

My next thought was to give LXC a shot. I really want ubuntu inside a real VM so I’m using its default kernel, but at this point I just desperately wanted to get something going. So I set about looking into LXC from gentoo.

The current LXC version in portage is 0.8, which seems to have the same limitations as the CLI available under ubuntu precise. I can see that a machine’s running, but there wasn’t an obvious way to connect automatically: the ultimate problem I’m trying to solve here is to have scripts log in and do useful work (and the VM servers we have available are far too slow).

So I spent a lot of time customizing my kernel for cgroups, trying to clear out all the errors that show up with lxc-checkconfig. I finally managed to clear up all of them except the complaint that “Cgroup memory controller: missing”. Googling for that turned out to be a complete waste of time (and the main motivation for writing this post).

I eventually broke down, cloned lxc from github, and started building it from scratch. Its README warns to carefully check the summary output from configure. It suggests trying to run –enable-feature on any features it doesn’t find that you want so you can see what the problem was.The missing pieces that stood out (for now…Apparmor is on my list) in there was:

Environment:
 - init script type(s):
Security features:
 - cgmanager: no

At the time, I didn’t realize that the blank “init script type(s):” line was interesting, but now it seems symptomatic.

So I tried rerunning `configure –enable-cgmanager` and received the error “No package ‘libcgmanager’ found”. That seemed as quick and easy as installing a package under gentoo ever is. I started trying to emerge it. And was promptly shocked that it wasn’t obvious.

Politics

So I started googling around and ran into the hotbed of nasty political worms that’s swirling around the politics involved in cgroups.

I don’t know enough about the actual issue to have much of an opinion either way. I don’t even know enough to try to summarize the actual issues involved. Except that they seem to culminate in what I ran into:

Moving forward, if you want to run cgroups (and, in particular, the cgroupmanager), you’re going to be forced to switch to systemd. Which I really don’t want to do, if only because I’m basically being told I don’t have a choice in the matter. Whether I want to or not is really beside the point. For now, I don’t have time to make that kind of major switch.

Ubuntu/Debian from Scratch

This led me down another rabbit trail, which basically amounted to installing ubuntu by hand (I had a running system with a spare disk partition, but nothing I could use to boot from an ISO). Ultimately, it’s not that different from installing gentoo: use `debootstrap` to get the equivalent of a Stage 3 environment, mount the special partitions like /proc, chroot into it, configure it, add a user, then set up grub to also boot from that new partition.

I ran into some issues doing this:

  1. Ubuntu really doesn’t like the passwords that gentoo creates in /etc/shadow. It seems to have something to do with the hashing algorithm. Or maybe the salt. Actually, this bit me while I was still trying to get things going through an lxc container going…I don’t really care about cgroup protection. I was able to overcome this by doing a standard old-fashioned chroot to have ubuntu add its own users.
  2. I started using debootstrap through the lxc-ubuntu template. The documentation of both leaves out a really important detail: /etc/apt/sources.list is really vital. If that file’s missing (why would I have something like?), it defaults to searching the kernel mirrors for a debian release. This error showed up in a complaint about missing GPG key rings and an inability to find something along the lines of http://kernel.org/debian/dist/trusty (TODO: I should really dig up that actual error to make life easier on google). I started hacking into the lxc-template, but the real solution was just to run the command as `sudo MIRROR=http://mirrors.kernel.org/ubuntu lxc-create -t ubuntu -n container-name — –release trusty –arch amd64`. (I probably didn’t need the arch argument, but it’s what worked, and it was well after midnight at this point).
  3. I had to dig into the way grub2 generates its menus to basically hard-code a kernel/root combination using the 40custom script (or something along those lines…I don’t have the box handy to check). It shouldn’t be a big deal, but I’m not happy with the solution I came up with–especially since I seem to build a new kernel once a week or so.
  4. I couldn’t get networking to happen automatically inside ubuntu. I wound up mounting my gentoo partition from ubuntu, changing into my kernel source tree, running `make modules_install`, then slapping together a script to run something like `ifconfig up eth0` and `dhcpclient eth0` (again…I don’t have that box handy to check). It certainly isn’t a good solution, but it was good enough for now. And I don’t plan to spend any more time in ubuntu land than I must.

EDIT 2014MAR08, 11:46:

LXC seems to have gotten smarter about the “cgroup memory controller” problem. I’m not sure how, but the latest version from github seems happy with my setup. (At least, lxc-checkconfig returns all green statuses).

Crunch Time

It’s that time at work again. The part that pretty much every software developer dreads. We’re right on the verge of a fresh release, which means we’re right at the deadline, tempers are frayed, everything seems to be crap, nothing works right, and we’re all working crazy-long hours.

One team pulled an all-nighter earlier this week. I managed to avoid that, but I expect to be working most of the weekend. And we’re just hitting the final two week stretch.

Honestly, this isn’t all that bad. We spent around 6 months in this phase at one of my first programming jobs. Then the company laid off most of the engineers so they could afford to hire salespeople.

Minesweeper

Once upon a time, back when the earth was young, the sky was new, and people weren’t quite as concerned about pollution, I bought a computer.

Back in those olden times of yore, this was actually an event worthy of merit. Believe it or not, I had salespeople who tried to convince me that I did *not* want the latest and greatest: that shit was for businesses. Why on earth would any individual every need 4 MB of RAM or a 500 MB hard drive?

That’s a different story.

They *did* introduce me to this weird new device called a mouse. I still have my doubts about it. It sits around somewhere between my keyboard, my latte, my kitty cat, my barrel of wasabi peanuts, my guitar, my pencil collection, and my wife.

I hope you’ll understand that I do my best to keep my hands very, very far away from any of that except my wife. (If you don’t, you’ve never been married…I’ll have another series of essays soon about how to deal with this flaw in your personal character…it’ll sell for a low, low price).

Once upon a time, I bet I once spent 4 or maybe even 6 hours at a time playing minesweeper, trying to figure out how a mouse works. There was always the thrill of seeing a new batch of free territory open up to keep me trying.

I’m pretty sure that, back in those days, I’d never have guessed that I’d be sitting here one night cursing some programming framework for setting up everything so horribly wrong so that creating a freaking minesweeper clone has taken more than 12 hours of my time.

Graphics and Lisp

I’ve been having fits with this for almost a year now.

I’ve written about some of the pain involved elsewhere. Someday, I may even dig up those angst-driven pieces for others to share my woes.

Until then. I think I may be onto something.

First, start with downloading the zip file from sourceforge (yeah, I know…they obviously aren’t very interested in playing nicely with others). Extract it somewhere. I stuck it in ~/downloads and extracted it into ~/downloads/extract.

Do a `lein new app best-name-ever` to initialize the project you actually want. Or add this piece to an existing project.

Inside your project, `mkdir native` to set up a folder where your native dependencies can live.

The lwjgl binary you extracted [from sourceforge…this entire thing is pretty ridiculous] should have a folder named ‘native’.

There should be a folder that matches your architecture (i.e. macosx, linux, or windows…if you’re using anything else, you probably think you know *way* more about computers than I, so why would you be wasting your time reading this?) under there.

Copy the contents of that folder into the native/ folder you created inside your leiningen project. Add an entry to the :dependencies vector. For me, that seems to be:

[org.lwjgl.lwjgl/lwjgl “2.9.0”]

Then I need to add that piece to…beats me. It looks like the kind of BS that drove me to get into higher-level languages in the first place:

:jvm-opts [~(str “-Djava.library.path=native/:” (System/getProperty “java.library.path”))

I feel bad for even thinking about publishing this. I can’t take any credit at all. Someone else devoted a lot of hours to figuring out that little detail. And I’m not giving that person anywhere near enough credit.

It’s not fair, but I’m really just trying to pass information along. And maybe add a little bit.

Since, after all, this is where the shit really gets interesting. Up until now, it’s all been configuration (and, if you’re like me, wondering how to make this work for consumers). That’s still just sysadmin stuff.

What about actual code? How does it match all those frustrating examples that just assume the imports (if they’re shown at all) magically happen and you can get busy doing your thing?

I pretty much have 2 lines of code to show at this point:

(org.lwjgl.opengl.DisplayMode. 800 600)

and

(import ‘[org.lwjgl.opengl)

No, those aren’t helpful at all. But they’re a start. And, dammit, newbs across the clojure community still struggle to try to figure out the what and how behind (import). Much less the why.

Hopefully this will provide a hint. Either to them or to me in the morning. Whichever.

Based on that import:

(org.lwjgl.opengl.DisplayMode. 800 600)

creates a new DisplayMode instance.

At this point, I was able to follow along with the basic examples at Roger Allen’s hello_lwjgl, and life is looking promising.