New issue
Advanced search Search tips

Issue 804065 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

chromium cross build failed for aarch64

Reported by billco...@gmail.com, Jan 20 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0

Steps to reproduce the problem:
1. follow this https://chromium.googlesource.com/chromium/src/+/lkcr/docs/linux_chromium_arm.md (synced latest code)
2. set aarch64 by letting target_cpu = "arm64"
3. ninja -C out/Default chrome

What is the expected behavior?
the code should build

What went wrong?
code failed to build with the following linking error:

$:~/chromium/src$ ninja -C out/Arm64_Default/ chrome
ninja: Entering directory `out/Arm64_Default/'
[0/1] LINK ./chrome
[1/1] LINK ./chrome
FAILED: chrome 
python "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -pie -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed --target=aarch64-linux-gnu -Werror -Wl,--fatal-warnings -nostdlib++ --sysroot=../../build/linux/debian_stretch_arm64-sysroot -L../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN/. -Wl,-rpath-link=. -Wl,--export-dynamic -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -o "./chrome" -Wl,--start-group @"./chrome.rsp" ./libembedder.so ./libc++.so ./libbase.so ./libui_base.so ./libui_data_pack.so ./libskia.so ./libgfx.so ./libcolor_space.so ./libgeometry_skia.so ./libgfx_switches.so ./libgeometry.so ./libicui18n.so ./libicuuc.so ./libanimation.so ./libcodec.so ./librange.so ./libevents_base.so ./libplatform.so ./libkeycodes_x11.so ./libui_base_x.so ./libbindings.so ./libmessage_support.so ./libmojo_public_system_cpp.so ./libmojo_public_system.so ./libmojo_base_mojom_shared.so ./libmojo_base_mojom.so ./libmojo_base_lib.so ./libmojo_base_shared_typemap_traits.so ./libbase_i18n.so ./libipc.so ./libipc_mojom.so ./libipc_mojom_shared.so ./libprotobuf_lite.so ./liburl.so ./libnet.so ./libcrcrypto.so ./libboringssl.so ./libcontent_public_common_mojo_bindings_shared.so ./libblink_mojo_bindings_shared.so ./libblink_android_mojo_bindings_shared.so ./libservice_manager_mojom_shared.so ./libservice_manager_mojom_constants_shared.so ./libmojo_platform_bindings_shared.so ./libcontent.so ./libcc.so ./libcc_base.so ./libcc_paint.so ./libcc_debug.so ./libviz_common.so ./libviz_resource_format.so ./libgpu.so ./libcrash_key.so ./libgfx_ipc.so ./libgfx_ipc_geometry.so ./libmojo_common_lib.so ./libservice_manager_mojom.so ./libservice_manager_mojom_constants.so ./libservice_manager_cpp_types.so ./libmedia.so ./libshared_memory_support.so ./libleveldatabase.so ./libmetrics_cpp.so ./libwtf.so ./libsandbox_services.so ./libsuid_sandbox_client.so ./libseccomp_bpf.so ./libmojo_base_mojom_blink.so ./libservice_manager_cpp.so ./libblink_common.so ./libmojo_bindings_shared.so ./liburl_ipc.so ./libcontent_common_mojo_bindings_shared.so ./libgfx_ipc_color.so ./libgfx_ipc_skia.so ./libevents.so ./libui_base_ime.so ./libdisplay.so ./libdisplay_types.so ./libcc_ipc.so ./libaccessibility.so ./libaura.so ./libcompositor.so ./libsurface.so ./libsandbox.so ./libembedder_switches.so ./libmojo_system_impl.so ./libresource_coordinator_cpp.so ./libresource_coordinator_public_interfaces_internal_shared.so ./libstorage_common.so ./libstorage_browser.so ./libprefs.so ./libkeyed_service_core.so ./libdbus.so ./libwebdata_common.so ./libsql.so ./libcloud_policy_proto_generated_compile.so ./libpolicy_component.so ./libpolicy_proto.so ./libcommon.so ./libnetwork_session_configurator.so ./libchromium_sqlite3.so ./libnative_theme.so ./libgl_wrapper.so ./libcpp.so ./libppapi_shared.so ./liburl_matcher.so ./libbluetooth.so ./libdevice_event_log.so ./libdevice_base.so ./libkeyboard_with_content.so ./libprinting.so ./libkeyed_service_content.so ./libsessions.so ./libshell_dialogs.so ./libonc.so ./libuser_prefs.so ./libviews.so ./libgcm.so ./libdomain_reliability.so ./libui_touch_selection.so ./libproxy_config.so ./libmanager.so ./libmessage_center.so ./libfontconfig.so ./libx11_events_platform.so ./libdevices.so ./libevents_devices_x11.so ./libevents_x.so ./libgfx_x11.so ./libkeyboard.so ./libwebview.so ./libstartup_tracing.so ./libui_devtools.so ./libuser_manager.so ./libgesture_detection.so ./libsnapshot.so ./libweb_dialogs.so ./libgtk3ui.so ./libbrowser_ui_views.so ./libwm.so ./libui_views_mus_lib.so ./libgles2.so ./libgles2_implementation.so ./libwm_public.so ./libppapi_proxy.so ./libcaptive_portal.so ./libgeolocation.so ./libmidi.so ./libmedia_mojo_services.so ./libmedia_gpu.so ./libdevice_features.so ./libppapi_host.so ./libgin.so ./libv8.so ./libblink_controller.so ./libblink_core.so ./libgles2_c_lib.so ./libblink_platform.so ./libcc_animation.so ./libservice_manager_mojom_blink.so ./libservice_manager_mojom_constants_blink.so ./libblink_core_mojo_bindings_shared.so ./libblink_modules.so ./libcapture_lib.so ./libcapture_base.so ./libnet_with_v8.so ./libdiscardable_memory_client.so ./libfreetype_harfbuzz.so ./libv8_libplatform.so ./libheadless.so -Wl,--end-group   -ldl -lpthread -lrt -lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes -lXi -lXrender -lXtst -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -lcups -ldbus-1 -lexpat -lgio-2.0 -lm 
/usr/bin/aarch64-linux-gnu-ld: obj/chrome/browser/libbrowser.a(native_desktop_media_list.o): undefined reference to symbol '_ZN2ui35GrabWindowSnapshotAndScaleAsyncAuraEPN4aura6WindowERKN3gfx4RectERKNS3_4SizeERKN4base17RepeatingCallbackIFvNS3_5ImageEEEE'
./libsnapshot.so: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm not the only one who saw this, I searched and found

https://archlinuxarm.org/forum/viewtopic.php?t=11111&p=54229

the above post owner seemed to build it on a arm64 machine, whereas I cross built chromium from a ubuntu 14.04 system.

Judging by the above post, I need to add libsnapshot.so to clang commandline, but I'm not familiar with ninja, I don't know which file to change.

Did this work before? N/A 

Chrome version: <Copy from: 'about:version'>  Channel: dev
OS Version: ubuntu 16
Flash Version:
 

Comment 1 by billco...@gmail.com, Jan 23 2018

the bug seems to be due to the missing definition of SNAPSHOT_IMPLEMENTATION in snapshot_export.h
Cc: thomasanderson@chromium.org p...@chromium.org
Status: Available (was: Unconfirmed)
I can't even get to linking chrome.  +pcc is "R_AARCH64_ABS64 used with TLS symbol" a bug?

thomasanderson@thomasanderson:~/dev/chromium_official/src$ ninja -C out/arm64 -j1024 chrome -k10000
ninja: Entering directory `out/arm64'
[1/6252] SOLINK ./libprotobuf_lite.so
FAILED: libprotobuf_lite.so libprotobuf_lite.so.TOC 
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="aarch64-linux-gnu-readelf" --nm="aarch64-linux-gnu-nm" --sofile="./libprotobuf_lite.so" --tocfile="./libprotobuf_lite.so.TOC" --output="./libprotobuf_lite.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 --target=aarch64-linux-gnu -Wl,--fatal-warnings -nostdlib++ --sysroot=../../build/linux/debian_stretch_arm64-sysroot -L../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Werror -o "./libprotobuf_lite.so" -Wl,-soname="libprotobuf_lite.so" @"./libprotobuf_lite.so.rsp"
/usr/bin/aarch64-linux-gnu-ld: obj/third_party/protobuf/protobuf_lite/arena.o(.debug_info+0x15cd): R_AARCH64_ABS64 used with TLS symbol _ZZN6google8protobuf5Arena12thread_cacheEvE13thread_cache_
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[2/6252] SOLINK ./libGLESv2.so
FAILED: libGLESv2.so libGLESv2.so.TOC 
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="aarch64-linux-gnu-readelf" --nm="aarch64-linux-gnu-nm" --sofile="./libGLESv2.so" --tocfile="./libGLESv2.so.TOC" --output="./libGLESv2.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 --target=aarch64-linux-gnu -Werror -Wl,--fatal-warnings -nostdlib++ --sysroot=../../build/linux/debian_stretch_arm64-sysroot -L../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -o "./libGLESv2.so" -Wl,-soname="libGLESv2.so" @"./libGLESv2.so.rsp"
/usr/bin/aarch64-linux-gnu-ld: obj/third_party/angle/src/vulkan_support/libvulkan_loader.a(loader.o)(.debug_info+0xba4d): R_AARCH64_ABS64 used with TLS symbol tls_instance
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[3/6252] SOLINK ./libv8.so
FAILED: libv8.so libv8.so.TOC 
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="aarch64-linux-gnu-readelf" --nm="aarch64-linux-gnu-nm" --sofile="./libv8.so" --tocfile="./libv8.so.TOC" --output="./libv8.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 --target=aarch64-linux-gnu -Werror -Wl,--fatal-warnings -nostdlib++ --sysroot=../../build/linux/debian_stretch_arm64-sysroot -L../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -Wl,-O1 -Wl,--gc-sections -o "./libv8.so" -Wl,-soname="libv8.so" @"./libv8.so.rsp"
/usr/bin/aarch64-linux-gnu-ld: obj/v8/v8_base/handler-shared.o(.debug_info+0x46): R_AARCH64_ABS64 used with TLS symbol _ZN2v88internal12trap_handler21g_thread_in_wasm_codeE
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: cannot make progress due to previous errors.
thomasanderson@thomasanderson:~/dev/chromium_official/src$ cat out/arm64/args.gn
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
target_cpu = "arm64"
use_goma = true
is_debug = true
is_component_build = true
use_bundled_fontconfig = false

