Is there a new dsymutil malloc bug in Xcode 7? Are dsyms necessary anymore?

Due to requirements of my product, I'm running xcodebuild from within a Mac OS X Cocoa app via an NSTask.


The NSTask is executing bin/sh with -c, which then executes the xcodebuild command.


Whenever I build for a device target, I get the following build failure:


dsymutil(15617,0x7fff78da9300) malloc: *** error for object 0x6100000e0380: pointer being freed was not allocated

*** set a breakpoint in malloc_error_break to debug

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil failed with exit code 6


Strangely enough, the very same command when run on the command line finishes without any error.


This seems like a bug. Can anyone provide any insight on this?


Do we need to be building apps with dSYMs anymore, given the new bitcode initiative?

By the way, I forgot to mention that this only started happening after I updated to Xcode 7.

--------------------------------------------------------------------------------

~ Process Info.plist (85 ms)

x Generate XWGSpace.app.dSYM (4873 ms)

--------------------------------------------------------------------------------

GenerateDSYMFile /Users/xwg/Library/Developer/Xcode/DerivedData/XWGSpace-cipjzkyqsejwylgoyyvdfrwleejk/Build/Intermediates/ArchiveIntermediates/XWGSpace/BuildProductsPath/Release-iphoneos/XWGSpace.app.dSYM /Users/xwg/Library/Developer/Xcode/DerivedData/XWGSpace-cipjzkyqsejwylgoyyvdfrwleejk/Build/Intermediates/ArchiveIntermediates/XWGSpace/InstallationBuildProductsLocation/Applications/XWGSpace.app/XWGSpace

cd /Users/xwg/Documents/Code/Childhood/Mobile/ios/XWGSpace/XWGSpace

export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/xwg/Library/Developer/Xcode/DerivedData/XWGSpace-cipjzkyqsejwylgoyyvdfrwleejk/Build/Intermediates/ArchiveIntermediates/XWGSpace/InstallationBuildProductsLocation/Applications/XWGSpace.app/XWGSpace -o /Users/xwg/Library/Developer/Xcode/DerivedData/XWGSpace-cipjzkyqsejwylgoyyvdfrwleejk/Build/Intermediates/ArchiveIntermediates/XWGSpace/BuildProductsPath/Release-iphoneos/XWGSpace.app.dSYM

dsymutil(34573,0x7fff7af2b300) malloc: *** error for object 0x608000123c00: pointer being freed was not allocated

*** set a breakpoint in malloc_error_break to debug

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil failed with exit code 6

--------------------------------------------------------------------------------

1 errored, 52 warning (110224 ms)

For more information please take a look at our recent forum post: Symbolicating Crashes for Applications Submitted with Bitcode.

Experiencing the same issue here. Have you had any luck with what the problem might be? Or a way to solve it? Unfortunately what we're using this for we can't rely on the XCode project being edited too heavily to avoid the error when using xcodebuild with NSTask.

I'm having the exact same issue. I found the changing the deployment target to 9.0 seems to resolve the issue. Anything less and it continues to crash during the build. I tried all deployment target versions available including 8.4 down to 7.0. Only iOS 9.0 seems to alleviate the issue.


Since 9.0 has had a pretty good adoption rate I think I'll stick with this solution.


Error is as follows:


Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/*****/Documents/Coding/Projects/Build/**.app/***** -o /Users/****/Documents/Coding/Projects/Build/*****.app.dSYM

dsymutil(46086,0x7fff7ab8c300) malloc: *** error for object 0x6080000e0500: pointer being freed was not allocated

*** set a breakpoint in malloc_error_break to debug

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil failed with exit code 6

Please file a radar at http://bugreport.apple.com and be sure to include the crash log.

Radar created, I'm not looking for a solution from Apple at the moment as we NEED this to work right now! I'm looking for a workaround or reason that this might be occuring. If you could possibly push the radar through your end, that would be fantastic! It's radar:

22853842

Accepted Answer

I have done more looking into this. For more info, if you make sure to remove "MallocNanoZone" property from the NSTask's environment property, then build functions perfectly and generates dsym files!

This matches my own solution to the same problem: I avoided the dsymutil crash by running xcodebuild with a clean environment (which removed MallocNanoZone=1 and changed DYLD_FRAMEWORK_PATH and a few other similar variables).

Hi Simon,

Thanks for the tip! This worked for me. Although, it's a bit concerning that this fixed it.


Do you (or anyone else) have any insight into why this may have fixed the problem? What does MallocNanoZone do? And probably importantly, what happens when MallocNanoZone is disabled?


Much appreciated,

Paul

Hi Matt,

Thanks for the info. Any chance you have any insight into my questions in reply to Simon?

Best,

Paul

Hi Jeremy,


Just a heads up – I filed a radar back in mid-September, but little could be done at the time. I sent my crash log as well. If it helps gather momentum, my radar number is 22726068.


Many thanks,

Paul

"remove "MallocNanoZone" property from the NSTask's environment property"?


Can someone share to me how should I do this? 🙂

Thanks!


---

UPDATE:


Okay, I think I've found the entry in "Edit Scheme" in Xcode.

Is there a new dsymutil malloc bug in Xcode 7? Are dsyms necessary anymore?
 
 
Q