productbuild crashed with Segmentation fault: 11

While doing the final .pkg file calling the tool:
productbuild --distribution "$DIS_FILE" --resources "$RES_DIR" --package-path "$PKGS" --version "$VERSION" "$PKG_NAME"

And the crash stack is:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libxar.1.dylib                	0x00007fff2ae2c00c xar_file_new_from_parent + 190
1   libxar.1.dylib                	0x00007fff2ae29d59 xar_add_frombuffer + 63
2   com.apple.PackageKit          	0x00007fff3ba79a2f -[PKMutableXARArchive setData:forPath:compressed:] + 246
3   com.apple.PackageKit          	0x00007fff3babb38e -[PKArchiveDistributionContainer setResourceData:forKey:forLocalization:] + 284
4   com.apple.PackageKit          	0x00007fff3bab9fef -[PKMutableDistributionContainer storeResourcesAtPath:forLocalization:] + 922
5   com.apple.PackageKit          	0x00007fff3baa5590 -[PKArchiveProduct(ForMutableSubclassers) addResourceDataAtPath:] + 324
6   productbuild                  	0x000000010efdc8a8 0x10efd8000 + 18600
7   productbuild                  	0x000000010efdba6e 0x10efd8000 + 14958
8   libdyld.dylib                 	0x00007fff204c0f3d start + 1

While using macOS 11.6.7, xcode 12.3, and CLT 11.1

Well, that’s annoying. Even more annoying is that I’m having issues working with your crash report. I suspect that it might have been munged by DevForums. Can you email me a copy? My address is in my signature.

Make sure to reference this thread ’cause I get a lot of email |-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi @eskimo

I just mailed you the crash report.

Thanks!

Also happens in a Catalina machine, same xcode and CLT version though.

I just mailed you the crash report.

Thanks. Sorry I didn’t respond then; it slipped through the cracks.

Unfortunately the new crash report didn’t reveal anything particularly enlightening )-:

The only thing that springs out in that productbuild is crashing while trying to add resources to the package and you’re specifically doing that using the --resources option. If you leave that off, does it stop crashing? If so, you could try adding resources back in until it start crashing again.

Also happens in a Catalina machine

From an Apple perspective it’d be much more interesting to know whether this happens on macOS 12 or macOS 13 beta.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Happens as well on 12.5.1 (21G83). Xcode 13.3.1 (13E500a). Leaving out the one --resources parameter makes it run through without a crash.

Edit: The resources directory consists of 3 files, de.lproj, en.lproj and logo.png. Removing logo.png makes the crash go away.

Removing logo.png makes the crash go away.

Interesting. The productbuild tool shouldn’t crash in this case. Either this input is valid, in which case it should accept it, or not, in which case it should fail with a reasonable error.

It sounds like you can easily reproduce this crash. Given that, I encourage you to file a bug with the steps you took and any files that are needed. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Will try to, but not sure if I'm able to cleanly set up a minimal use case.

It looks like the actual crash was not the resource itself, but the two references to it in the .dist:

    <background file="logo.png" mime-type="image/png" alignment="bottomleft" scaling="none"/>
    <background-darkAqua file="logo.png" mime-type="image/png" alignment="bottomleft" scaling="none"/>

Deciding for only one of those avoids the crash, and leaving the background one shows the logo on my macbook, with my configuration. I have no idea what exactly background-darkAqua is or does.

I have no idea what exactly background-darkAqua is or does.

I’m hardly an installer expert — someone else in DTS covers that technology — but I suspect that this is just an extension of the background element to cover dark mode that didn’t make it into the Distribution Definition XML Schema Reference.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

background and background-darkAqua are for the installer wizard. They set up some login on the lower left corner. Each of them correspond to where the user runs the installer in light or dark theme.

Hi, I had the same problem with the background-darkAqua. There is any solution for it or a workaround? Thanks

As @eskimo pointed out, by removing some resources we narrowed it down to the background file. Without it the build goes fine so, for now we'll just skip it.

The odd part is that the same setup is in several machines, but only that one had an issue with said file (we event checked the shasum of it and it was fine).

BTW, It is also the file used in the field "background-darkAqua".

I encountered the same issue (previously using both background and background-darkAqua) and just found out the solution: make sure each one of them reference a different image file. Like so:

<background file="background.png" mime-type="image/png" scaling="none" alignment="left"/>
<background-darkAqua file="background-dark.png" mime-type="image/png" scaling="none" alignment="left"/>

Hope that helps.

productbuild crashed with Segmentation fault: 11
 
 
Q