Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

[Build Issue] undefined reference errors when building/linking crosswalk 23 for Android #4002

Closed
arshcaria opened this issue Jun 29, 2017 · 2 comments

Comments

@arshcaria
Copy link

I was building crosswalk 23 for Android following the guide provided in https://crosswalk-project.org/contribute/building_crosswalk/android_build.html.

The building for 3rd party sources were successful but when building/linking the xwalk source, it reported some undefined reference errors and failed.

The commands I used to build the source:
$ gn args out/Default
// then added import("//xwalk/build/android.gni") and target_os = "android" to the given file.
$ ninja -C out/Default xwalk

The build log is:

ninja: Entering directory `out/Default'
[1/1] LINK ./xwalk
FAILED: xwalk exe.unstripped/xwalk 
python "../../build/toolchain/gcc_link_wrapper.py" --strip="../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip" --unstripped-file="./exe.unstripped/xwalk" --output="./xwalk" -- ../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -fuse-ld=gold -Wl,--icf=all -Wl,--build-id=sha1 -Wl,--no-undefined -Wl,--exclude-libs=libgcc.a -Wl,--exclude-libs=libc++_static.a -Wl,--exclude-libs=libvpx_assembly_arm.a -Wl,--warn-shared-textrel -Wl,-O1 -Wl,--as-needed -nostdlib -Wl,--warn-shared-textrel --sysroot=../../third_party/android_tools/ndk/platforms/android-16/arch-arm  -Bdynamic -Wl,-z,nocopyreloc -pie -Wl,-wrap,calloc -Wl,-wrap,free -Wl,-wrap,malloc -Wl,-wrap,memalign -Wl,-wrap,posix_memalign -Wl,-wrap,pvalloc -Wl,-wrap,realloc -Wl,-wrap,valloc -L../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -o "./exe.unstripped/xwalk" -Wl,--start-group @"./xwalk.rsp"  -Wl,--end-group ../../third_party/android_tools/ndk/platforms/android-16/arch-arm/usr/lib/crtbegin_dynamic.o -lc++_static ../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/libgcc.a -lc -latomic -ldl -lm -llog -landroid -ljnigraphics -lGLESv2 ../../third_party/android_tools/ndk/platforms/android-16/arch-arm/usr/lib/crtend_android.o
../../xwalk/runtime/browser/android/xwalk_content.cc:202: error: undefined reference to 'navigation_interception::InterceptNavigationDelegate::InterceptNavigationDelegate(_JNIEnv*, _jobject*)'
../../xwalk/runtime/browser/android/xwalk_content.cc:202: error: undefined reference to 'navigation_interception::InterceptNavigationDelegate::Associate(content::WebContents*, std::__1::unique_ptr<navigation_interception::InterceptNavigationDelegate, std::__1::default_delete<navigation_interception::InterceptNavigationDelegate> >)'
../../xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc:43: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::~WebContentsDelegateAndroid()'
../../xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc:40: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::WebContentsDelegateAndroid(_JNIEnv*, _jobject*)'
../../xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc:56: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::GetJavaDelegate(_JNIEnv*) const'
../../xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc:80: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::GetJavaDelegate(_JNIEnv*) const'
../../xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc:89: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::GetJavaDelegate(_JNIEnv*) const'
../../xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc:100: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::GetJavaDelegate(_JNIEnv*) const'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::OpenURLFromTab(content::WebContents*, content::OpenURLParams const&)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::NavigationStateChanged(content::WebContents*, content::InvalidateTypes)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::VisibleSSLStateChanged(content::WebContents const*)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::LoadingStateChanged(content::WebContents*, bool)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::LoadProgressChanged(content::WebContents*, double)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::MoveContents(content::WebContents*, gfx::Rect const&)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::UpdateTargetURL(content::WebContents*, GURL const&)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::TakeFocus(content::WebContents*, bool)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::ShowRepostFormWarningDialog(content::WebContents*)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::OnGoToEntryOffset(int)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::WebContentsCreated(content::WebContents*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, GURL const&, content::WebContents*)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::OpenColorChooser(content::WebContents*, unsigned int, std::__1::vector<content::ColorSuggestion, std::__1::allocator<content::ColorSuggestion> > const&)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::ShowValidationMessage(content::WebContents*, gfx::Rect const&, std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::HideValidationMessage(content::WebContents*)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::MoveValidationMessage(content::WebContents*, gfx::Rect const&)'
obj/xwalk/xwalk_runtime/xwalk_web_contents_delegate.o:xwalk_web_contents_delegate.cc:vtable for xwalk::XWalkWebContentsDelegate: error: undefined reference to 'web_contents_delegate_android::WebContentsDelegateAndroid::RequestAppBannerFromDevTools(content::WebContents*)'
../../xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc:312: error: undefined reference to 'auto_login_parser::HeaderData::HeaderData()'
../../xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc:313: error: undefined reference to 'auto_login_parser::ParserHeaderInResponse(net::URLRequest*, auto_login_parser::RealmRestriction, auto_login_parser::HeaderData*)'
../../xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc:322: error: undefined reference to 'auto_login_parser::HeaderData::~HeaderData()'
../../xwalk/runtime/browser/xwalk_content_browser_client.cc:443: error: undefined reference to 'navigation_interception::InterceptNavigationDelegate::CreateThrottleFor(content::NavigationHandle*)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

The build environment is:
Ubuntu 16.04 64-bit with latest updates
Deps are installed by successfully running ./build/install-build-deps-android.sh

Any ideas on this? Thank you.

rakuco pushed a commit to rakuco/crosswalk-website that referenced this issue Jun 29, 2017
Do not hardcode "xwalk" like we do for other platforms, as the target names
in Android are different. Fixes crosswalk-project/crosswalk#4002.
@rakuco
Copy link
Contributor

rakuco commented Jun 29, 2017

$ ninja -C out/Default xwalk

Oops, this is a documentation issue, and crosswalk-project/crosswalk-website#354 should fix it. Basically, you need to use one of the target names listed below that part in the build docs.

@arshcaria
Copy link
Author

Thank you @rakuco
It worked after specifying the three build targets.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants