Yet Another ARM Build question

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Yet Another ARM Build question

Postby rando » Wed Apr 11, 2018 8:02 am

Hi guys

I've spent the last couple of days trying to cross compile CEF for ARM. The Endgame is to run CefPython on the Raspberry Pi. But at the moment I'm stuck getting CEF to build.

I tried to follow the Linux Step-by-Step guide from the CEF Wiki plus the the comments by Marshall Greenblatt from the Issue# 1990 - Linux: Add ARM build support in bold. I noticed that the Issue# 1990 dates back to September 2016 whereas the Wiki Page was last edited this year, perhaps there are some discrepancies now? Anyway, I'm pretty sure the build doesn't select the cross compiler

I'm on Ubuntu Linux 4.13.0-38-generic #43-Ubuntu SMP Wed Mar 14 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

So here goes

1. Create the following directories.
mkdir ~/code/automate
mkdir ~/code/chromium_git

2. Download and run "~/code/install-build-deps.sh"
cd ~/code
curl 'https://chromium.googlesource.com/chromium/src/+/master/build/install-build-deps.sh?format=TEXT' | base64 -d > install-build-deps.sh
chmod 755 install-build-deps.sh
sudo ./install-build-deps.sh [Question: shouldn't I specify --arm here?]

At this point the install script warns me about missing chromeOS fonts which I ignore :)

No missing packages, and the packages are up to date.


Installing Chrome OS fonts.
sudo: ./linux/install-chromeos-fonts.py: command not found
ERROR: The installation of the Chrome OS default fonts failed.
This is expected if your repo is installed on a remote file system.
It is recommended to install your repo on a local file system.
You can skip the installation of the Chrome OS default founts with


3. Install the "libgtkglext1-dev" package required by the cefclient sample application.
sudo apt-get install libgtkglext1-dev

4. Download "~/code/depot_tools" using Git.
cd ~/code
git clone https://chromium.googlesource.com/chrom ... _tools.git

5. Add the "~/code/depot_tools" directory to your PATH. Note the use of an absolute path here.
export PATH=/home/rando/code/depot_tools:$PATH

6. Download the "~/automate/automate-git.py" script.
cd ~/code/automate
wget https://bitbucket.org/chromiumembedded/ ... ate-git.py

7. Create the "~/code/chromium_git/update.sh" script with the following contents.
#!/bin/bash
export CEF_USE_GN=1
export GYP_DEFINES=target_arch=arm
export GN_DEFINES="is_official_build=true use_sysroot=true use_allocator=none symbol_level=1 arm_float_abi=hard"
python ../automate/automate-git.py --download-dir=/home/rando/code/chromium_git --depot-tools-dir=/home/rando/code/depot_tools --no-distrib --no-build --arm-build [Question: --no-build and --arm-build is, is that right?]

Give it executable permissions.

cd ~/code/chromium_git
chmod +x update.sh
./update.sh

8. Create the "~/code/chromium_git/chromium/src/cef/create.sh" script with the following contents.
#!/bin/bash
export CEF_USE_GN=1
export GYP_DEFINES=target_arch=arm
export GN_DEFINES="is_official_build=true use_sysroot=true use_allocator=none symbol_level=1 arm_float_abi=hard enable_vr=false"
./cef_create_projects.sh

Give it executable permissions.

cd ~/code/chromium_git/chromium/src/cef
chmod +x create.sh
./create.sh

It it seems to create an output directory for the wrong platform (x86 instead of arm) "gn gen out/Debug_GN_x86":
...
Generating CEF project files...
NOTE: Not generating arm configuration due to missing sysroot directory
________ running 'gn gen out/Debug_GN_x86' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7829 targets from 1480 files in 4002ms
________ running 'gn gen out/Release_GN_x86' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7829 targets from 1480 files in 3604ms
________ running 'gn gen out/Release_GN_x64' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7803 targets from 1482 files in 3507ms
________ running 'gn gen out/Debug_GN_x64' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7803 targets from 1482 files in 3502ms


