Please rename "read_data()" to something unique.
Samba has a shared symbol in their util libraries also called "read_data()" and this duplicate name is breaking Kodi.
Kodi uses cmake and cmake is pulling in libmicrohttpd, which pulls in gnutls, which pulls in trousers. Kodi also uses Samba (libsmbclient) to read videos or music from SMB shares. The compile-time linking that cmake enforces causes Kodi / ld to prefer the trousers symbol over the Samba symbol and Samba library calls crash Kodi.
To be specific:
src/tspi/ps/ps_utils.c: read_data(int fd, void *data, UINT32 size)