Cocoa app with ffmpeg dylibs crashes on Mac OSX 10.5 (but not 10.6 or 10.7) - objective-c

I've built a Cocoa project in Xcode that integrates the ffmpeg dylibs. It runs fine on Mac OSX 10.6 and 10.7 but it crashes on 10.5. I'm compiling on 10.6. Any suggestions? Thanks!
Here's how I've compiled it:
./configure --disable-static --enable-shared --disable-outdev=sdl
--enable-runtime-cpudetect --disable-bzlib --disable-libfreetype --disable-libopenjpeg --enable-zlib --arch=x86_64 --sysroot=/Developer/SDKs/MacOSX10.6.sdk --extra-cflags="-isysroot /Developer/SDKs/MacOSX10.6.sdk -DMACOSX_DEPLOYMENT_TARGET=10.5
-mmacosx-version-min=10.5"
Here's the crash report:
Process: MyApp [27963]
Path: /Applications/MyApp.app/Contents/MacOS/MyApp
Identifier: com.mycompany.MyApp
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [66]
Interval Since Last Report: 123326 sec
Crashes Since Last Report: 2
Per-App Interval Since Last Report: 0 sec
Per-App Crashes Since Last Report: 2
Date/Time: 2011-11-06 15:29:51.154 -0500
OS Version: Mac OS X 10.5.8 (9L31a)
Report Version: 6
Anonymous UUID: D86EA304-DCDA-4855-9124-69FE8C5BDE1B
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread: 0
Dyld Error Message:
Library not loaded: #rpath/libavcodec.dylib
Referenced from: /Applications/MyApp.app/Contents/MacOS/../Frameworks/MyEngine.framework/Versions/A/MyEngine
Reason: no suitable image found. Did find:
/Applications/MyApp.app/Contents/Frameworks/MyEngine.framework/Versions/A/Libraries/libavcodec.dylib: unknown required load command 0x80000022

I believe the problem you're running into is that libavcodec isn't fully 64-bit compatible under 10.5. I'm not 100% certain of this though.
64-bit support wasn't fully fleshed out in 10.5 and so for most of my own 64-bit-native apps, I have to explicitly tell the O.S. to run the 32-bit versions of my binary when running under 10.5.
To do this, go into your Info.plist file and add in these flags:
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>i386</key>
<string>10.5.0</string>
<key>ppc</key>
<string>10.5.0</string>
<key>x86_64</key>
<string>10.6.0</string>
</dict>
This will ensure your app runs in 32-bit mode on Leopard machines and 64-bit mode (if appropriate) on your 10.6 & newer machines.

Binaries compiled on 10.6 don't work on earlier OS X versions because 10.6 adds new dyld load commands that are not supported (did not exist) in 10.5 and earlier.
Although you are trying to add -mmacosx-version-min=10.5 to the flags which is commendable, you did not add it to the linking step, so the linker will still produce a dyld for 10.6.
The above is the reason for the error, but you may further get into trouble for using 10.6 SDK - you should really use 10.5 SDK if you want to target Leopard. Using 10.6 SDK may work on 10.5 if no 10.6-specific features are used, but it will crash if they are used since the compiler won't warn about them at compile time as they are expected to exist.

Related

Is threre a version of uppaal for Apple Silicon

When I download the mac version of uppaal The jar file runs but produces an immediate index out of bounds exception. The most obvious reason for the problem is that my mac is apple silicon, not intel, but it could also be something else. I'm tunning Monterey (mac OS 12.6) and Jave 19.

Xcode 11 beta crashes when starting in Virtual machine

i have just downloaded Xcode 11 beta and installed in a vm environment. When trying to start a new playground or project, xcode quits with following error code. Any idea how to solve ?
Process: Xcode [426]
Path: /Applications/Xcode-beta.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 11.0 (14855.18)
Build Info: IDEFrameworks-14855018000000000~13
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [426]
User ID: 501
Date/Time: 2019-06-08 08:13:37.785 -0700
OS Version: Mac OS X 10.14.5 (18F132)
Report Version: 12
Anonymous UUID: CB32DBDA-4F6E-4212-F810-C52C80FFD0CD
Link to full error:
https://pastebin.com/fFhcadtZ
This should probably be a comment, not an answer, but I lack the reputation to do so. Here is the xcode developer who developed the minimap indicating that while the minimap indeed does require metal, xcode should not crash when metal is not available. Hopefully he implements a patch to fail gracefully in one of the next builds. As of right now, there is no workaround. The reply to the thread:
defaults write http://com.apple .dt.Xcode DVTTextShowMinimap -bool NO
does not prevent the crash, as mentioned there.
It is fixed in XCode 11 beta 2, available on developer.apple.com !!!
June 17 2019.
You don't need MacOS Catalina, only Mojave 10.14.4 and up (current is 10.14.5).
I used VMware on Windows to install Mojave and XCode beta 2.
I attempted the same with Parallels (with tools installed), and also observed a crash. I suspect the problem is with the virtualization software lacking support for Metal. Notice the stack trace on the main thread:
0 com.apple.dt.SourceEditor 0x0000000120ccb5cb specialized
static MinimapMetalLinesLayer.defaultDevice() + 491 1
com.apple.dt.SourceEditor 0x0000000120cc959c
MinimapMetalLinesLayer.init() + 284
The "Minimap" is a new feature in Xcode 11, it's a birds eye view of the source code in a column on the right (similar to Sublime text edit). Also notice the mention of Metal, Apple's graphics API. To test this theory, I opened Xcode 10 (in the same VM) and attempted to build one of Apple's examples. I got the following error, which seems to confirm my suspicion that Parallels is unable to support apps using Metal.
2019-06-09 09:15:17.875253-0400 HelloTriangle[652:7547] *** Assertion
failure in -[AAPLViewController viewDidLoad],
/Users/ZestyMeta/Downloads/UsingARenderPipelineToRenderPrimitives/Application/AAPLViewController.m:27
2019-06-09 09:15:17.875403-0400 HelloTriangle[652:7547] Failed to set
(contentViewController) user defined inspected property on (NSWindow):
Metal is not supported on this device
I haven't attempted installing macOS Catalina / Xcode 11 in VirtualBox, VMWare, et al. but unless they support Metal then this crash will happen there as well. If you're testing out Catalina (which is required for SwiftUI on macOS), unfortunately it seems the solution at this time is to install on a spare device or dual boot.

