Thursday, October 24, 2013

Golang, cgo, and XCode 5

TL;DR: Don't. Stick with XCode 4 for now.

I don't know much about developing on Mac. I may also be a moron. I'm a Linux guy and can at least make the claim that I'm a programmer. I'm definitely comfortable with command line tools and relatively uncomfortable with IDEs.

I've been working on a video game project on Mac in go, using go-gl. The go-gl suite is a set of thin wrappers around C opengl libraries. As such, it depends on local C compilers and the cgo compiler. My libraries are installed via MacPorts which required installing XCode and its command line tools. Those command line tools also provide tools and headers that will be used by cgo to compile go code and C code that are linked together.

When XCode 5 came out it showed up as a regular upgrade which I followed. I dutifully installed the new command line tools. I later found that I could no longer compile my game code. Any code that didn't require go-gl was working fine.

Eventually I found that the issue was that XCode 5 no longer includes GCC. I eventually figured out that if I install gcc47 from MacPorts, prefixed builds with CC="gcc-mp-4.7", built go from source, then prefixed all my go get and go run commands wit the above CC envvar I could get it to work. However, it would no longer produce static libraries for the opengl wrappers and my compiles that were previously instantaneous where now taking on the order of 10 seconds.

I upgraded to Mavericks today and my XCode along with it. It didn't help. Being frustrated I did more digging and found that if I went back to XCode 4 things should be fine again. I ripped out XCode 5, navigated the Apple Web Maze to find XCode 4, download it, grab the command line tools, etc. Seems to work now the way it used to.

Except, MacPorts is broken. Mavericks doesn't have /usr/bin/gnutar so I have to ininstall MacPorts. There's no binary package for Mavericks so I have to do a source install. That was at least painless. This gripe has nothing to do with go, of course.

Friday, October 18, 2013

Be Careful With Your Brain Drugs pt II

At a friend's suggestion I tried setting an alarm for a couple hours before I intend to get up and when it goes off I take my Cymbalta and go back to sleep. The idea is that after a couple hours of absorption the "upper" effect of the medication will be there and it will be easier to hop out of bed and be an obnoxious morning person.

Instead I had incredibly bizarre dreams. I normally have weird dreams but this was on another level. While they had what passes for dream continuity, I can only recall fragments and I won't try to reproduce them here.

The really strange thing was after I got up and into the shower. I found myself experiencing real paranoia. I wondered if someone had installed a camera in my bathroom. I wondered if someone else was in the room. I wondered if my girlfriend was going to ambush me when I reentered the bedroom.

For each of these thoughts it only took me a second to realize that it was unfounded, but when the thought occurred it felt plausible for an instant. Very strange.

I'm going to keep trying this for a couple days to see if it persists, settles down, or was just a fluke and additionally to see if it provides actual benefit. So far I don't feel particularly more alert but having taken the meds early they should diminish early and I will hopefully find it easier to get to sleep early.

Tuesday, October 15, 2013

Be Careful With Your Brain Drugs

I've always had trouble dragging myself out of bed. I've mentioned here that I have sleep problems and the early morning is the worst time for my motivation.

I take my Cymbalta once per it after I get up it. It's therefore at its lowest concentration in my system when I'm getting up. Since it has an "uplifting" effect I figured maybe it would make more sense to take it just before I go to bed so it will still have a fairly high concentration when I got up. The actual result was that it made me jittery at night and had trouble getting to sleep and staying asleep. I switched back to mornings pretty quickly.

I had run out yesterday but had a new prescription ready to be picked up. I grabbed it in the evening and took it as soon as I got home. It wasn't until about 7:00am that I realized why I couldn't sleep. My day was pretty much wasted for lack of ability to concentrate. I think I would have been better off not taking it yesterday.