[3648/3845] Linking default/source3/smbd/smbd default/source3/libsmbregistry-samba4.so: error: undefined reference to 'state_path' default/source3/libsmbregistry-samba4.so: error: undefined reference to 'db_open' collect2: error: ld returned 1 exit status
Adding -Wl,--allow-shlib-undefined to LDFLAGS fixes this.