Managed to build on Fedora 25 with "LDFLAGS='-Wl,-rpath,/usr/lib/samba' ./waf configure" then "./waf build". The only problem - now all error messages goes to stdout, not stderr.