Debugging objc4 (532.2) on OS X 10.9

I'm trying to get objc4-532.2 to work on Mavericks.
(First of all, I tried to compile the latest version of objc4 (objc4-551.1).
This fails due os/lock_private.h is missing (objc-os.h). Maybe anyone knows how to solve this issue?)
Back to topic:
To successfully build objc4-532.2 I need to link against the frameworks which are based
on OS X 10.8.
So I configured the Xcode project to use OS X 10.8 SDKs for Base SDK and OS X Deployment Target.
This works, and I can compile and link a simple console based C program (Xcode template).
However when I try to link this program against Foundation and debug it, it miserably fails with the following error:
dyld: Symbol not found: _objc_debug_taggedpointer_mask Referenced from:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Expected in:
/Users/manu/Library/Developer/Xcode/DerivedData/objc-dtrsexfveobodwdnwlpknyyiekpe/Build/Products/Debug/libobjc.A.dylib
in
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
The symbol _objc_debug_taggedpointer_mask was first introduced in objc4-551.1 (latest runtime) and all 10.9 Frameworks needs to access this symbol (at least in debug mode).
Example:
$ cd /System/Library/Frameworks/Foundation.framework/Versions/C
$ grep objc_debug_taggedpointer_mask Foundation
Binary file Foundation matches
A Framework based on 10.8 doesn't contain such a symbol.
Since my project is configured to use 10.8 SDKs this error should not occur?!
So, what's the missing point?
Thanks!
I solved this problem: the symbol of objc_debug_taggedpointer_mask was imported into runtime after mac os x 10.9, so you need to add the new tags into the 532.2's code to make it compatible with os x 10.9's foundation and other frameworks.
Here is my working directory:
https://github.com/Jeswang/objc4-532.2
(First of all, I tried to compile the latest version of objc4
(objc4-551.1). This fails due os/lock_private.h is missing
(objc-os.h). Maybe anyone knows how to solve this issue?)
The best solution I could find is to manually scrape together the header files as described here:
http://www.mulle-kybernetik.com/weblog/2011/how_to_build_libobjc_for_os_x.html
The closest thing to os/lock_private.h that I have found is private/tsd_private.h from the libpthread project:
https://opensource.apple.com/source/libpthread/libpthread-105.40.1/private/tsd_private.h
Edit
I have also found this:
https://github.com/samdmarshall/OSXPrivateSDK

Could not launch Mac OS X 10.7 application archived with RestKit

I'm a newbie for RestKit and developing Mac OS X application.
I'm trying to develop Mac OS X application using the RestKit.
I can run the app on debug mode of Xcode.
But I could not run the app on production mode (It means archived application).
Launch the app, this error will be occurred.
TestRestKit cannot be opened because of a problem.
Check with the developer to make sure TestRestKit works with version of Mac OS X.
You may need to reinstall the application. Be sure to install any available updates for the application and Mac OS X.
Click Report to see more detailed information and send a report to Apple.
And I checked the system log, then I find these logs.
May 14 12:41:01 black-umbrella [0x0-0x26b26b].jp.co.test.TestRestKit[30585]: dyld: Library not loaded: #executable_path/../Frameworks/RestKit.framework/Versions/A/RestKit
May 14 12:41:01 black-umbrella [0x0-0x26b26b].jp.co.test.TestRestKit[30585]: Referenced from: /Users/tfmagician/Desktop/TestRestKit.app/Contents/MacOS/TestRestKit
May 14 12:41:01 black-umbrella [0x0-0x26b26b].jp.co.fuller.TestRestKit[30585]: Reason: image not found
May 14 12:41:02 black-umbrella com.apple.launchd.peruser.501[235] ([0x0-0x26b26b].jp.co.fuller.TestRestKit[30585]): Job appears to have crashed: Trace/BPT trap: 5
So I noticed the warning when the app is archiving.
Check dependencies
Warning: Installation Directory starts with #executable_path but Skip Install is disabled.
I was followed this documentation to install RestKit.
https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x
Xcode version is 4.3.2, and I'm using master branch of RestKit.
Please help me and I would be glad if I can get any idea about this problem.
In the target's Build Phases
Click Add Build Phase (bottom right), Add Copy Files and add this:

Compiling Apple's OpenGLCaptureToMovie sample under 10.6

I see that Apple's OpenGLScreenCapture sample was originally created in the days of 10.4, and now I'm having trouble compiling it under Snow Leopard 10.6 (Xcode 4). I've changed the build settings to my native architecture and 10.6 base SDK, but I get tons of errors like "Expected * before *". Is this some kind of problem with LLVM? What do I need to do to get this to compile in Snow Leopard?
Thanks.
Found the answer here. It will only run as 32-bit. Won't run as 64-bit.