Having difficulties getting TI SDK 4.01.00 graphics stack running in buildroot

I have created the appropriate buildroot configuration for the beaglebone black SGX graphics stack here:
https://bitbucket.org/j_omega/buildroot

This is built with all of the necessary components from TI SDK 4.01.00 to support the kmscube application.

However, I am having difficulties with the GBM library. The only way that I can get the kmscube application running is to copy /usr/lib/libgbm.so.2.0.0 from the pre-build SDK binaries. My build of libgbm create a segmentation fault.

Can anyone see what I am missing?

I should also point out that all NullWS demo applications work. The only application that is giving me problems is kmscube.

`

/etc/init.d/rc.pvr start

[ 21.711516] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
Loaded PowerVR consumer services.

kmscube

trying to load module omapdrm…failed.
trying to load module tilcdc…success.

Display [0]: CRTC = 24, Connector = 26, format = 0x34325258

Mode chosen [800x480] : Clock => 45000, Vertical refresh => 92, Type => 72
Horizontal => 800, 840, 888, 928, 0
Vertical => 480, 493, 496, 525, 0

Primary display => ConnectorId = 26, Resolution = 800x480

Initializing GBM…
gbm_create_device
failed to load module: /usr/lib/gbm/gbm_dri.so: cannot open shared object file: No such file or directory
failed to load module: /usr/lib/gbm/gbm_gallium_drm.so: cannot open shared object file: No such file or directory
loaded module : gbm_pvr.so
found valid GBM backend : gbm_pvr.so
gbm_surface_create
Segmentation fault
`

I figured out the problem.
Buildroot was automatically adding the following compiler flags. Removing these fixed the problem.

-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64