Bug 53132 - Xamarin.iOS iPhone simulator debug build causes duplicate symbol error
Summary: Xamarin.iOS iPhone simulator debug build causes duplicate symbol error
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 10.3 (iOS 10.2)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-03-07 21:35 UTC by mli
Modified: 2017-05-03 15:11 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Simple project with sqlite-net-pcl-cipher and Akavache.Core (59.32 KB, application/zip)
2017-03-07 21:35 UTC, mli
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description mli 2017-03-07 21:35:07 UTC
Created attachment 20192 [details]
Simple project with sqlite-net-pcl-cipher and Akavache.Core

Hi,

I am using Akavache.Core 5.0.0, SQLite net pcl 1.3.1 and SQLitePCLRaw.bundle_sqlcipher 1.1.2 for my project and I ran into a very weird issue again. The issue is that, when I build and debug the app in Android (simulator or the actual phone), the app runs just fine. In iOS, when I build and debug the app on an actual device, the app compiles and runs just fine also, but when I try to build the app on a Simulator, then I get the following error message:

MTOUCH:  duplicate symbol _sqlite3_result_error in: 
	MTOUCH: error MT5212: Native linking failed, duplicate symbol: '_sqlite3_stmt_busy'.
	MTOUCH: error MT5213: Duplicate symbol in: /Users/joeli/Repo/SQLiteCipherTest/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/libsqlcipher.a(sqlite3.o) (Location related to previous error)
	MTOUCH: error MT5213: Duplicate symbol in: /Users/joeli/Repo/SQLiteCipherTest/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/e_sqlite3.a(sqlite3.c.o) (Location related to previous error)
	MTOUCH: error MT5212: Native linking failed, duplicate symbol: '_sqlite3_mutex_try'.
	MTOUCH: error MT5213: Duplicate symbol in: /Users/joeli/Repo/SQLiteCipherTest/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/libsqlcipher.a(sqlite3.o) (Location related to previous error)
.
.
.
 0 Warning(s)
104 Error(s)

In summary, the only one that is causing an issue is debugging with an iOS simulator. You may find a simple project that demonstrates the issue. Any help will be greatly appreciated.

Thank you very much!

Ming


Xamarin Studio Info:
Xamarin Studio Professional
Version 6.2 (build 1821)

Nuget 3.5.0.0

Xamarin Android
Version 7.1.0.41
Supported Android versions: 6.0, 7.0 and 7.1 (API 23, 24 and 25).
SDK Tools Version: 25.2.2
SDK Platfom Tools Version: 25

Xamarin.iOS
Version 10.4.0.123

Operating System
Mac OS X 10.11.6
Comment 1 Vincent Dondain [MSFT] 2017-03-09 23:03:18 UTC
I can confirm this bug with the following environment: https://gist.github.com/VincentDondain/4d65bf889dfe66bf2accfb7ad50a57f4

Builds just fine for iOS Device but fails with the error mentioned in comment 1 on simulator.
Comment 2 Sebastien Pouliot 2017-03-25 17:16:26 UTC
@Alex, please have a look at this. Thanks!
Comment 3 Alex Soto [MSFT] 2017-03-26 04:26:22 UTC
Hello, could you confirm that this works on iOS device? I just tested your project building for device and I got the same errors (duplicated symbols) as in simulator.

My take is that the native libraries (.a) libsqlcipher.a (SQLitePCLRaw.lib.sqlcipher.dll) embeds SQLite and clashes with e_sqlite3.a (SQLitePCLRaw.lib.e_sqlite3.dll). So two versions of SQLite are getting linked and that is the reason native linker (ld) complains about duplicated symbols.

You can only link one version of SQLite so you would need to drop one of the two dlls either sqlcipher or e_sqlite3. Being honest I am not completely familiar on how SQLitePCLRaw works I can have a deeper look on Monday ;)

That being said this is not a Xamarin.iOS issue :) you would get the same errors if you tried to link libsqlcipher.a and e_sqlite3.a in a Xcode project. Let me give it a second view on monday so I can provide a better suggestion. In the meantime could you look into testing on device again?

Cheers!
Comment 4 Alex Soto [MSFT] 2017-03-26 15:09:49 UTC
Moving out of 15.2, this also happens on C9 on both device and sim

Xamarin.iOS
Version: 10.4.0.128 (Visual Studio Enterprise)
Hash: ba11e48
Branch: cycle9
Build date: 2017-03-10 08:48:04-0500
Comment 5 mli 2017-03-27 14:33:21 UTC
Hi Alex,

Thank you very much for look into this issue. Previously, I was building the project with iPhone 7 plus(the actual device) and the following Xamarin Studio configurations:

Xamarin Studio Professional
Version 6.2 (build 1821)

Xamarin Android
Version 7.1.0.41
Supported Android versions: 6.0, 7.0 and 7.1 (API 23, 24 and 25).
SDK Tools Version: 25.2.2
SDK Platfom Tools Version: 25

Xamarin.iOS
Version 10.4.0.123

I was able to produce the odd scenario that I described in the bug description.

Since then, I have updated the Xamarin.iOS to Version: 10.4.0.128, and I am getting the same errors that you were getting. :)

Thank you very much again for taking the time to help me. You are most likely correct that there's a conflict with the (SQLitePCLRaw.lib.sqlcipher.dll) and the(SQLitePCLRaw.lib.e_sqlite3.dll). Anyway, in my actual project, I have removed the Akavache nuget, so everything is good now.
Comment 6 Manuel de la Peña [MSFT] 2017-05-03 15:11:01 UTC
@Mli I'm closing the issue since you got it working and it is not a Xamarin issue. Please feel free to re-open it if you consider it necessary.