Home » Android » Jenkins Android build fails – can't build libwebviewchromium.so

Jenkins Android build fails – can't build libwebviewchromium.so

Posted by: admin June 15, 2020 Leave a comment

Questions:

A bit of advice or idea is needed.

I am trying to build Android 5.1.1 Lollipop with Jenkins. But it fails to build libwebviewchromium.so:

...
out/target/product/generic/obj/GYP/shared_intermediates/blink/bindings/core/v8/V8SVGNumber.cpp:55: error: undefined reference to 'blink::SVGNumberTearOff::setValue(float, blink::ExceptionState&)'
out/target/product/generic/obj/STATIC_LIBRARIES/third_party_WebKit_Source_core_webcore_generated_gyp_intermediates/SVGElementFactory.cpp:383: error: undefined reference to 'blink::SVGMetadataElement::create(blink::Document&)'
external/chromium_org/third_party/WebKit/Source/core/svg/SVGNumberTearOff.h:45: error: undefined reference to 'blink::SVGNumberTearOff::SVGNumberTearOff(WTF::PassRefPtr<blink::SVGNumber>, blink::SVGElement*, blink::PropertyIsAnimValType, blink::QualifiedName const&)'
collect2: error: ld returned 1 exit status
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so] Error 1

At the same time, when I try to build it manually, it succeeds:

. build/envsetup.sh
set_stuff_for_environment
lunch zh2_qemu_eng
make clean
make -j24

I wonder how it comes that the same operation can be successful when using a console and fail when using Jenkins. Could you please share your ideas with me?

P.S. The build machine has 24GB of RAM and 15GB swap file, and a 512 GB SSD flash disk (62% available). The OS is Ubuntu 14.04LTS, 64 bit.

$ free -m
             total       used       free     shared    buffers     cached
Mem:         24021      22079       1942         75       4778       8768
-/+ buffers/cache:       8532      15488
Swap:        16036        345      15691
How to&Answers:

I wonder how it comes that the same operation can be successful when using a console and fail when using Jenkins.

Because Jenkins might not run with the same user (or on the same workstation, if the agent executing the job is a separate machine)

Double-check if there are any environment variable differences between:

For instance, a LD_LIBRARY_PATH difference could explain the discrepancy between the two builds.

Answer:

Make sure you have all the header files included and libraries linked at the time of compilation. Undefined Reference errors primarily arise due to these two reasons.

Answer:

user jenkins has it’s own ~/.bashrc, which might lack environmental variables.

temporarily enable login shell for jenkins, setup the environment, then disable it again.

when being able to manually build as user jenkins, it should also build when automated.

Answer:

The problem is solved.
We copied the Jenkins/AOSP setup from another server, and something was wrong with the copy.
The cleanup of the ccache solved the problem. After performing “ccache -c” command, everything worked fine.