Bug 12745

Summary: Webkit will not load a plugin that Safari can load (symbol missing _objc_msgSend_fpret)
Product: WebKit Reporter: Glenn Howes <grhowes>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Severity: Blocker CC: ddkilzer, mrowe
Priority: P2    
Version: 419.x   
Hardware: Mac   
OS: OS X 10.4   

Description Glenn Howes 2007-02-12 10:49:17 PST
I am the Mac guy for the ChemDraw (http://cambridgesoft.com) application and plugins. I am trying to debug our plugins using the nightly build. The problem is it will not even load. The load is failing on line 286 of WebNetscapePluginPackage.m :
        if (!CFBundleLoadExecutable(cfBundle)) 
and the following is printed from the console. 

**** begin console output ******
2007-02-12 13:26:04.438 Safari[423] CFLog (21): Error loading /Users/glenn/Library/Internet Plug-Ins/CS ChemDraw Pro.plugin/Contents/MacOS/CS ChemDraw Pro:  error code 4, error number 0 (Symbol not found: _objc_msgSend_fpret
  Referenced from: /Users/glenn/Library/Internet Plug-Ins/CS ChemDraw Pro.plugin/Contents/MacOS/CS ChemDraw Pro
  Expected in: /Users/glenn/WebKit/WebKit/WebKitBuild/Debug/WebKit.framework/Versions/A/WebKit
***** end console output *********

Our plugin uses elements of both Cocoa and Carbon. I doubt if our release plugins have this problem as we have massively changed their structure for this release.

If someone with authority to sign an NDA could get in touch with me, I could see about getting them enrolled in our beta cycle.
Comment 1 David Kilzer (:ddkilzer) 2007-02-12 11:18:11 PST
Per Comment #0, this is a regression.

Comment 2 David Kilzer (:ddkilzer) 2007-02-12 11:22:49 PST
I won't pretend to understand what _objc_msgSend_fpret does, but some more information about your build environment would be helpful.  For example:

What version of Xcode are you using?
Are you building on a PowerPC-based or Intel-based Mac?
Are you building a universal binary?
Which OS X SDK does your project use, e.g., MacOSX10.4u.sdk?

Comment 3 Glenn Howes 2007-02-12 12:42:49 PST
Answer to Questions: 
Version of XCode: 2.4.1
Built on Intel Mac
Building a Universal Binary
Cross Developed using the 10.4 Universal SDK
SDK path: /Developer/SDKs/MacOSX10.4u.sdk
Comment 5 Mark Rowe (bdash) 2007-02-12 20:40:37 PST
I get the feeling this is very similar to the issue mentioned in passing in bug 12612 comment 6.  The reason it doesn't work with nightly builds is that they linked in slightly different fashion than production builds.  WebKit is not built as an umbrella framework, which makes symbol lookup happen in a different fashion for symbols in dependent libraries.  In this case your plugin is expecting to find objc_msgSend_fpret (used for processing Objective-C message sends with floating-point results) in WebKit.  You can work around this temporarily by linking your plugin directly against /usr/lib/libobjc.dylib.  I'll prepare a patch to WebKit shortly, it would be great if you can test it and let me know if it resolves your issue.
Comment 6 Mark Rowe (bdash) 2007-02-12 20:58:20 PST
I landed a change to the linker configuration in r19594 that should address this issue.  Can you please test with a nightly build from on or after this revision to confirm that the fix has resolved the problem.
Comment 7 Glenn Howes 2007-02-13 08:52:35 PST
Yes, I did a build from source and our plugin now loads. I can now debug our plugin, which is what I wanted to do initially. 

Thank you for the amazingly fast turn around time. 
Comment 8 Glenn Howes 2007-02-13 09:46:50 PST
Safari now crashes when I try to quit the application with an EXC_BAD_ACCESS message in the debugger. The  call stack for the thread that crashed has only one member, tellingly it's "objc_msgSend"
Comment 9 Mark Rowe (bdash) 2007-02-13 15:20:04 PST
Glenn, it seems very unlikely that a crash like that would be due to the same issue.  If you can reproduce it easily it would be great if you could file a new bug report.
Comment 10 Glenn Howes 2007-02-13 15:44:01 PST
I've reported my crash on quit bug as 12767.