Segmentation fault running NvDecodeGL example on Ubuntu trusty

I can run the encoder example, but the decoder segfaults on startup. I get the same results with nvidia driver v 375.

Any idea what could be wrong?

#0  0x0000000000000000 in ?? ()
#1  0x00007fae188b6291 in init () at dlerror.c:177
#2  0x00007fae188b66d7 in _dlerror_run (operate=operate@entry=0x7fae188b6130 <dlsym_doit>, 
    args=args@entry=0x7ffdd6f10770) at dlerror.c:129
#3  0x00007fae188b6198 in __dlsym (handle=<optimized out>, name=<optimized out>) at dlsym.c:70
#4  0x00007fae1732012f in ?? () from /usr/lib/nvidia-381/libGLdispatch.so.0
#5  0x00007fae173208b9 in ?? () from /usr/lib/nvidia-381/libGLdispatch.so.0
#6  0x00007fae18ac90cd in call_init (l=0x7fae18ca8000, argc=argc@entry=1, argv=argv@entry=0x7ffdd6f10848, 
    env=env@entry=0x7ffdd6f10858) at dl-init.c:64
#7  0x00007fae18ac91f3 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, 
    l=<optimized out>) at dl-init.c:36
#8  _dl_init (main_map=0x7fae18cdd1c8, argc=1, argv=0x7ffdd6f10848, env=0x7ffdd6f10858) at dl-init.c:126
#9  0x00007fae18aba30a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#10 0x0000000000000001 in ?? ()
#11 0x00007ffdd6f12307 in ?? ()
#12 0x0000000000000000 in ?? ()

This is using the Video_Codec_SDK_8.0.14

Found a similar problem here:

https://stackoverflow.com/questions/31579243/segmentation-fault-before-main-when-using-glut-and-stdstring

Tried to change the link order without success. Finally got it working by upgrading to g++ 5

https://askubuntu.com/questions/623350/how-to-install-g-5-1-on-ubuntu-desktop-15-04-64-bit

Now the program hangs inside cuvidCreateVideoSource