Sunday, June 18, 2006

Debugging Java used in Cocoa apps with the Objective-C Bridge:

In relation to some work I was doing with Adium, I became frustrated at the lack of any way to deal with debugging java classes that are used via the Cocoa-Java bridge. In a moment of desperation, I sought out various means of debugging or profiling, and I accidentally found a valid solution:
add
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

to the JVM arguments as specified in your application's Info.plist.
The way to do this is as follows:
<key>VMOptions</key>
<string>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</string>


You can then connect to the application using the java debugger of your choice, the line to do this with jdb is
jdb -attach 8000


I've heard that I should try using something like Eclipse, so if you aren't up on debugging in the Java world I guess it's worth giving that a look. I've also heard good things about IntelliJ, but that costs a reasonable chunk of money.

Sunday, June 11, 2006

I've not seen these listed related to Mac stuff elsewhere, so I'm posting here in hopes that next time I have this problem and I have forgotten how to fix it I'll be able to Google it and find this...

I was building ffmpeg from source into static libs, then working on building those into something else. Somewhere along the line I got the error

/usr/bin/ld: staticLibs/libavcodec.a(mem.o) has local relocation entries in non-writable section (__TEXT,__symbol_stub1)

the fix is to add "-read_only_relocs suppress" to OTHER_LDFLAGS, and then you should be sitting pretty. I'm betting this isn't a good setting to need on, but at least it makes the build happen.