Linux LD_LIBRARY_PATH, rpath, and ld.so.conf (in that order)

I see a lot of people make life a lot more complicated for themselves than they need to because they don’t really understand how dynamically linked libraries work.

Let’s assume for the moment that you understand the pros/cons of static vs dynamic linking and a shared library is appropriate.

How do you make sure your program is using the correct library of the correct version?

In short: man ld.so


You can inspect which libraries a program is loading with readelf

readelf -d $PROGRAM

The linker will search in the following order:

  1. LD_LIBRARY_PATH environment variable
  2. rpath (man ld search “-rpath”)
  3. /etc/ld.so.conf (ldconfig to update)

Read More

GDB Pretty Printers in Python for Lua

Custom GDB Pretty Printers are super useful, especially when you are hacking on someone elses code. For instance, at the moment and am messing with the guts of Lua. It’s well written but super terse code. A couple pretty printers later and the super efficient but higly cryptic union data structures are unwrapped and displayed in a meaningful way as I am debugging.

Read More

OpenCV for Android 2.4.11, gradle-experimental, and Android Studio 1.4.1

The last few days I have been trying to get up to speed on ROS and OpenCV in the context of Android. I have to say that it’s been really frustrating. There has been a big transition in the Android world from Eclipse+Ant to Intellij+Gradle. Documentation has not been kept up, and downstream OpenCV has not followed the transition, in code or documentation. ROS Android is even further behind. It all adds up to a mess for someone like me who is new to java and Android.

Read More

Start

I design robots for a living. I bounce between mechanical, electronics and software design. I love it, it’s awesome!

Read More