Android NDK build vsomeip3
Build Boost for Android
https://github.com/moritz-wundke/Boost-for-Android
set the NDK_ROOT environment
export NDK_ROOT=~/Android/Sdk/ndk/23.1.7779620
if you have downloaded the boost_1_74_0.tar.bz2 already, then you have no need to download it again,
just comment the download_file
part in the build-android.sh
449 # Downalod and unzip boost in a temporal folder and
450 if [ ! -f $BOOST_TAR ]
451 then
452 echo "Downloading boost ${BOOST_VER1}.${BOOST_VER2}.${BOOST_VER3} please wait..."
453 prepare_download
454 download_file $BOOST_DOWNLOAD_LINK $PROGDIR/$BOOST_TAR
455 fi
the download_file function is implemented in the build-common.sh.
25 # Add common build methods
26 . "$SCRIPTDIR"/build-common.sh
please refer to build-common.sh to see the implementation of download_file ()
292 # Download a file with either 'curl', 'wget' or 'scp'
293 #
294 # $1: source URL (e.g. http://foo.com, ssh://blah, /some/path)
295 # $2: target file
296 download_file ()
297 {
298 # Is this HTTP, HTTPS or FTP ?
299 if pattern_match "^(http|https|ftp):.*" "$1"; then
300 if [ -n "$CMD_WGET" ] ; then
301 run $CMD_WGET -O $2 $1
302 elif [ -n "$CMD_CURL" ] ; then
303 run $CMD_CURL -L -o $2 $1
304 else
305 echo "Please install wget or curl on this machine"
306 exit 1
307 fi
308 return
309 fi
310
311 # Is this SSH ?
312 # Accept both ssh://<path> or <machine>:<path>
313 #
314 if pattern_match "^(ssh|[^:]+):.*" "$1"; then
315 if [ -n "$CMD_SCP" ] ; then
316 scp_src=`echo $1 | sed -e s%ssh://%%g`
317 run $CMD_SCP $scp_src $2
318 else
319 echo "Please install scp on this machine"
320 exit 1
321 fi
322 return
323 fi
324
325 # Is this a file copy ?
326 # Accept both file://<path> or /<path>
327 #
328 if pattern_match "^(file://|/).*" "$1"; then
329 cp_src=`echo $1 | sed -e s%^file://%%g`
330 run cp -f $cp_src $2
331 return
332 fi
333 }
run the build-android.sh, choose 1.74.0 or 1.76.0
./build-android.sh $(NDK_ROOT) --boost=1.76.0
the generated libraries:
~/build-android-space/Boost-for-Android-master/build/out/arm64-v8a
Build vsomeip
https://github.com/COVESA/vsomeip
set the CMAKEPATH environment
export CMAKEPATH=~/Android/Sdk/cmake/3.18.1/bin
set the ANDROID_NDK environment
export ANDROID_NDK=~/Android/Sdk/ndk/23.1.7779620
rename these libraries in the ~/build-android-space/Boost-for-Android-master/build/out/arm64-v8a/lib
mv libboost_filesystem-clang-mt-a64-1_76.a libboost_filesystem.a
mv libboost_system-clang-mt-a64-1_76.a libboost_system.a
mv libboost_thread-clang-mt-a64-1_76.a libboost_thread.a
use cmake
mkdir build && cd build
choose -DANDROID_STL=c++_shared or -DANDROID_STL=c++_static
$CMAKEPATH/cmake .. -DBoost_INCLUDE_DIR=~/build-android-space/Boost-for-Android-master/build/out/arm64-v8a/include/boost-1_76 \
-DBoost_LIBRARY_DIR=~/build-android-space/Boost-for-Android-master/build/out/arm64-v8a/lib \
-DCMAKE_SYSTEM_NAME=Android \
-DNDKPATH=~/Android/Sdk/ndk/23.1.7779620 \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=30 \
-DANDROID_PLATFORM=android-30 \
-DANDROID_STL=c++_shared \
-DCMAKE_BUILD_TYPE=${BUILDTYPE} \
-DANDROID_TOOLCHAIN=clang \
-DBOOST_ROOT=~/build-android-space/Boost-for-Android-master/build/out/arm64-v8a
After the cmake success, run make.
make
Check the Errors.
build-android-space/vsomeip-master/build$ make
Scanning dependencies of target vsomeip3
[ 1%] Building CXX object CMakeFiles/vsomeip3.dir/implementation/endpoints/src/client_endpoint_impl.cpp.o
[ 2%] Building CXX object CMakeFiles/vsomeip3.dir/implementation/endpoints/src/credentials.cpp.o
[ 3%] Building CXX object CMakeFiles/vsomeip3.dir/implementation/endpoints/src/endpoint_definition.cpp.o
[ 4%] Building CXX object CMakeFiles/vsomeip3.dir/implementation/endpoints/src/endpoint_impl.cpp.o
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/endpoints/src/endpoint_impl.cpp:8:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/ip/udp_ext.hpp:20:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/basic_datagram_socket_ext.hpp:21:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/basic_socket_ext.hpp:37:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_service_ext.hpp:35:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_service_base_ext.hpp:32:
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp:44:7: error: no matching constructor for initialization of 'boost::asio::detail::reactor_op_ext'
: reactor_op_ext(&reactive_socket_recvmsg_op_base_ext::do_perform, complete_func),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactor_op_ext.hpp:25:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class reactor_op_ext
^
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactor_op_ext.hpp:25:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactor_op_ext.hpp:32:5: note: candidate constructor not viable: requires 3 arguments, but 2 were provided
reactor_op_ext(const boost::system::error_code& success_ec,
^
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/endpoints/src/endpoint_impl.cpp:10:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/local/stream_protocol_ext.hpp:24:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/basic_socket_acceptor_ext.hpp:20:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/basic_socket_ext_local.hpp:37:
In file included from /home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_service_ext_local.hpp:33:
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_recvfrom_op_ext_local.hpp:40:7: error: no matching constructor for initialization of 'boost::asio::detail::reactor_op_ext_local'
: reactor_op_ext_local(&reactive_socket_recvfrom_op_base_ext_local::do_perform, complete_func),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactor_op_ext_local.hpp:25:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class reactor_op_ext_local
^
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactor_op_ext_local.hpp:25:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
/home/linxu/Workspace/build-android-space/vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactor_op_ext_local.hpp:33:5: note: candidate constructor not viable: requires 3 arguments, but 2 were provided
reactor_op_ext_local(const boost::system::error_code& success_ec,
^
2 errors generated.
make[2]: *** [CMakeFiles/vsomeip3.dir/build.make:121: CMakeFiles/vsomeip3.dir/implementation/endpoints/src/endpoint_impl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:210: CMakeFiles/vsomeip3.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
modify the code in order to fix the errors.
vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp:44:7: error: no matching constructor for initialization of 'boost::asio::detail::reactor_op_ext'
: reactor_op_ext(&reactive_socket_recvmsg_op_base_ext::do_perform, complete_func)
check the code implementation of the reactor_op_ext, then we can see the reactor_op_ext needs three parameters, but there are only two parameters provided, therefore correct it this way:
: reactor_op_ext(success_ec, &reactive_socket_recvmsg_op_base_ext::do_perform, complete_func),
and fix the error in vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_recvfrom_op_ext_local.hpp:40:7
vsomeip-master/implementation/helper/1.76/boost/asio/detail/reactive_socket_recvfrom_op_ext_local.hpp:40:7: error: no matching constructor for initialization of 'boost::asio::detail::reactor_op_ext_local'
: reactor_op_ext_local(&reactive_socket_recvfrom_op_base_ext_local::do_perform, complete_func)
then make again.
Scanning dependencies of target vsomeip3-sd
[ 62%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/configuration_option_impl.cpp.o
[ 63%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/deserializer.cpp.o
[ 64%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/entry_impl.cpp.o
[ 65%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/eventgroupentry_impl.cpp.o
[ 66%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/ip_option_impl.cpp.o
[ 67%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/ipv4_option_impl.cpp.o
[ 68%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/ipv6_option_impl.cpp.o
[ 70%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/load_balancing_option_impl.cpp.o
[ 71%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/message_element_impl.cpp.o
[ 72%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/message_impl.cpp.o
[ 73%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/option_impl.cpp.o
[ 74%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/protection_option_impl.cpp.o
[ 75%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/remote_subscription_ack.cpp.o
[ 77%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/request.cpp.o
[ 78%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/runtime_impl.cpp.o
[ 79%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/selective_option_impl.cpp.o
[ 80%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/service_discovery_impl.cpp.o
[ 81%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/serviceentry_impl.cpp.o
[ 82%] Building CXX object CMakeFiles/vsomeip3-sd.dir/implementation/service_discovery/src/subscription.cpp.o
[ 83%] Linking CXX shared library libvsomeip3-sd.so
[ 83%] Built target vsomeip3-sd
Scanning dependencies of target vsomeip3-e2e
[ 85%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/buffer/buffer.cpp.o
[ 86%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/crc/crc.cpp.o
[ 87%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp.o
[ 88%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp.o
[ 89%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp.o
[ 90%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp.o
[ 91%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp.o
[ 93%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile04/profile_04.cpp.o
[ 94%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp.o
[ 95%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp.o
[ 96%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp.o
[ 97%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp.o
[ 98%] Building CXX object CMakeFiles/vsomeip3-e2e.dir/implementation/e2e_protection/src/e2exf/config.cpp.o
[100%] Linking CXX shared library libvsomeip3-e2e.so
[100%] Built target vsomeip3-e2e
the generated shared libraries:
file *.so
libvsomeip3-cfg.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7a14aa107a2f62e8db6608123edd0421989217d2, with debug_info, not stripped
libvsomeip3-e2e.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2b678294813895ba281f4193a68eefbfc73f1bbc, with debug_info, not stripped
libvsomeip3-sd.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=876ba6d75447c1d2fff5ee397c378e716b6479d1, with debug_info, not stripped
libvsomeip3.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=4f780a50da6f90d07681d9e8b8193a1a632a63fe, with debug_info, not stripped
Extra
the libvsomeip3.so needs libc++_shared.so
readelf -d libvsomeip3.so |grep NEED
0x0000000000000001 (NEEDED) Shared library: [liblog.so]
0x0000000000000001 (NEEDED) Shared library: [libm.so]
0x0000000000000001 (NEEDED) Shared library: [libc++_shared.so]
0x0000000000000001 (NEEDED) Shared library: [libdl.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so]
0x000000006ffffffe (VERNEED) 0x1c810
if you buid with -DANDROID_STL=c++_static
readelf -d libvsomeip3.so |grep NEED
0x0000000000000001 (NEEDED) Shared library: [liblog.so]
0x0000000000000001 (NEEDED) Shared library: [libm.so]
0x0000000000000001 (NEEDED) Shared library: [libdl.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so]
0x000000006ffffffe (VERNEED) 0x286b0
0x000000006fffffff (VERNEEDNUM) 2
Android NDK build vsomeip3的更多相关文章
- 〖Linux〗Clang/Clang++ for Android Binary/NDK build(二进制可执行文件/NDK编译)
#1. 下载并安装NDK(解压即可,目前最新版是r9c) http://developer.android.com/tools/sdk/ndk/index.html #2. 安装NDK独立编译工具 c ...
- Android NDK debug 方法
最近又频繁遇到 NDK 的错误,记录一下debug调试的一些经验,以备后续查看 一般来说,在Android Studio中的Monitor中将过滤器的 LOG TAG 设置为 "DEBUG& ...
- 初识Android NDK
本文介绍Windows环境下搭建Android NDK开发环境,并创建一个简单的使用Native代码的Android Application. 一.环境搭建 二.JNI函数绑定 三.例子 一.环境搭建 ...
- Android NDK之JNI陷阱
背景: 最近一个月一直在做移植库的工作,将c代码到share library移植到Android平台.这就涉及到Android NDK(native develop kit)内容.这里只想记录下JNI ...
- Android NDK开发
Android NDK 开发教程(极客学院) 一.Android NDK环境搭建 使用最新ndk,直接抛弃cygwin,以前做Android的项目要用到NDK就必须要下载NDK,下载安装Cygwin( ...
- Eclipse+CDT+GDB调试android NDK程序(转)
Eclipse+CDT+gdb调试android ndk程序 先介绍一下开发环境,在这个环境下,up主保证是没有问题的. ubuntu 11.10 eclipse 3.7(indego) for ja ...
- android NDK入门 windows下安装cygwin
一.Android NDK环境简介 Android NDK 是运行于Android 平台上的Native Development Kit 的缩写. Android 应用开发者可以通过NDK 调用C 或 ...
- windows系统上安装与使用Android NDK r5 (转)
windows系统上安装与使用Android NDK r5 很早就听说了android的NDK应用,只是一直没有时间去研究,今天花了点时间在windows平台搭建了NDK环境,并成功运行了第一个简单 ...
- Android NDK开发入门实例
AndroidNDK是能使Android应用开发者把从c/c++编译而来的本地代码嵌入到应用包中的一系列工具的组合. 注意: AndroidNDK只能用于Android1.5及以上版本中. I. An ...
- [原]如何用Android NDK编译FFmpeg
我们知道在Ubuntu下直接编译FFmpeg是很简单的,主要是先执行./configure,接着执行make命令来编译,完了紧接着执行make install执行安装.那么如何使用Android的ND ...
随机推荐
- sql_server数据库
问题:如何在SQL SERVER中合并时间和日期? 解决方法1:使用+合并时间日期让我们运行以下命令:SELECT CAST(字段名 AS DATETIME) + CAST(字段名 AS DATETI ...
- 洛谷P2205 [USACO13JAN]Painting the Fence S
题目 https://www.luogu.com.cn/problem/P2205 思路 刷水题真解压 差分就完事了 值得注意的一些东西:像这种和数轴或者坐标相关的题,还有扫描线题,一定要注意区间的开 ...
- Mysql习题系列(三):单行函数
案例数据 提取码:2rd5 #[题目] # 1.显示系统时间(注:日期+时间) # 2.查询员工号,姓名,工资,以及工资提高百分之20%后的结果(new salary) # 3.将员工的姓名按首字母排 ...
- git 的提交与合并
1,创建远程仓库 不论是用命令行还是码云之类的都可以 2,git clone url 这是将远程仓库库提交到本地 3, git checkout -b dev 创建dev分支并切换到dev ...
- angular js 实现模糊查询并分页
如果这篇文章能给你带来帮助,不胜荣幸,如果有不对的地方也请批评指正 共同进步,因为最近使用augular前段所以看了一下,为了加深印象,所以记录一下,废话不多说直接上代码. 首先来讲你可以使用page ...
- 力扣(leetcode)题库0001-python3
试一下leetcode的题库,不知道对于我这种小白要多长时,但是目标已经种下,去做就是了.You can do anything you set your mind to. 题目:题库链接 中:给定一 ...
- 洛谷P8924题解
洛谷 P8924 题解 题目描述 给你一个函数,画出它的函数图像(* 表示经过该点,. 表示不经过该点),大小为 \(n\times m\),其中 \(x\) 的范围是 \([0,n-1]\),\(f ...
- nginx客户端真实IP配置
https://www.cnblogs.com/kevingrace/p/8269955.html include mime.types; default_type application/octet ...
- JavaScript 数字与字符串的加减乘除运算
点击跳转 Tips: 除开字符串 + 数字的运算,会产生级联,其他情况下会将 String 转为 number 再进行数字运算. js 运算是从左到右的,所以一步一步来,不要跳步进行运算.
- ElementUI Select下拉框定位问题!
今天遇到了下拉不跟随文本框滚动的问题 参考官方手册添加参数: popper-append-to-body="false" 无效[内心很无语]继续检查向上推,查看html样式,发现了 ...