cloudtrends / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
1 stars 1 forks source link

Mac: running cefclient from xcode doesn't work #199

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. On Mac open CEF project in XCode.
2. Try to "Build and Run" / Cmd+Enter or "Build and Debug" cefclient 
specifically.

What is the expected output? What do you see instead?
Build should succeed and cefclient should start and hit any breakpoints one 
sets inside, let's say, cefclient_mac.mm function main().
Actually build succeeds and can be run from command line, but running client 
within XCode produces following output in the Debugger Console:
===
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys003
Loading program into debugger…
sharedlibrary apply-load-rules all
run
Running…
No executable file specified.
Use the "file" or "exec-file" command.
No executable file specified.
Use the "file" or "exec-file" command.
The program being debugged is not being run.
===

What version of the product are you using? On what operating system?
- Mac OS X 10.6.6
- XCode 3.2.5
- CEF 198

Please provide any additional information below.
I have a feeling that at some point earlier I was able to run and debug client 
from the XCode, but now I tried pulling and rebuilding couple previous 
versions, up to CEF@153, didn't help. I guess there is an issue with 
environment or project settings, since running from command line is fine, but I 
don't see anything wrong at the glance:
- cefclient is selected as Active Executable
-Full Path and Build Products directory in cefclient's Info windows show 
correct path.

Any suggestions/fixes would be a great help for developing on Mac.
Thanks

Original issue reported on code.google.com by azasyp...@gmail.com on 4 Mar 2011 at 3:55

GoogleCodeExporter commented 9 years ago
After building cefclient do the following:

1. Exit XCode.
2. Open the cefclient application bundle.
3. Edit the included Info.plist file.
4. Change the CFBundleExecutable value from cefclient_mac_app.sh to cefclient.
5. Rename cefclient.app twice (this will cause the OS to pick up the Info.plist 
changes).
6. Open XCode -- you can now debug the project.

More information on application bundles is available here:
http://www.mactipsandtricks.com/articles/Wiley_HT_appBundles.lasso

The cefclient_mac_app.sh script is necessary for setting 
DYLD_FALLBACK_LIBRARY_PATH so that the application can be executed via the app 
bundle. I'm open to other ways of handling this so that both app bundle 
execution and debugging can work at the same time.

Original comment by magreenb...@gmail.com on 4 Mar 2011 at 4:12

GoogleCodeExporter commented 9 years ago
Hm... After reading these ( 
http://lessons.runrev.com/spaces/lessons/buckets/784/lessons/15029-Linking-an-OS
X-external-bundle-with-a-dylib-library and 
http://qin.laya.com/tech_coding_help/dylib_linking.html ) it seems the better 
way to do it would be by running post-build script for install_name_tool. 

I think chrome.gyp already has something for this, but I have not tried it 
myself.

Original comment by azasyp...@gmail.com on 4 Mar 2011 at 9:07

GoogleCodeExporter commented 9 years ago
Here is a patch that should solve this issue. I did not have time to do a 
completely clean build, but this will eliminate the cefclient_mac_app.sh script 
and allow you to run cefclient from the bundle, directly running the binary, 
and within Xcode seamlessly. The trick is to modify cef.gyp to set the install 
name of libcef.dylib to @executable_path/libcef.dylib. This instructs the 
dynamic loader to look in the executable's path for the lib, and is dynamic so 
moving the entire bundle still works. Could use a bit more testing to confirm 
everything. Without this, the dylib automatically sets the install name to the 
default location for a dylib (/usr/local/lib).

Patch created against tag 198 at src/cef.

Original comment by krun...@gmail.com on 9 Mar 2011 at 10:10

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I cleaned my source tree and left my Mac building last night and when I got 
back to it CEF was up and running in the debugger. :)

Then I thought rather than setting LD_DYLIB_INSTALL_NAME, you might be able to 
set INSTALL_PATH to '@executable_path' to override the default /usr/local/lib 
setting from gyp. I am testing that now to see if the name of the library is 
automatically and correctly set based on that path.

Original comment by krun...@gmail.com on 10 Mar 2011 at 2:45

GoogleCodeExporter commented 9 years ago
Yes it looks like INSTALL_PATH is a better choice. New patch attached.

Original comment by krun...@gmail.com on 10 Mar 2011 at 2:51

Attachments:

GoogleCodeExporter commented 9 years ago
Any feedback on setting INSTALL_PATH to @executable_path in the gyp file? I 
believe this fixes debugging cefclient while allowing the app to be run from 
the bundle or directly running the binary.

Original comment by krun...@gmail.com on 22 Mar 2011 at 6:46

GoogleCodeExporter commented 9 years ago
It works great, thanks. Committed as revision 204.

Original comment by magreenb...@gmail.com on 22 Mar 2011 at 11:00