Handle multi-arch builds better

Change-Id: I80bfcd6e62650bf4bc6c12dd5f6077262a322ebb
Reviewed-on: http://review.couchbase.org/43089
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>