Page 1 of 1

Compiling JCEF to 32 bit

PostPosted: Tue Feb 16, 2016 5:25 pm
by Madman101
I've been trying to compile JCEF dlls to 32 bit for the last couple of months (bothered to check again now) but there are build errors. Compiling to 64 bit works fine btw.

Using:
- Windows 7
- JCEF dev trunk
- cef_binary_3.2526.1366.g8617e7c_windows32

With cmake command:
Code: Select all
mkdir jcef_build && cd jcef_build
cmake -G "Visual Studio 12" ..


When opening the msvs project ALL BUILD and building solution with Win32 Release as target I always get the following errors:
Warning 1 warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library C:\Users\User\Desktop\jcef32\src\jcef_build\third_party\cef\win32\libcef_dll\cef_string16.obj libcef_dll_wrapper

Error 2 error LNK2019: unresolved external symbol __imp__JAWT_GetAWT@8 referenced in function "struct HWND__ * __cdecl GetHwndOfCanvas(class _jobject *,struct JNIEnv_ *)" (?GetHwndOfCanvas@@YAPAUHWND__@@PAV_jobject@@PAUJNIEnv_@@@Z) C:\Users\User\Desktop\jcef32\src\jcef_build\native\jni_util_win.obj jcef

Error 3 error LNK1120: 1 unresolved externals C:\Users\User\Desktop\jcef32\src\jcef_build\native\Release\jcef.dll jcef


How can I fix these errors myself (im not used with c++) or what can i do to get them fixed? Also can somebody verify if it's just me or the dev trunk?

Thanks in advance

Re: Compiling JCEF to 32 bit

PostPosted: Tue Feb 16, 2016 6:53 pm
by magreenblatt
The 64-bit build works for me. I have not tried a 32-bit build.

Re: Compiling JCEF to 32 bit

PostPosted: Wed Feb 17, 2016 4:36 am
by Madman101
Hi Marshall, the 64 bit build works for me too, only the 32 bit build gives me 2 errors in the jcef.dll, it's also the only file left for me to compile to 32 bit so I can alpha release my application and provide users both 32 & 64 bit installs. I tried the same thing a few months ago but the 32 bit build produced the exact same errors (couple of revisions between now and then). So there has to be something wrong in my MSVS settings or with the 32 bit build for windows.

Re: Compiling JCEF to 32 bit

PostPosted: Wed Feb 17, 2016 11:04 am
by magreenblatt
Try googling the missing symbol (JAWT_GetAWT). It seems a lot of people have had similar problems -- perhaps one of the results will suggest a workable solution for you.

Re: Compiling JCEF to 32 bit

PostPosted: Wed Feb 17, 2016 4:58 pm
by Madman101
I seem to have fixed the issue, after doing some googling I realised it was a problem with 32-64bit. The provided jawt.lib was a 64 bit version instead of a 32 bit.

So the solution:
Project > Properties > Linker > All Options > Additional Dependencies

and change
C:\Program Files\Java\jdk1.7.0_79\lib\jawt.lib
C:\Program Files\Java\jdk1.7.0_79\lib\jvm.lib


to
C:\Program Files (x86)\Java\jdk1.7.0_79\lib\jawt.lib
C:\Program Files (x86)\Java\jdk1.7.0_79\lib\jvm.lib

Re: Compiling JCEF to 32 bit

PostPosted: Wed Feb 17, 2016 6:06 pm
by magreenblatt
Perhaps the CMake configuration can be made smart enough to detect the Java install with the correct bitness when both versions are installed.

Re: Compiling JCEF to 32 bit

PostPosted: Thu Feb 18, 2016 3:33 am
by Madman101
That would be great. I guess there are more people like me who only use msvs to write a simple JNI wrapper and are not used to deal with its big amount of settings.

Re: Compiling JCEF to 32 bit

PostPosted: Thu Feb 18, 2016 9:56 am
by magreenblatt
Please add a bug in the JCEF issue tracker.

Re: Compiling JCEF to 32 bit

PostPosted: Sat Jul 24, 2021 9:07 am
by pradeep
Error 2 error LNK2019: unresolved external symbol __imp__JAWT_GetAWT@8 referenced in function "struct HWND__ * __cdecl GetHwndOfCanvas(class _jobject *,struct JNIEnv_ *)" (?GetHwndOfCanvas@@YAPAUHWND__@@PAV_jobject@@PAUJNIEnv_@@@Z) C:\Users\User\Desktop\jcef32\src\jcef_build\native\jni_util_win.obj jcef

I found this error, when I have installed JDK 64 bit and want to generate 32-bit JCEF binaries from Microsoft Visual studio.
I have done the below step, and successfully generated

First, install JDK 32 bit, it installed on like "C:\Program Files (x86)\Java\jdk1.8.0_291\bin"
Please set this java 32-bit path on environment variable on user and system "Path"
close visual studio and regenerate from starting according to instruction on https://bitbucket.org/chromiumembedded/ ... uilding.md
So that CMake generates files according to jdk 32 bit and Visual Studio can generate binaries.