Building the xcode project doesn't create a Release folder

Having problems with building or using the JCEF Java binding? Ask your questions here.

Building the xcode project doesn't create a Release folder

Postby nala » Wed Feb 03, 2016 10:22 am

Hello
when build jcef for OSX, I following the instructions https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding. However the final step, packaging the the binaries, fails because building the project using Product>Build, doesn't produce the jcef_build/native/Release/jcef_app.app

If I copy jcef_build/native/Debug/jcef_app.app, into the Release folder, I get the binaries.
I add the jars in an Eclipse project, and set the JRE System Library > Native Library Location to point to {binaries_root}/bin/jcef_app.app/Contents/Java/
And I get the error:

Code: Select all
Exception in thread "main" java.lang.UnsatisfiedLinkError: {binaries_root}/bin/jcef_app.app/Contents/Java/libjcef.dylib: dlopen({binaries_root}/bin/jcef_app.app/Contents/Java/libjcef.dylib, 1): Library not loaded: @executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework
  Referenced from: {binaries_root}/bin/jcef_app.app/Contents/Java/libjcef.dylib
  Reason: image not found
  at java.lang.ClassLoader$NativeLibrary.load(Native Method)
  at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1855)
  at java.lang.Runtime.loadLibrary0(Runtime.java:870)
  at java.lang.System.loadLibrary(System.java:1122)
  at org.cef.CefApp.<init>:CefApp.java:156)
  at org.cef.CefApp.getInstance(CefApp.java:247)
  at org.cef.CefApp.getInstance(CefApp.java:224)
  at Main.main(Main.java:9)


Any ideas?
nala
Newbie
 
Posts: 9
Joined: Tue Feb 02, 2016 12:19 pm

Re: Building the xcode project doesn't create a Release fold

Postby magreenblatt » Wed Feb 03, 2016 11:42 am

What Xcode version are you using? Check Xcode documentation for how to create a Release build instead of a Debug build.

Does running jcef_app.app without additional changes work? If Eclipse is generating its own app bundle then the structure is likely wrong. Compare the contents of jcef_app.app to the contents of the bundle generated by Eclipse.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Building the xcode project doesn't create a Release fold

Postby nala » Wed Feb 03, 2016 1:16 pm

Hi,

Xcode 6.3.2. Anyway, I managed to get a Release build, but that didn't change the error.
I think the problem is @executable_path never gets replaced with its proper value, hence the path in the console is printed as is, and it can't be found. Is this something that can be set in the Xcode build?
nala
Newbie
 
Posts: 9
Joined: Tue Feb 02, 2016 12:19 pm

Re: Building the xcode project doesn't create a Release fold

Postby magreenblatt » Wed Feb 03, 2016 1:23 pm

Does running jcef_app.app without additional changes work? See https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath for details on @executable_path.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Building the xcode project doesn't create a Release fold

Postby nala » Thu Feb 04, 2016 9:43 am

See https://wincent.com/wiki/@executable_pa ... and_@rpath for details on @executable_path.

Thanks, I've seen this post already, but doesn't really help me. I also searched on how to manually set @executable_path value, but no luck.

Does running jcef_app.app without additional changes work?

Yes it works fine, but the problem is I believe in libjcef.dylib.
Using
Code: Select all
otool -L libjcef.dylib
I get:

Code: Select all
libjcef.dylib:
   /Users/XXXXXXX/Projects/xcode/java-cef/src/jcef_build/native/Release/libjcef.dylib (compatibility version 0.0.0, current version 0.0.0)
   @executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework (compatibility version 31366.9.222, current version 31366.9.222)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
   /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
   /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1265.21.0)
   /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM (compatibility version 1.0.0, current version 1.0.0)
   /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
   /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
   /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.16.0)
   /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)


The second path there has the @executable_path token. Which leads to the error from my previous post:
Code: Select all
Exception in thread "main" java.lang.UnsatisfiedLinkError: ...(some paths)...: @executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework


Are these links in the .dylib correct? Shouldn't @executable_path be replaced with the full path when running cmake or maybe the xcode build (I don't know at which stage this is done)? If the @executable_path doesn't get replaced with the correct value, java can't find the framework.

Am I doing something wrong here? Is it correct to use libjcef.dylib as the native library at all? If not, where should the native library be located and how is it named?
nala
Newbie
 
Posts: 9
Joined: Tue Feb 02, 2016 12:19 pm

Re: Building the xcode project doesn't create a Release fold

Postby magreenblatt » Thu Feb 04, 2016 10:30 am

@executable_path is interpreted by the linker at runtime. libjcef.dylib needs to be within the app bundle at the location shown in jcef_app.app.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Building the xcode project doesn't create a Release fold

Postby nala » Thu Feb 04, 2016 10:49 am

Ok, it is in the app bundle as created by the Xcode build.

But you mentioned:
If Eclipse is generating its own app bundle then the structure is likely wrong. Compare the contents of jcef_app.app to the contents of the bundle generated by Eclipse.


Eclipse is not generating its own app bundle. And I'm a bit confused here. I have a feeling I'm taking a completely wrong way with how I use the .jar-s.

Out of everywhere I've looked, I've only found two suggestions on how to incorporate JCEF in a Java application:
1. - Create a maven project
- - - maven-install the dependencies
2. - Create a regular java project
- - - add the external jars (the 6 .jar-s located at: jcef_app.app/Contents/Java/)
- - - set the java.library.path to "..../jcef_app.app/Contents/Java/"

I chose the second approach because I've never worked with maven, and that would give me a whole other set of problems.
And I've done exactly those steps in the seconds approach. Apparently I have also built the app properly (it runs on its own).

The problem with the linker persists.
Do you have some other recommended method on how to import jcef libraries (jars) into a java project and make them link to the framework so I can use it in a regular java application?
nala
Newbie
 
Posts: 9
Joined: Tue Feb 02, 2016 12:19 pm

Re: Building the xcode project doesn't create a Release fold

Postby magreenblatt » Thu Feb 04, 2016 12:14 pm

@executable_path is relative to the /executable/ that you're running. jcef_app runs the executable from jcef_app.app/Contents/MacOS/ inside the app bundle. If your executable is not at the same path in the app bundle that's likely your issue.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Building the xcode project doesn't create a Release fold

Postby nala » Fri Feb 05, 2016 3:49 am

Thanks, looked into it further.
This helped
http://stackoverflow.com/questions/25714450/os-x-dlopen-cant-find-framework-image-not-found

So I changed the "@executable_path" token with "@loader_path" using;
Code: Select all
install_name_tool -change "@executable_path/../....etc....." "@loader_path/../.....etc.."

and it loaded
nala
Newbie
 
Posts: 9
Joined: Tue Feb 02, 2016 12:19 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 24 guests