If it is on different hardware platforms then it's possible. SIGBUS usually means alignment problems - instead of a pointer being aligned on a page boundary or a longword boundary, it's off by a few bytes. Or, more likely, it references an address that is off.
The reason I suggested corruption (or something is changing the value) is because
the code obviously worked earlier in the code - dlclose is called after you're done.
The pointer "worked" earlier.
I'm guessing you are probably overwriting the stack somewhere earlier in the code.
Now, if you suspect the compilation issue, then compile locally, and do a test run. If problems go away, then you have runtime library differences from box to box that are trashing the pointer.
See the post by driver about tracking down mysterious corruption:
https://www.unix.com/programming/20704-memory-stack-problem.html