String calculation of fayet-iliopoulos D-terms in arbitrary supersymmetric compactifications