Bug 12276 - Native linking failed - pointer being freed was not allocated
Summary: Native linking failed - pointer being freed was not allocated
Status: RESOLVED DUPLICATE of bug 6998
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-05-17 00:11 UTC by Dennis Welu
Modified: 2013-05-20 14:33 UTC (History)
2 users (show)

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


Attachments
Solution which illustrates the error (2.37 MB, application/zip)
2013-05-17 00:20 UTC, Dennis Welu
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 DUPLICATE of bug 6998

Description Dennis Welu 2013-05-17 00:11:30 UTC
Getting error in project but only when the deployment target is set to 6.1 and deploying to device. Deploying to simulator works fine. Switching the deployment target back to 5.1 and everything works fine.

This is similar to https://bugzilla.xamarin.com/show_bug.cgi?id=10685 and https://bugzilla.xamarin.com/show_bug.cgi?id=11929. There is a native library being referenced, compiled to dll from here: https://github.com/mono/monotouch-bindings/tree/master/Route-Me.

An example project is attached with the compiled native dll.

I have tried building the native library in xcode with stripping of dead code disabled, and the other linker flags including the "-all_load" option, but nothing showed up in the xcode build in regards to duplicate symbols. The only thing I see is two deprecation warnings for a couple lines of code in the xcode build.

We have also tried changing around the LinkWith attributes (as discussed in one of the similar threads) in the bindings project (not included in the attachment) but to no avail.



BEGIN BUILD OUTPUT:

Build complete -- 0 errors, 0 warnings

Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" -v --cache "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/RouteMe.dll" -debug -linksdkonly -sdk "6.1" -targetver "6.1" --abi=armv7 "-v" "-v" "-v" "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.exe"
MonoTouch Business version 6.2.4.2 (c4f6316) using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
Copied /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.exe to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/RecreateLinkError.exe
Copied /Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/mscorlib.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/monotouch.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/System.Core.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/System.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/Mono.Security.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/System.Xml.dll
Copied /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll to /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/RouteMe.dll
Linking SDK only for assembly /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.exe into /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app
reusing cached /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/System.armv7.cache.0vJuevESbggkjGy9VVEWHENO9YA=.o
reusing cached /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/mscorlib.armv7.cache.U5jT04RiXI1pTNA+2rWmF9YDs0g=.o
reusing cached /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/System.Core.armv7.cache.UbnRq6RRKFPJu689dE1pKsqY9qM=.o
MONO_PATH=/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError.exe.armv7.s "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/RecreateLinkError.exe"
MONO_PATH=/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll.armv7.s "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/RouteMe.dll"
MONO_PATH=/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,no-direct-calls,iphone-abi,outfile=/var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/monotouch.dll.armv7.s "/Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/monotouch.dll"
Mono Ahead of Time compiler - compiling assembly /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/RecreateLinkError.exe
Code: 2708 Info: 36 Ex Info: 614 Unwind Info: 102 Class Info: 143 PLT: 16 GOT Info: 120 GOT: 140 Offsets: 77
Output file: '/var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError.exe.armv7.s'.
Linking symbol: '_mono_aot_module_RecreateLinkError_info'.
Compiled 10 out of 10 methods (100%)
Methods without GOT slots: 0 (0%)
Direct calls: 0 (0%)
JIT time: 1 ms, Generation time: 1 ms, Assembly+Link time: 0 ms.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++  -miphoneos-version-min=6.1 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x assembler-with-cpp -c /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError.exe.armv7.s -o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError.exe.armv7.o
Mono Ahead of Time compiler - compiling assembly /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/RouteMe.dll
Code: 323444 Info: 5495 Ex Info: 71642 Unwind Info: 1712 Class Info: 2487 PLT: 297 GOT Info: 3597 GOT: 5176 Offsets: 3926
Output file: '/var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll.armv7.s'.
Linking symbol: '_mono_aot_module_RouteMe_info'.
Compiled 600 out of 600 methods (100%)
Methods without GOT slots: 0 (0%)
Direct calls: 0 (0%)
JIT time: 68 ms, Generation time: 73 ms, Assembly+Link time: 0 ms.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++  -miphoneos-version-min=6.1 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x assembler-with-cpp -c /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll.armv7.s -o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll.armv7.o
Mono Ahead of Time compiler - compiling assembly /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/bin/iPhone/Debug/RecreateLinkError.app/monotouch.dll
Code: 149856 Info: 4229 Ex Info: 53548 Unwind Info: 2676 Class Info: 4766 PLT: 523 GOT Info: 9084 GOT: 3940 Offsets: 5022
Output file: '/var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/monotouch.dll.armv7.s'.
Linking symbol: '_mono_aot_module_monotouch_info'.
Compiled 927 out of 927 methods (100%)
Methods without GOT slots: 392 (42%)
Direct calls: 0 (0%)
JIT time: 87 ms, Generation time: 94 ms, Assembly+Link time: 0 ms.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++  -miphoneos-version-min=6.1 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x assembler-with-cpp -c /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/monotouch.dll.armv7.s -o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/monotouch.dll.armv7.o
use cached /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/main.armv7.cache.EQ6kLfwxvLPlSgsi9uERAHcZxgA=.o
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++  -miphoneos-version-min=6.1 -gdwarf-2  -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x objective-c -c  -o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/registrar.armv7.cache.mi5TfEG7vH1wx+kS1d-UyKNE4p0=.o -
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++  -Wl,-no_pie  -miphoneos-version-min=6.1 -gdwarf-2  -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/System.armv7.cache.0vJuevESbggkjGy9VVEWHENO9YA=.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/mscorlib.armv7.cache.U5jT04RiXI1pTNA+2rWmF9YDs0g=.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/System.Core.armv7.cache.UbnRq6RRKFPJu689dE1pKsqY9qM=.o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError.exe.armv7.o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll.armv7.o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/monotouch.dll.armv7.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/main.armv7.cache.EQ6kLfwxvLPlSgsi9uERAHcZxgA=.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/registrar.armv7.cache.mi5TfEG7vH1wx+kS1d-UyKNE4p0=.o -o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError -framework CFNetwork -framework Foundation -framework UIKit -framework AudioToolbox -framework QuartzCore -framework CoreLocation -framework CoreGraphics -framework CoreFoundation -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib  -force_load /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/libMapView.a -lz -lsqlite3
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++  -Wl,-no_pie  -miphoneos-version-min=6.1 -gdwarf-2  -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/System.armv7.cache.0vJuevESbggkjGy9VVEWHENO9YA=.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/mscorlib.armv7.cache.U5jT04RiXI1pTNA+2rWmF9YDs0g=.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/System.Core.armv7.cache.UbnRq6RRKFPJu689dE1pKsqY9qM=.o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError.exe.armv7.o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RouteMe.dll.armv7.o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/monotouch.dll.armv7.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/main.armv7.cache.EQ6kLfwxvLPlSgsi9uERAHcZxgA=.o /Users/denniswelu/Documents/Projects/RecreateLinkError/RecreateLinkError/obj/iPhone/Debug/mtouch-cache/registrar.armv7.cache.mi5TfEG7vH1wx+kS1d-UyKNE4p0=.o -o /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/RecreateLinkError -framework CFNetwork -framework Foundation -framework UIKit -framework AudioToolbox -framework QuartzCore -framework CoreLocation -framework CoreGraphics -framework CoreFoundation -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib  -force_load /var/folders/0t/z2shp7y529d6zp4_ynqrq6180000gn/T/tmp3efbf91d.tmp/libMapView.a -lz -lsqlite3
collect2: ld terminated with signal 6 [Abort trap: 6]
ld(14087,0x7fff75909180) malloc: *** error for object 0x7fdf835d1ff0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

