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 ...
随机推荐
- ABP微服务系列学习-对接前端界面
前面我们把后端的微服务架子基本搭建完成并成功启动了,现在我们可以对接前端界面了.这里我们直接用ABP模板里面的Angular的前端界面. 创建应用程序模板 使用ABPCli创建一个应用程序模板,前端选 ...
- Linux操作命令(三)1.more命令 2.less命令 3.head命令 4.tail命令
1.more 命令 分页显示文本文件的内容 more 命令,功能类似 cat ,cat 命令是将整个文件的内容从上到下显示在屏幕上. more 命令会一页一页的显示,方便使用者逐页阅读,而最基本的指令 ...
- Django views.py 增,删,改
from django import forms from django.shortcuts import render, redirect from app01 import models # Cr ...
- 字符类型(char)
字符类型(char) 基本介绍 字符类型可以表示`单个字符`,字符类型是char,char是两个字节(可以存放汉字),多个字符我们用字符串String(我们后面详细讲解String) 案例演示 //演 ...
- 【面试题】面试官:请你实现一个深拷贝,那如果是正则/set/函数怎么拷贝?
一.面试官灵魂三连问: 你知道哪些拷贝的方法? 让你实现一个深拷贝怎么实现? 那像正则.Set.Map.函数等如何拷贝? 二.浅拷贝方法 自己创建一个新对象,来接收你要重新复制或引用的对象值.如果对象 ...
- 复习第7点-7.SpringMVC 的响应方式
1.使用ServletAPI实现转发 /* 使用HttpServletRequest对象实现请求转发 */ @RequestMapping("/httpServletRequest" ...
- python中周日历与时间的相互转换
python中周日历与时间的相互转换 周日历(ISO国际标准)介绍 在线周日历(2022年) 基本介绍 在开发过程中,有些汇总咨询需要以周为单位统计,所以介绍下如何进行相互转换. 使用datetime ...
- 硬件IIC的重映射使用问题
目录 沁恒的蓝牙系列芯片,有映射硬件模块去其他引脚的功能,可以配置各芯片的功能引脚重映射寄存器(R16_PIN_ALTERNATE),或者使用函数GPIOPinRemap函数进行配置. 比如说想要配置 ...
- 若依gateway
1.若依后端gateway模块配置白名单 顾名思义,就是允许访问的地址.且无需登录就能访问.在ignore中设置whites,表示允许匿名访问. 2. SpringCloud Gateway网关配置( ...
- 071_salesforce 页面自动检索匹配显示设置
通常我们会有需求:在搜索框中输入关键词,点击后面搜索,相关数据会显示在输入框的下面供选择,如下图 First I am assuming that you already have Static Re ...