That doesn't seem right to me.

9. If I continue to doing a Debug build of CEF/Chromium using Ninja
cd ~/code/chromium_git/chromium/src
ninja -C out/Debug_GN_x64 cef chrome_sandbox

At this point it would compile (for hours), yet fail to link complaining about missing crashpad symbols:

ninja: Entering directory `out/Debug_GN_x64/'
[7055/7059] SOLINK ./libcef.so
FAILED: libcef.so libcef.so.TOC
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libcef.so" --tocfile="./libcef.so.TOC" --output="./libcef.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -m64 -Werror -Wl,--gdb-index -nostdlib++ -Wl,--export-dynamic -o "./libcef.so" -Wl,-soname="libcef.so" @"./libcef.so.rsp"
/home/rando/code/chromium_git/chromium/src/out/Debug_GN_x64/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: crashpad::Annotation::kValueMaxSize
>>> referenced by string:896 (../../buildtools/third_party/libc++/trunk/include/string:896)
>>> crash_reporter_client.o:(CefCrashReporterClient::ReadCrashConfigFile()) in archive obj/cef/libcef_static.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.



But I presume that's another, unrelated problem further down the road. So ignore step 9 for now.
Right now I'm only interested in getting the build set up correctly to cross compile the project. Any other problems, I'll address later.

I'd be grateful for any inputs. I'm unfamiliar with Ninja buildtool and it's difficult for me to see what is awry.
Last edited by rando on Fri Apr 13, 2018 2:08 am, edited 3 times in total.
User avatar
rando
Newbie
 
Posts: 6
Joined: Wed Apr 11, 2018 6:18 am
Location: Europe

Re: Yet Another ARM Build question

Postby magreenblatt » Wed Apr 11, 2018 10:10 am

#2: You can specify --arm to install-build-deps but I'm not sure you need it with use_sysroot=true.

#8: The "NOTE: Not generating arm configuration due to missing sysroot directory" message suggests that the arm sysroot is not being downloaded. Do you have a "src/build/linux/debian_sid_arm-sysroot" directory? If not, try the manual sysroot download directions from issue #1990.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Yet Another ARM Build question

Postby rando » Wed Apr 11, 2018 2:43 pm

Hi Marshall,

thanks for the hints

magreenblatt wrote:#2: You can specify --arm to install-build-deps but I'm not sure you need it with use_sysroot=true.


I think you're right. I noticed that the install-build-deps script mentions 'including ARM cross toolchain'. So that seems to work.

magreenblatt wrote:#8: The "NOTE: Not generating arm configuration due to missing sysroot directory" message suggests that the arm sysroot is not being downloaded. Do you have a "src/build/linux/debian_sid_arm-sysroot" directory? If not, try the manual sysroot download directions from issue #1990.


That's right - I completely missed that message. I manually installed sysroot image:
$:~/code/chromium_git/chromium/src$ export CEF_USE_GN=1
$:~/code/chromium_git/chromium/src$ export GYP_DEFINES=target_arch=arm
$:~/code/chromium_git/chromium/src$ export GN_DEFINES="is_official_build=true use_sysroot=true use_allocator=none symbol_level=1 arm_float_abi=hard enable_vr=false"
$:~/code/chromium_git/chromium/src$ ./build/linux/sysroot_scripts/install-sysroot.py --arch=arm
Installing Debian Sid arm root image: /home/rando/code/chromium_git/chromium/src/build/linux/debian_sid_arm-sysroot
Downloading https://commondatastorage.googleapis.co ... oot.tar.xz
$:


I re-ran the create.sh script and it did generate ARM projects this time (besides x64 and x86 ones - dunno whether I need those. If they aren't necessary can I delete the output directories to save some disk space?):
Generating CEF project files...
________ running 'gn gen out/Release_GN_x86' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7829 targets from 1480 files in 4863ms
________ running 'gn gen out/Debug_GN_arm' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 9082 targets from 1468 files in 5578ms
________ running 'gn gen out/Debug_GN_x86' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7829 targets from 1480 files in 4173ms
________ running 'gn gen out/Debug_GN_x64' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7803 targets from 1482 files in 4177ms
________ running 'gn gen out/Release_GN_x64' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 7803 targets from 1482 files in 4442ms
Creating /home/rando/code/chromium_git/chromium/src/out/Release_GN_arm directory.
________ running 'gn gen out/Release_GN_arm' in '/home/rando/code/chromium_git/chromium/src'
Done. Made 9082 targets from 1468 files in 6231ms


Afterwards I continued with the original step 9:
cd code/chromium_git/chromium/src
ninja -C out/Release_GN_arm cef chrome_sandbox

And it started building. Nice!
I'll check back in once the build completes - fingers crossed.


Thanks again for your support!
Last edited by rando on Fri Apr 13, 2018 2:10 am, edited 2 times in total.
User avatar
rando
Newbie
 
Posts: 6
Joined: Wed Apr 11, 2018 6:18 am
Location: Europe

Re: Yet Another ARM Build question

Postby magreenblatt » Wed Apr 11, 2018 4:00 pm

rando wrote:If they aren't necessary can I delete the output directories to save some disk space?

You can delete them, but cef_create_projects.sh will recreate them the next time you run it. I've filed https://bitbucket.org/chromiumembedded/cef/issues/2423 for this.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Yet Another ARM Build question

Postby rando » Thu Apr 12, 2018 12:04 am

Alright, so here's the next issue. It couldn't find gtk when building cefclient

ninja -C out/Release_GN_arm cef chrome_sandbox
ninja: Entering directory `out/Release_GN_arm'
[16201/53879] ACTION //cef:make_pack_header_resources(//build/toolchain/linux:clang_arm)
File includes/include/cef_pack_resources.h updated.
[16204/53879] ACTION //cef:make_pack_header_strings(//build/toolchain/linux:clang_arm)
File includes/include/cef_pack_strings.h updated.
[53546/53879] CXX obj/cef/cefclient/cefclient_gtk.o
FAILED: obj/cef/cefclient/cefclient_gtk.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/cef/cefclient/cefclient_gtk.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DOFFICIAL_BUILD -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DCR_CLANG_REVISION=\"325667-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DWEBP_EXTERN=extern -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DTOOLKIT_VIEWS=1 -DEXPAT_RELATIVE_PATH -I../.. -Igen -I../../third_party/libwebp/src -I../../third_party/khronos -I../../gpu -I../../third_party/libyuv/include -I../../third_party/webrtc_overrides -I../../testing/gtest/include -I../../third_party/libyuv/include -I../../third_party/usrsctp/usrsctplib -I../../third_party/webrtc -I../../cef -Iincludes -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pipe -pthread -fcolor-diagnostics -no-canonical-prefixes --target=arm-linux-gnueabihf -march=armv7-a -mfloat-abi=hard -mtune=generic-armv7-a -mfpu=neon -mthumb -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -gdwarf-3 -g1 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -isystem/home/footlevelers/code/chromium_git/chromium/src/build/linux/debian_sid_arm-sysroot/usr/include/glib-2.0 -isystem/home/footlevelers/code/chromium_git/chromium/src/build/linux/debian_sid_arm-sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -std=gnu++14 -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_sid_arm-sysroot -fvisibility-inlines-hidden -c ../../cef/tests/cefclient/cefclient_gtk.cc -o obj/cef/cefclient/cefclient_gtk.o
../../cef/tests/cefclient/cefclient_gtk.cc:5:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
^~~~~~~~~~~
1 error generated.
[53550/53879] CXX obj/cef/cefclient/root_window_views.o
FAILED: obj/cef/cefclient/root_window_views.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/cef/cefclient/root_window_views.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DOFFICIAL_BUILD -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DCR_CLANG_REVISION=\"325667-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DWEBP_EXTERN=extern -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DTOOLKIT_VIEWS=1 -DEXPAT_RELATIVE_PATH -I../.. -Igen -I../../third_party/libwebp/src -I../../third_party/khronos -I../../gpu -I../../third_party/libyuv/include -I../../third_party/webrtc_overrides -I../../testing/gtest/include -I../../third_party/libyuv/include -I../../third_party/usrsctp/usrsctplib -I../../third_party/webrtc -I../../cef -Iincludes -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pipe -pthread -fcolor-diagnostics -no-canonical-prefixes --target=arm-linux-gnueabihf -march=armv7-a -mfloat-abi=hard -mtune=generic-armv7-a -mfpu=neon -mthumb -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -gdwarf-3 -g1 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -isystem/home/rando/code/chromium_git/chromium/src/build/linux/debian_sid_arm-sysroot/usr/include/glib-2.0 -isystem/home/rando/code/chromium_git/chromium/src/build/linux/debian_sid_arm-sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -std=gnu++14 -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_sid_arm-sysroot -fvisibility-inlines-hidden -c ../../cef/tests/cefclient/browser/root_window_views.cc -o obj/cef/cefclient/root_window_views.o
In file included from ../../cef/tests/cefclient/browser/root_window_views.cc:5:
In file included from ../../cef/tests/cefclient/browser/root_window_views.h:12:
In file included from ../../cef/tests/cefclient/browser/client_handler.h:16:
../../cef/tests/cefclient/browser/client_types.h:12:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
^~~~~~~~~~~
1 error generated.
[53555/53879] CXX obj/cef/libcef_static/browser_host_impl.o
ninja: build stopped: subcommand failed.



