Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 11 beta + of_v0.10.1 #6310

Closed
brightredchilli opened this issue Jun 14, 2019 · 10 comments

Comments

@brightredchilli
Copy link
Contributor

commented Jun 14, 2019

Hi all, sharing my experiences working with the latest XCode(Version 11.0 beta (11M336w)). I'm using Mojave 10.14.5 (18F132).

On fresh project creation, this causes a 'code object is not signed at all' error with libfmodex.dylib. Using @hiroMTB's awesome gist, I was able to sign that file. It had to be signed in the main project $(OF_ROOT)/libs/fmodex/lib/osx/libfmodex.dylib because it is copied to the target in a build step. To be clear, the money line from the gist is:

sudo codesign -fs "my-new-cert" path/to/ofrelease/libs/fmodex/lib/osx/libfmodex.dylib

Cool, at this point project builds! But then we immediately run into a crash

dyld: Symbol not found: __ZTISt11logic_error
  Referenced from: /Users/Ying/Code/of_v0.10.1_osx_release/apps/myApps/mySketch/bin/mySketchDebug.app/Contents/MacOS/mySketchDebug
  Expected in: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
 in /Users/Ying/Code/of_v0.10.1_osx_release/apps/myApps/mySketch/bin/mySketchDebug.app/Contents/MacOS/mySketchDebug

Not sure what's going on, but I basically went into the CoreOF.xcconfig file(located at $(OF_ROOT)/libs/openFrameworksCompiled/project/osx and removed the -framework AudioToolbox from the OF_CORE_FRAMEWORKS line.

To my surprise this works. I'm sure if I tried to do something audio related, it would blow up. Posting here in case someone can use it. Super curious to know if people know the root cause of the issue.

@ofTheo ofTheo self-assigned this Aug 7, 2019

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 8, 2019

Thanks for posting this.
It looks like another way to avoid code signing is to set the Code Signing Identity to Other... and then clear the text. See: https://stackoverflow.com/a/54296008

We might be able to change our template to have " " set for Code Signing Identity, though this probably will be a bit more of a hack than a long-term solution.

Another approach could be to Code Sign the libfmodex.dylib we use to make the packages.
I did a quick test and if I sign the lib in ⁨of_v0.10.1_osx_release⁩/libs⁩/⁨fmodex⁩/⁨lib⁩/osx⁩/ the examples build and run fine.

Can you try this signed libfmodex.dylib replacing the old one and see if it works for you, without the extra steps you describe? If so then it should be fairly easy to include a signed libfmodex.dylib in the packages.

libfmodex.dylib.zip

@brightredchilli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 9, 2019

I still get the crash, unfortunately. I did in fact, sign my own copy of libfmodex and replaced it in the OF_ROOT folder. Its the AudioToolbox dependency that makes it crash for me.

But at the very least, I think replacing libfmodex with a signed copy is what we should do. It could be my xcode version that is causing it, haven't tried with the latest beta.

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 9, 2019

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 9, 2019

Hi @brightredchilli I just tried both an audio example and a new project created with the project generator with 0.10.1 and Xcode 11.0 beta 5 ( on macOS 10.4.6 ) and I can't reproduce the crash with AudioToolbox.

Not sure if it might be fixed in macOS 10.4.6 or maybe a newer version of Xcode beta.

I am using the New build System in File->ProjectSettings in Xcode.

Ahh - it looks like an Xcode / SDK bug - https://stackoverflow.com/questions/56455562/xcode-11-beta-simulator-crashes-when-trying-to-load-audiotoolbox

Thats why its probably working fine for me.
Try beta 5 and see if that fixes it.

@brightredchilli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

yes, forgot to mention but compilation does work with the signed lib! Crash with AudioToolbox is a runtime one. I'll definitely check out the latest beta!

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 12, 2019

Thanks @brightredchilli !!
Cool, I think we have a couple paths forward for the dylib issue.

I think we can push the signed one up for now, so people can easily work with master, but I think probably we can also find a way to mimic Xcode's sign for development which doesn't require the creation of a certificate as a pre-build step.

Going to keep this issue open until we have a fix in master.

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2019

Okay so there should be a signed fmodex.dylib now that will get pulled in the next time packages are built.

Going forward it might be good to update our Xcode template ( and Project Generator code ) to have the fmodex.dylib copied as part of the build phase and not through the run script command.

In Xcode 11 ( and I think earlier Xcode versions ) there is an option to Code Sign on Copy which is already checked and will mean the user will automatically code sign in the same way the rest of the app is signed.

Will dig in more to this though.

Screen Shot 2019-08-15 at 10 21 08 AM

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2019

Going to close this for now - its fixed in the nightly builds.
Will take a look though at better ways to handle dylibs in the PG.

Thanks again for helping debug this! :)

@ofTheo ofTheo closed this Aug 20, 2019

@cerupcat

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2019

Let me know if I should open a separate issue or not @ofTheo, but when submitting to the appstore, I'm getting:

"ERROR ITMS-90240: "Unsupported Architectures. Your executable contained the following disallowed architectures: '[i386 (in <app name>.pkg/Payload/<App name>.app/Contents/Frameworks/libfmodex.dylib)]'. New apps submitted to the Mac App Store must support 64-bit starting January 2018, and Mac app updates and existing apps must support 64-bit starting June 2018."

Edit: Followed the directions here and added a build phase to remove unsupported architectures and looks like things are good now. https://stackoverflow.com/questions/30547283/submit-to-app-store-issues-unsupported-architecture-x86

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2019

@cerupcat thanks for this!
Could you open a separate issue? Sounds like we'll need to add that stripping to the AppStore build target.

Thanks!
Theo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.