New issue
Advanced search Search tips

Issue 875892 link

Starred by 1 user

Issue metadata

Status: Closed
Owner: ----
Closed: Aug 22
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Mac
Pri: 3
Type: Bug



Sign in to add a comment

ld.lld error: undefined symbol when using MojoHandle and blink::MojoHandle in the same source file.

Project Member Reported by odejesush@chromium.org, Aug 20

Issue description

Chrome Version: 70.0.3529.0 (Developer Build) (64-bit)
OS: Linux, Mac, Windows, Android

I am getting the following error when building my change (https://chromium-review.googlesource.com/c/chromium/src/+/1162351).

FAILED: webkit_unit_tests
python "../../build/toolchain/gcc_link_wrapper.py" --output="./webkit_unit_tests" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -m64 -Werror -Wl,-O2 -Wl,--gc-sections -rdynamic -nostdlib++ --sysroot=../../build/linux/debian_sid_amd64-sysroot -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN/. -Wl,-rpath-link=. -o "./webkit_unit_tests" -Wl,--start-group @"./webkit_unit_tests.rsp" ./libblink_controller.so ./libbase.so ./libbase_i18n.so ./libicui18n.so ./libicuuc.so ./libfontconfig.so ./libbindings.so ./libbindings_base.so ./libmojo_public_system_cpp.so ./libmojo_public_system.so ./libmojo_cpp_platform.so ./libmessage_support.so ./libmojo_mojom_bindings.so ./libmojo_mojom_bindings_shared.so ./libwtf.so ./libpublic.so ./libinterfaces_shared.so ./libnet.so ./libprotobuf_lite.so ./libcrcrypto.so ./libboringssl.so ./liburl.so ./libcrash_key.so ./libprefs.so ./libcontent.so ./libcc.so ./libcc_base.so ./libcc_paint.so ./libcc_debug.so ./libskia.so ./libcolor_space.so ./libgeometry_skia.so ./libgeometry.so ./libviz_common.so ./libviz_resource_format_utils.so ./libgpu.so ./libgfx.so ./libgfx_switches.so ./libanimation.so ./libcodec.so ./librange.so ./libmojo_base_mojom_shared.so ./libmojo_base_mojom.so ./libmojo_base_lib.so ./libmojo_base_shared_typemap_traits.so ./libipc.so ./libipc_mojom.so ./libipc_mojom_shared.so ./libgfx_ipc.so ./libgfx_ipc_geometry.so ./liburl_ipc.so ./libservice_manager_mojom_shared.so ./libservice_manager_mojom_constants_shared.so
./libmedia.so ./libshared_memory_support.so ./libleveldatabase.so ./libservice_manager_mojom.so ./libservice_manager_mojom_constants.so ./libservice_manager_cpp_types.so ./libmetrics_cpp.so ./libservice_manager_cpp.so ./libgfx_ipc_color.so ./libevents.so ./libevents_base.so ./libplatform.so ./libkeycodes_x11.so ./libui_base_ime.so ./libblink_common.so ./libmojom_core_shared.so ./libmojom_platform_shared.so ./libusb_shared.so ./libnetwork_cpp_base.so ./libnetwork_cpp.so ./libcontent_common_mojo_bindings_shared.so ./libcontent_public_common_mojo_bindings_shared.so ./libblink_mojo_bindings_shared.so ./libblink_android_mojo_bindings_shared.so ./libui_base.so ./libui_data_pack.so ./libui_base_x.so ./libgfx_ipc_skia.so ./libdisplay.so ./libdisplay_types.so ./libcapture_base.so ./libaccessibility.so ./libaura.so ./libcompositor.so ./libsurface.so ./libnetwork_service.so ./libsandbox.so ./libembedder_switches.so ./libresource_coordinator_cpp.so ./libresource_coordinator_cpp_base.so ./libresource_coordinator_public_mojom.so ./libresource_coordinator_public_mojom_shared.so ./libmojo_core_embedder.so ./libembedder.so ./libstorage_common.so ./libtracing_cpp.so ./libtracing_mojom.so ./libtracing_mojom_shared.so ./libperfetto.so ./libstorage_browser.so ./libmedia_gpu.so ./libblink_core.so ./libblink_core_mojo_bindings_shared.so ./libmojo_base_mojom_blink.so ./libblink_platform.so ./libcc_animation.so ./libresource_coordinator_public_mojom_blink.so ./libservice_manager_mojom_blink.so ./libservice_manager_mojom_constants_blink.so ./libv8.so ./libnative_theme.so ./libgin.so ./libblink_modules.so ./libgles2.so ./libraster.so ./libgl_in_process_context.so ./libgpu_ipc_service.so ./libgl_wrapper.so ./libgl_init.so ./libgles2_implementation.so ./libfreetype_harfbuzz.so ./libx11_window.so ./libclient.so ./libservice.so ./libhost.so ./libcapture_lib.so ./libnet_with_v8.so ./libcatalog_lib.so ./libsandbox_services.so ./libsuid_sandbox_client.so ./libseccomp_bpf.so ./libmanager.so ./libdevices.so ./libgesture_detection.so ./libevents_devices_x11.so ./libgfx_x11.so ./libevents_x.so ./libppapi_host.so ./libppapi_proxy.so ./libppapi_shared.so ./libwm.so ./libmedia_devices_mojo_bindings_shared.so ./libc++.so -Wl,--end-group   -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -lXext -lX11 -lXcomposite -lXrender -lX11-xcb -lxcb -lXcursor -lXdamage -lXfixes -lXi -lXtst -lm -lexpat
ld.lld: error: undefined symbol: blink::MojoHandle::TakeHandle()
>>> referenced by v8_script_value_serializer_test.cc
>>>               obj/third_party/blink/renderer/controller/webkit_unit_tests_sources/v8_script_value_serializer_test.o:(blink::(anonymous namespace)::V8ScriptValueSerializerTest_RoundTripMojoHandle_Test::TestBody())

ld.lld: error: undefined symbol: blink::MojoHandle::TakeHandle()
>>> referenced by v8_script_value_serializer_test.cc
>>>               obj/third_party/blink/renderer/controller/webkit_unit_tests_sources/v8_script_value_serializer_test.o:(blink::(anonymous namespace)::V8ScriptValueSerializerTest_RoundTripMojoHandle_Test::TestBody())
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I added unit tests to //third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc to test my implementation of a transferable blink::MojoHandle object from //third_party/blink/renderer/core/mojo/mojo_handle.h. The test already contained a reference to MojoHandle from //mojo/public/c/system/types.h. My guess is that the linker step is failing because it is unable to easily determine which MojoHandle to use. However, if I run the build with use_lld = false, the build does finish successfully. Because of this, I'm not sure if this is a bug or not.
 
I tried specifying ::MojoHandle and blink::MojoHandle, and removing the references to ::MojoHandle, but the file still fails with the same error. The only way to get it to compile is by removing the line that uses blink::MojoHandle::TakeHandle().
Status: Closed (was: Untriaged)
It turns out that this was caused because the TakeHandle method of blink::MojoHandle was missing the CORE_EXPORT macro. I'll mark the bug as Closed.

Sign in to add a comment