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 ...
随机推荐
- 简述traceroute命令的原理
原理 traceroute命令是一种用于显示数据包从源主机到目的主机经过的路由器和网络设备的路径的工具.traceroute命令的原理是利用IP数据报的生存时间(TTL)字段和因特网控制报文协议(IC ...
- MyBatis-Plus通用Iservice 方法详解
public interface IService<T> { /** * 默认批次提交数量 */ int DEFAULT_BATCH_SIZE = 1000; /** * 插入一条记录(选 ...
- 通过命令上传到GitHub
从零开始命令行上传代码到GitHub 前情概要: 要提交代码到GitHub上,本来想要通过idea上传代码,然后去网上搜索了相关的文章,按照步骤一步一步的操作,结果还是没有弄好,也会出现各种各样的 ...
- ubuntu docker pull 失败 Error response from daemon: Get https://registry-1.docker.io/v2/
问题: ubuntu@VM-3-4-ubuntu:~$ docker pull tensorflow/tensorflow:2.3.4-gpuError response from daemon: G ...
- js开发环境如何解决跨域问题
问题 npm start之后,自己会启动一个端口,比如3000,调用后端服务(比如localhsot:3006/service/list)就会出现跨域,那怎么弄呢? 方式一: webpack设置pro ...
- python读取图片相关属性
背景:工作中用到一些基础的图片处理的任务,比如获取图片宽高.获取图片的旋转角度等等图片属性,都是比较零散的,这里简单做个记录备忘 这里用到的库exifread,安装 pip isntall exifr ...
- Iperf参数详解
IperfIperf是一个网络性能测试工具,可以测试TCP和UDP最大带宽,具有多种参数和UDP特性,可以根据需要调整,报告带宽,延迟,数据包丢失 通用参数-b(bandwidth):指定UDP模式使 ...
- dart 学习笔记
1.dart 下载安装,vscode 安装dart ,coderunner等 2.dart语法 1)需要入口函数main,或者void(没有返回值) main 2)定义变量 var str='kkk' ...
- cuda、cudnn、tnesorrt的查看安装
1.首先本地查看cuda已安装的版本 11.7输入命令:[nvcc -V]输出:nvcc: NVIDIA (R) Cuda compiler driverCopyright (c) 2005-2022 ...
- IO流(1)
IO流(1) 目录 IO流(1) 文件 创建文件 获取文件信息 目录的操作和文件删除 文件 文件流 文件在程序中以流的形式来操作 输入流:数据从数据源(文件)到程序(内存)的路径 输出流:数据从程序( ...