android.vsh⽂件是什么,在Android9下⽤ndk编译vSomeIP和
Comm。。。
使⽤Android NDK编译Boost:
$ cd Boost-for-Android/
修改成需要的版本:
$ vi build-android.sh
BOOST_VER2=70
$ export NDK_ROOT=/AndroidSDK/ndk-bundle
$ nohup ./build-android.sh /AndroidSDK/ndk-bundle &
⽣成位置:
$ ls build/out/arm64-v8a/*
include:
boost-1_70
lib:
cmake libboost_fiber-clang-mt-a64-1_70.a libboost_math_tr1-clang-mt-a64-软件测试的评估标准
1_70.a libboost_stacktrace_noop-clang-mt-a64-1_70.a
libboost_atomic-clang-mt-a64-1_70.a libboost_filesystem-clang-mt-a64-1_70.a libboost_math_tr1f-clang-mt-a64-
1_70.a libboost_system-clang-mt-a64-1_70.a
libboost_chrono-clang-mt-a64-1_70.a libboost_graph-clang-mt-a64-1_70.a libboost_math_tr1l-clang-mt-a64-
1_70.a libboost_test_exec_monitor-clang-mt-a64-1_70.a
libboost_container-clang-mt-a64-1_70.a libboost_iostreams-clang-mt-a64-1_70.a libboost_prg_exe
c_monitor-clang-mt-a64-1_70.a libboost_thread-clang-mt-a64-1_70.a
libboost_context-clang-mt-a64-1_70.a libboost_log-clang-mt-a64-1_70.a libboost_program_options-clang-mt-a64-1_70.a libboost_timer-clang-mt-a64-1_70.a
libboost_contract-clang-mt-a64-1_70.a libboost_log_setup-clang-mt-a64-1_70.a libboost_random-clang-mt-a64-
1_70.a libboost_type_erasure-clang-mt-a64-1_70.a
libboost_coroutine-clang-mt-a64-1_70.a libboost_math_c99-clang-mt-a64-1_70.a libboost_regex-clang-mt-a64-
1_70.a libboost_unit_test_framework-clang-mt-a64-1_70.a
libboost_date_time-clang-mt-a64-1_70.a libboost_math_c99f-clang-mt-a64-1_70.a libboost_serialization-clang-mt-a64-1_70.a libboost_wave-clang-mt-a64-1_70.a
libboost_exception-clang-mt-a64-1_70.a libboost_math_c99l-clang-mt-a64-1_70.a libboost_stacktrace_basic-clang-mt-a64-1_70.a libboost_wserialization-clang-mt-a64-1_70.a
使⽤Android NDK编译vsomeip的bind库(ENABLE_COMPAT表⽰兼容⽼的叫vsomeip,新的叫someip3):
$ mv 3.1.7. vsomeip-3.1.7.
$ tar -zxvf vsomeip-3.1.7.
$ cd vsomeip-3.1.7.1/
$ vi CMake_build.sh
#!/bin/bash
set -x
BASEPATH=.
NDKPATH=/AndroidSDK/ndk-bundle
CMAKEPATH=/AndroidSDK/cmake/3.6.4111459/bin
PLATFORM=arm64-v8a
BUILDTYPE=Debug
#rm -
#rm -rf CMakeFiles
#rm -rf ake
#rm -rf Makefile
#rm -ake
${CMAKEPATH}/cmake \
-DCMAKE_TOOLCHAIN_FILE=${NDKPATH}/build/ake \ -DANDROID_ABI=${PLATFORM} \
-DANDROID_NDK=${NDKPATH} \
-DANDROID_NATIVE_API_LEVEL=29 \
-DANDROID_PLATFORM=android-29 \
-DANDROID_STL=c++_shared \
-DCMAKE_BUILD_TYPE=${BUILDTYPE} \集团公司架构设计
properties是什么文件-DANDROID_TOOLCHAIN=clang \
-DBOOST_ROOT=${BASEPATH}/boost/arm64-v8a \
-DCMAKE_INSTALL_PREFIX=${BASEPATH}/out/ \
-DENABLE_COMPAT=1 \
-DVSOMEIP_INSTALL_ROUTINGMANAGERD=ON \
-DENABLE_MULTIPLE_ROUTING_MANAGERS=1 \
${BASEPATH}
make VERBOSE=1
make install
set +x
$
…
# OS
if (${CMAKE_SYSTEM_NAME} MATCHES “Android”)
set(OS “Android”)
set(DL_LIBRARY “”)
set(EXPORTSYMBOLS “”)
set(NO_DEPRECATED “”)
set(OPTIMIZE “”)
set(OS_CXX_FLAGS “-Wno-error=format-security -D_GLIBCXX_USE_NANOSLEEP -pthread -O -W
all -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector-strong -fasynchronous-unwind-tables -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fPIE -pie -Wl,-z,relro,-z,now”)
endif (${CMAKE_SYSTEM_NAME} MATCHES “Android”)
if (${CMAKE_SYSTEM_NAME} MATCHES “Linux”)
…
# Boost
set(BOOST_ROOT ${CMAKE_SOURCE_DIR}/../Boost-for-Android/build/out/${ANDROID_ABI})
set(BOOST_INCLUDEDIR ${BOOST_ROOT}/include/boost-1_70)
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
set(Boost_FOUND 1)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_70)
set(Boost_LIBRARY_DIR ${BOOST_ROOT}/lib)
set(Boost_VERSION 107000)
#find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
…
else()
# set (CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -D${OS} ${OS_CXX_FLAGS} -DBOOST_LOG_DYN_LINK -g ${OPTIMIZE} -std=c++11 ${NO_DEPRECATED} ${EXPORTSYMBOLS}”)
set (CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -D${OS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} -std=c++11
${NO_DEPRECATED} ${EXPORTSYMBOLS}”)
add_library(boost_system STATIC IMPORTED)
set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION ${Boost_LIBRARY_DIR}/libboost_system-clang-mt-a64-1_70.a)
自学java视频add_library(boost_thread STATIC IMPORTED)
set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION ${Boost_LIBRARY_DIR}/libboost_thread-clang-mt-a64-1_70.a)
add_library(boost_log_setup STATIC IMPORTED)
set_target_properties(boost_log_setup PROPERTIES IMPORTED_LOCATION ${Boost_LIBRARY_DIR}/libboost_log_setup-clang-mt-a64-1_70.a)
add_library(boost_log STATIC IMPORTED)
set_target_properties(boost_log PROPERTIES IMPORTED_LOCATION ${Boost_LIBRARY_DIR}/libboost_log-clang-mt-a64-1_70.a)
add_library(boost_filesystem STATIC IMPORTED)
set_target_properties(boost_filesystem PROPERTIES IMPORTED_LOCATION ${Boost_LIBRARY_DIR}/libboost_filesystem-clang-mt-a64-1_70.a)
set(Boost_LIBRARIES “log” “boost_system” “boost_thread” “boost_log” “boost_log_setup” “boost_filesystem”)
# set(USE_RT “rt”)
endif()
>>>>>>>>>>>>>>>>
# Configuration library
>>>>>>>>>>>>>>>>
…
$ vi implementation/helper/1.70/boost/asio/detail/reactive_socket_recvfrom_op_ext_local.hpp
reactive_socket_recvfrom_op_base_ext_local(socket_type socket, int protocol_type,
const MutableBufferSequence& buffers, Endpoint& endpoint,
socket_base::message_flags flags, func_type complete_func)
修改这⾏:
: reactor_op(&reactive_socket_recvfrom_op_base_ext_local::do_perform, complete_func),
为:
: reactor_op_ext_local(&reactive_socket_recvfrom_op_base_ext_local::do_perform, complete_func),
把Android AOSP的log.h拷贝过来(注意log名字⼤⼩写变化):
$ mkdir interface/utils
$ cp ../androidP/system/core/include/android/log.h ./interface/utils/Log.h
$ vi ./interface/utils/Log.h
底部添加:
#define LOG_TAG “VSOMEIP”
#define ALOGV(…) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
#define ALOGD(…) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define ALOGI(…) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define ALOGW(…) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define ALOGE(…) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
$ vi implementation/configuration/include/internal_android.hpp
#define VSOMEIP_CFG_LIBRARY “libvsomeip3-cfg.so”
#define VSOMEIP_SD_LIBRARY “libvsomeip3-sd.so”
#define VSOMEIP_E2E_LIBRARY “libvsomeip3-e2e.so”
编译:
$ ./CMake_build.sh
⽣成位置(其中路由管理是个可执⾏⽂件,在bin⼦⽬录):
$ ll out/*
out/bin:
routingmanagerd
out/etc: (注意这个etc⾥⾯的*.json⽂件为客户端和服务端配置⽂件模板,后⾯可以以这个为基础进⾏修改) vsomeip
out/include:
compat vsomeip
out/lib:
cmake libvsomeip3-e2e.so libvsomeip3-sd.so libvsomeip3.so libvsomeip.so pkgconfig
使⽤Android NDK编译CommonAPI的核⼼库:
$ tar -zxvf capicxx-core-runtime-3.1.12.
$ cd capicxx-core-runtime-3.1.12.6/
$ vi CMake_build.sh
#!/bin/bash
set -x
BASEPATH=.
order by sqlNDKPATH=/AndroidSDK/ndk-bundle
CMAKEPATH=/AndroidSDK/cmake/3.6.4111459/bin
PLATFORM=arm64-v8a
BUILDTYPE=Debug
#rm -
#rm -rf CMakeFiles
#rm -rf ake
pr实例教程#rm -rf Makefile
#rm -ake
${CMAKEPATH}/cmake \
-DCMAKE_TOOLCHAIN_FILE=${NDKPATH}/build/ake \
-DANDROID_ABI=${PLATFORM} \
-DANDROID_NDK=${NDKPATH} \
-DANDROID_NATIVE_API_LEVEL=29 \
-DANDROID_PLATFORM=android-29 \
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论