Solving “Native linking failed” issues running Xamarin.iOS on Simulator

Some external libraries will cause the project fail to build on the iPhoneSimulator (e.g. x86_64) target. The resulting errors can be:

Native linking failed. Please review the build log.
Native linking error: 1 duplicate symbol for architecture x86_64
Duplicate symbol in: /Users/admin/Library/Caches/Xamarin/mtbs/builds/.../obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o (Location related to previous error)
Duplicate symbol in: /Users/admin/Library/Caches/Xamarin/mtbs/builds/.../obj/iPhoneSimulator/Debug/mtouch-cache/leveldb-library(leveldb_main.o) (Location related to previous error)
Native linking failed, duplicate symbol: '_main'.

Sometimes you can make the build work by adding --registrar:static in the Additional mtouch arguments (MtouchExtraArgs) setting of the iOS project properties.

Leave a Reply