bsupnik / bricksmith

LDraw Modeler for OS X
BSD 2-Clause "Simplified" License
12 stars 6 forks source link

Code signing problem #13

Closed d029940 closed 1 year ago

d029940 commented 2 years ago

As soon as I let XCode13 migrate the project files (*.xcodeproj) and let code signing checked, I cannot build the project (Trunk version of Bricksmith). No problems building subproject LSynth and AMSProgressBar. But the Bricksmith project cannot be built - no matter if you use "Sign locally" or "Developer Id"

I figured out that the culprit is "lsynth.mpd", which will be copied to the executable as the last step in "Build Phases - Copy LSynth". It also does not matter if you check "Code sign on copy" on or off.

Here is the output of the build phase:

CodeSign /Users/manfred/Library/Developer/Xcode/DerivedData/Bricksmith-bzbzgqtquajathcgvfbzshquszvq/Build/Products/Debug/Bricksmith.app (in target 'Bricksmith' from project 'Bricksmith')

cd /Users/manfred/Developer/XCode/Lego/bricksmithMK/trunk/Bricksmith
export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "-"

/usr/bin/codesign --force --sign - --entitlements /Users/manfred/Library/Developer/Xcode/DerivedData/Bricksmith-bzbzgqtquajathcgvfbzshquszvq/Build/Intermediates.noindex/Bricksmith.build/Debug/Bricksmith.build/Bricksmith.app.xcent --timestamp\=none --generate-entitlement-der /Users/manfred/Library/Developer/Xcode/DerivedData/Bricksmith-bzbzgqtquajathcgvfbzshquszvq/Build/Products/Debug/Bricksmith.app

/Users/manfred/Library/Developer/Xcode/DerivedData/Bricksmith-bzbzgqtquajathcgvfbzshquszvq/Build/Products/Debug/Bricksmith.app: code object is not signed at all In subcomponent: /Users/manfred/Library/Developer/Xcode/DerivedData/Bricksmith-bzbzgqtquajathcgvfbzshquszvq/Build/Products/Debug/Bricksmith.app/Contents/MacOS/lsynth.mpd

I can only build the whole project if I switch code signing for the Bricksmith project completely off (s. attached file).

Bricksmith codesigning problem

allenmonroesmith commented 2 years ago

Code signing isn't supposed to be enabled. I don't have a Mac developer account, and I've no plan to get one either.

I've used Xcode 13 and didn't have this problem—did you let it fix the project settings warning that I haven't braved trying yet?

d029940 commented 2 years ago

Yes I let fix the project settings. You can either sign ist locally or with a developer id or with a paid developer account. I do not have the paid account either. But you can sign it (for whatever reason) without having a paid Developer Apple Account. Signing is done automatically if you migrate the project settings as proposed by Xcode 13 leaving all migration steps on. That is what I did because I thought I should follow Apple recommendations. (We shouldn't do it blindly). So these are the options:

allenmonroesmith commented 2 years ago

Since it isn't going to be signed when distributed anyway, it seems to me the correct code-signing state is off.

d029940 commented 2 years ago

Attached you will find a suggestion to read the file lsynth.mpd from the program. Just a small change in LDrawSynth.m. Here is the code for copying:

if ([configPath length] == 0) { configPath = [[NSBundle mainBundle] pathForResource:@"lsynth" ofType:@"mpd"]; }

Screenshot 2022-02-15 at 14 04 09

This modification enables us to get rid of copying lsynth.mpd in the build phases of the Bricksmith project target.

Hence the project can be signed locally, with a personal developer account or with a paid account.

As far as I read from the internet, signing is mandatory, if you want to use Xcode Instruments to check for allocations. I think this is a valid tool for checking memory leaks, especially when we are starting to convert to ARC.

Please correct me, if I am mistaken.