I checked the ARM-sysroot. It contains headers and libs for gtk-2 as well as gtk-3 in build/linux/debian_sid_arm-sysroot/usr/include/gtk-2.0 and build/linux/debian_sid_arm-sysroot/usr/include/gtk-3.0, respectively. That seems in order.
Looking at the compiler error message, you'll notice that neither of these paths are listed among the includes. So it's no wonder why it didn't work. How do I fix this? I suppose by either manually specifying additional includes (&libs), or adding a dependency to gtk somewhere in the build system...
Last edited by rando on Fri Apr 13, 2018 2:10 am, edited 2 times in total.
User avatar
rando
Newbie
 
Posts: 6
Joined: Wed Apr 11, 2018 6:18 am
Location: Europe

Re: Yet Another ARM Build question

Postby Czarek » Thu Apr 12, 2018 12:20 am

Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Yet Another ARM Build question

Postby magreenblatt » Thu Apr 12, 2018 11:21 am

rando wrote:It couldn't find gtk when building cefclient

Some GTK dependencies of cefclient don't exist in the sysroot, so you need to build the cefsimple target instead (this is described in issue #1990). After creating a binary distribution you can potentially build the cefclient target on the ARM device itself after installing all dependencies.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Yet Another ARM Build question

Postby rando » Thu Apr 12, 2018 1:33 pm

Ok, so I've ditched the "use_sysroot=true" setting. And I'm now building cefsimple: "ninja -C out/Debug_GN_arm cefsimple"

Just another 53685 objects to compile...
User avatar
rando
Newbie
 
Posts: 6
Joined: Wed Apr 11, 2018 6:18 am
Location: Europe

Re: Yet Another ARM Build question

Postby rando » Fri Apr 13, 2018 1:15 am

Thanks guys. I managed to successfully build cefsimple, cool!

What's the next step? In the Step-by-step guide, step 10 is about building the Linux suid sandbox, but in issue 1990 Marshall says you should run "make_distrib.sh --arm-build" to build an ARM distribution. So can I just do:
Code: Select all
cd /path/to/chromium/src/cef/tools
./make_distrib.sh --arm-build


and that's it?
User avatar
rando
Newbie
 
Posts: 6
Joined: Wed Apr 11, 2018 6:18 am
Location: Europe

Re: Yet Another ARM Build question

Postby magreenblatt » Fri Apr 13, 2018 11:27 am

Also specify `--allow-partial` if you didn't create both Debug and Release builds.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 74 guests

cron