error MT5202: Native linking failed. Please review the build log.
  at MTouch.CompileToNative (System.String user_gcc_flags, System.Collections.Generic.List`1 assemblies, IList`1 inputs) [0x00000] in <filename unknown>:0 
  at MTouch.Main2 (System.String[] args) [0x00000] in <filename unknown>:0 
  at MTouch.Main (System.String[] args) [0x00000] in <filename unknown>:0 

---------------------- Done ----------------------

Build: 1 error, 0 warnings
Comment 1 Dennis Welu 2013-05-17 00:20:12 UTC
Created attachment 3981 [details]
Solution which illustrates the error
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-05-20 07:53:26 UTC
The relevant comments in the duplicated bug report are these (there is a lot of noise there):

https://bugzilla.xamarin.com/show_bug.cgi?id=6998#c9
https://bugzilla.xamarin.com/show_bug.cgi?id=6998#c10

*** This bug has been marked as a duplicate of bug 6998 ***
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-05-20 07:55:33 UTC
I've also modified the RouteMe binding to not explicitly link with CoreFoundation, which should fix the issue for you: https://github.com/mono/monotouch-bindings/commit/b39d56dc355d3b6ab2c0a30633d9ca49b6965432
Comment 4 Dennis Welu 2013-05-20 14:33:30 UTC
Thanks Rolf! That did indeed fix the issue. I swear we'd tried that already based on one of the threads out there...but thinking back I'm wondering if it was one of the other frameworks we removed and not CoreFoundation. Not sure. But moving on! We appreciate you looking into the issue and connecting the dots for us.