Improve the method of detecting multiarch

Run a two step approach using gcc -print-multiarch and, if failed,
fallback to use dpkg-architecture.