When building puppet-agent's libselinux component with vanagon for el5 platform, swig (1.3.29) generates a non usable output. The file contains invalid calls (mostly because the Ruby version is newer than the expected).
Not much experience with swig but I managed to solve the problem applying a patch after running swig. This patch change calls to RSTRING struct pointers to use StringValueLen and StringValuePtr.
You can check the changes we made https://github.com/cernops/puppet-agent/commit/5122a3e24aeba29293ba0735d411513f0fcfd9e1.