Comment 3 by p...@chromium.org, Jan 24 2018

I think it is a bug in clang, but I'm not sure. I can provoke it like this:

$ cat foo.cc
__thread int i = 42;
$ ../../third_party/llvm-build/Release+Asserts/bin/clang++ --target=aarch64-linux-gnu  -g -c foo.cc 
$ /usr/bin/aarch64-linux-gnu-ld foo.o
/usr/bin/aarch64-linux-gnu-ld: warning: cannot find entry symbol _start; defaulting to 00000000004000e8
/usr/bin/aarch64-linux-gnu-ld: foo.o(.debug_info+0x2b): R_AARCH64_ABS64 used with TLS symbol i

Taking a closer look at the assembly output reveals that the reference to i in the debug info is part of the DW_AT_location attribute for i's DW_TAG_variable. If I look at gcc's output for the same target I cannot see any references to i at all in the debug info. My guess is that on aarch64 the location of i is represented in some other way (maybe via the symbol table?) but I'm not certain. If so, we would need to make clang stop emitting a DW_AT_location attributes for TLS variables when targeting aarch64.

Comment 4 by billco...@gmail.com, Jan 25 2018

I don't know what goma is, so I didn't set "use_goma = true".

but I set other args like you did

target_cpu = "arm64"
is_debug = true
is_component_build = true
use_bundled_fontconfig = false

the error I saw was still 

/usr/bin/aarch64-linux-gnu-ld: obj/chrome/browser/libbrowser.a(native_desktop_media_list.o): undefined reference to symbol '_ZN2ui35GrabWindowSnapshotAndScaleAsyncAuraEPN4aura6WindowERKN3gfx4RectERKNS3_4SizeERKN4base17RepeatingCallbackIFvNS3_5ImageEEEE'
./libsnapshot.so: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.



Components: Build

Sign in to add a comment