Ok, After a lot of trials this was the solution.
I needed to export the interface classes explicitly, using attribute((visibility("default"))) And to make sure there is an entry in the vtable, define and empty virtual destructor for this.
It seems on some linux machines, if I don't export It does not recognize the RTTI, and returns a NULL.