Bug 29745 - Duplicate symbols when enabling the profiler
Summary: Duplicate symbols when enabling the profiler
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.10
Hardware: PC Mac OS
: Normal normal
Target Milestone: C6SR1
Assignee: Rolf Bjarne Kvinge [MSFT]
: 36390 ()
Depends on:
Reported: 2015-05-05 08:31 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2015-12-08 21:05 UTC (History)
8 users (show)

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

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:

Description Rolf Bjarne Kvinge [MSFT] 2015-05-05 08:31:32 UTC
* Create a new project from a template.
* Select a device configuration.
* Add to the additional mtouch arguments: "--gcc_flags -all_load"
* Enable profiling.
* Build.


> duplicate symbol _monoeg_g_array_new in:
>     /work/maccore/master/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonosgen-2.0.a(libeglib_la-garray.o)
>     /work/maccore/master/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmono-profiler-log.a(libeglib_la-garray.o)
> duplicate symbol _monoeg_g_array_sized_new in:
>     /work/maccore/master/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonosgen-2.0.a(libeglib_la-garray.o)
>     /work/maccore/master/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmono-profiler-log.a(libeglib_la-garray.o)
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-05-05 08:40:39 UTC
@Zoltan, can you have a look? This regressed here: https://github.com/mono/mono/commit/2b74940f64fb39b727b882c278eda31e06a15fcf
Comment 2 Udham Singh 2015-05-05 14:42:01 UTC
I have checked this issue with the help of steps given in bug description and able to reproduce the reported behaviour. Please refer the screencast : http://www.screencast.com/t/cAGymorUGwvJ

Build Output : https://gist.github.com/Udham1/0332e73e871982fcff16
Ide Log : https://gist.github.com/Udham1/9eb5b554509d57cb93b5

Environment Info : 

=== Xamarin Studio ===

Version 5.9 (build 464)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
	Mono 4.0.1 ((detached/5a0b19f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010024

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 1b48440
Branch: master
Build date: 2015-05-04 17:01:32-0400

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 509000464
Git revision: 97f3c43266a4abe2dff0a31b1afb976de897d099
Build date: 2015-05-04 10:06:54-04
Xamarin addins: 438f3e4b8352e006958552de07c6f54770c9233c

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 3 Zoltan Varga 2015-05-07 20:20:11 UTC
The problem is that the shared version of libmono-profiler-log needs to be linked eglib, but the static one doesn't, since it will be linked against libmono which already links against eglib.
Comment 4 Jacob Maristany 2015-05-28 13:50:48 UTC
Is there a workaround for this issue while we wait for a fix?
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-06-10 18:18:13 UTC
## Possible workarounds

A. Disable profiling under "Project Properties -> iOS Build".


B. If your app uses the `-all_load` linker flag (via either `gcc_flags` [1] or `LinkerFlags` [2]), try removing it.

> [1] http://developer.xamarin.com/guides/ios/advanced_topics/native_interop/
> [2] http://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/binding_types_reference_guide/#LinkWithAttribute.LinkerFlags

(Copied from the forum release thread:
Comment 6 Zoltan Varga 2015-10-23 23:21:52 UTC
@rolf: This can be fixed by cherry-picking 51f42669b2db7c37cd413d195df07638e0048ef1 from master and using the attached patch to maccore.
Comment 8 Rolf Bjarne Kvinge [MSFT] 2015-10-26 11:04:46 UTC
That's maccore patch is fine.
Comment 9 Rolf Bjarne Kvinge [MSFT] 2015-10-26 11:57:22 UTC
I'll add that patch to maccore once we switch to mono/master (for C7 likely).
Comment 10 Zoltan Varga 2015-10-26 17:16:30 UTC
This can be backported to old versions if needed.
Comment 11 Rolf Bjarne Kvinge [MSFT] 2015-10-27 09:37:01 UTC
@Zoltan, ok, maybe I should try to get it into C6SR1. Can you backport to mono's mono-4.2.0-thawed branch?
Comment 12 Zoltan Varga 2015-10-27 12:12:49 UTC
Done, 776aef3b102dd5b2a405de39b3d036694c02d189.
Comment 13 Rolf Bjarne Kvinge [MSFT] 2015-10-27 17:48:01 UTC

maccore/master: da500b515bba57673de122bb2f2cfafa0dc440c5
Comment 15 Zoltan Varga 2015-10-28 17:42:02 UTC
Applied the maccore patch to maccore master f773a69bed449844a4e9ad3251efc0dddc77840f.
Comment 16 Udham Singh 2015-11-23 07:31:17 UTC
I am able to reproduce this issue with XS However it is working fine with latest Master Builds i.e.
Here is the screencast for the same: http://www.screencast.com/t/1VslnCMP
Comment 17 Israel Soto [MSFT] 2015-12-08 21:05:15 UTC
*** Bug 36390 has been marked as a duplicate of this bug. ***