CrossWalk切换到chromium58的编译方法
未經許可請勿轉載,轉載請先聯系我(hello@yeshen.org)取得授權
這里假設你已經按這篇文章實踐過了一次chromium編譯與支持H264編碼支持(即環境那些都是OK的)。
基本要求:
50G以上的空間
拉取代碼
export XWALK_OS_ANDROID=1 cd /path/to/crosswalk-checkout gclient config --name src/xwalk https://github.com/ks32/crosswalk.git@origin/ks_chromium_58Edit this newly-created .gclient file, and add the following to the bottom:
target_os = ['android'] gclient sync(看網速)
如果sync失敗,看看是不是缺少了依賴
sudo apt-get install bzip2安裝依賴
cd /path/to/crosswalk-checkout/src ./build/install-build-deps-android.sh編譯
cd /path/to/crosswalk-checkout/src gn args out/DefaultYou can add other settings after this statement, such as is_debug = false for a release build or target_cpu = “x64” to create a 64-bit IA build. By default, target_cpu is set to arm, which creates a 32-bit ARM build.
Once you have done this once, you can later call gn gen out/Default to just regenerate the ninja files based on your existing settings if you need to (most of the time, this will be done automatically for you when building).
See Chromium’s page about GN for more information, including other common settings.
import("//xwalk/build/android.gni") is_debug = false target_os = "android" enable_nacl = false symbol_level = 0 remove_webcore_debug_symbols = true target_cpu = "arm" use_aura=false use_ozone=false enable_plugins=false disable_bundled_extensions=true ffmpeg_branding = "Chrome" #disable to reduce size proprietary_codecs=true #disable to reduce size v8_use_snapshot=true enable_webrtc=true #disable to reduce size pdf_enable_v8=false multidex_in_release=true is_official_build=true v8_enable_i18n_support=false disable_ftp_support=true disable_libfuzzer=true enable_basic_print_dialog=false cd src ninja -j8 -C out/Default xwalk_core_library可選編譯目標有:
xwalk_core_library creates a directory called in YOUR-BUILD-DIR with an architecture-specific Crosswalk library for use when embedding Crosswalk in a project.
xwalk_runtime_lib_apk will generate a file called XWalkRuntimeLib.apk in YOUR-BUILD-DIR/apks containing Crosswalk’s runtime library (which can act as the runtime for applications built using Crosswalk’s shared mode). *
xwalk_app_template_apk creates a sample web app APK for testing. It is located in YOUR-BUID-DIR/apks/XWalkAppTemplate.apk
小結下
參考資料
玩~
2019/05/22 更新
如何打開debug模式
gn args out/Default # is_debug = true編譯出來的內核,在為webrtc上播放我們的H264視頻存在閃退問題,今天想看看日志,打開了debug開關,重新編譯。
然后報這個錯誤。
FAILED: libxwalkcore.cr.so libxwalkcore.cr.so.TOC lib.unstripped/libxwalkcore.cr.so python "/home/crosswalk/src/build/toolchain/gcc_solink_wrapper.py" --readelf="../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-readelf" --nm="../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm" --strip=../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --sofile="./lib.unstripped/libxwalkcore.cr.so" --tocfile="./libxwalkcore.cr.so.TOC" --output="./libxwalkcore.cr.so" -- ../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -shared -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -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 -Werror -nostdlib -Wl,--warn-shared-textrel --sysroot=../../third_party/android_tools/ndk/platforms/android-16/arch-arm -Wl,--version-script=/home/crosswalk/src/build/android/android_only_explicit_jni_exports.lst -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 "./lib.unstripped/libxwalkcore.cr.so" -Wl,-soname="libxwalkcore.cr.so" @"./libxwalkcore.cr.so.rsp" obj/xwalk/xwalk_runtime/xwalk_dev_tools_server.o:xwalk_dev_tools_server.cc:function xwalk::XWalkDevToolsServer::Stop(): error: undefined reference to 'content::DevToolsHttpHandler::~DevToolsHttpHandler()' obj/xwalk/xwalk_runtime/xwalk_dev_tools_server.o:xwalk_dev_tools_server.cc:function xwalk::XWalkDevToolsServer::~XWalkDevToolsServer(): error: undefined reference to 'content::DevToolsHttpHandler::~DevToolsHttpHandler()' obj/xwalk/xwalk_runtime/xwalk_dev_tools_server.o:xwalk_dev_tools_server.cc:function xwalk::XWalkDevToolsServer::Start(bool, bool): error: undefined reference to 'content::DevToolsHttpHandler::DevToolsHttpHandler(content::DevToolsManagerDelegate*, std::__ndk1::unique_ptr<content::DevToolsSocketFactory, std::__ndk1::default_delete<content::DevToolsSocketFactory> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, base::FilePath const&, base::FilePath const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)' obj/xwalk/xwalk_runtime/xwalk_dev_tools_server.o:xwalk_dev_tools_server.cc:function xwalk::XWalkDevToolsServer::Start(bool, bool): error: undefined reference to 'content::DevToolsHttpHandler::~DevToolsHttpHandler()' obj/xwalk/xwalk_runtime/remote_debugging_server.o:remote_debugging_server.cc:function xwalk::RemoteDebuggingServer::~RemoteDebuggingServer(): error: undefined reference to 'content::DevToolsHttpHandler::~DevToolsHttpHandler()' obj/xwalk/xwalk_runtime/remote_debugging_server.o:remote_debugging_server.cc:function xwalk::RemoteDebuggingServer::RemoteDebuggingServer(xwalk::XWalkBrowserContext*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&): error: undefined reference to 'content::DevToolsHttpHandler::DevToolsHttpHandler(content::DevToolsManagerDelegate*, std::__ndk1::unique_ptr<content::DevToolsSocketFactory, std::__ndk1::default_delete<content::DevToolsSocketFactory> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, base::FilePath const&, base::FilePath const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.這個錯誤看起來是一個庫提交在私有分支上然后被去掉了,可以修改下 xwalk/BUILD.gn 的 devtools_http_handler 把東西補回去,但是我查了一下chromium 58的代碼,發現沒有這個文件夾,應該是 tenta-browser 的私有庫。
相關的代碼其實在chromium 上是有的,看起來要改下 BUILD.gn 處理下引用關系。可以這樣改:
在這個文件(xwalk/BUILD.gn)中 的 if(!is_android){ 之上加下 devtools_http_handler的代碼便可。
source_set("xwalk_runtime"){sources=[.... # 333 modify by Yeshen"//content/browser/devtools/devtools_http_handler.h","//content/browser/devtools/devtools_http_handler.cc","//net/server/http_server.h","//net/server/http_server.cc","//net/server/http_connection.h","//net/server/http_connection.cc","//net/server/web_socket.h","//net/server/web_socket.cc","//net/server/web_socket_encoder.h","//net/server/web_socket_encoder.cc","//net/server/http_server_response_info.h","//net/server/http_server_response_info.cc","//net/server/http_server_request_info.h","//net/server/http_server_request_info.cc"# 347 modify by Yeshen]if(!is_android){...} }PS:這部分確實還有探索的空間,從目前研究原生為webrtc的思路來參考。可以做這樣的假設:
總結
以上是生活随笔為你收集整理的CrossWalk切换到chromium58的编译方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Golang go-huge-util
- 下一篇: MyEclipse 8.5 开发环境配置