0,生成独立工具链
$NDK/build/tools/make_standalone_toolchain.py \
--arch=arm \
--platform=android-23 \
--install-dir=`pwd`/android-toolchain-arm
生成的独立工具链路径:/home/xxx/share/tools/android-toolchain-arm-api23/bin
将其添加到PATH变量中。
export PATH=$PATH:/home/xxx/share/tools/android-toolchain-arm-api23/bin
target_host=arm-linux-androideabi
export AR=$target_host-ar
export AS=$target_host-as
export CC=$target_host-gcc
export CXX=$target_host-g++
export LD=$target_host-ld
export STRIP=$target_host-strip
export CFLAGS="-fPIE -fPIC -D__ANDROID_API__=23"
export LDFLAGS="-pie"
1,build libuv(v1.x)
1)sh autogen.sh
2)./configure --host=arm-linux-androideabi --prefix=/home/xxx/share/tmp/cross
3)make && make install
2,build mbedtls(mbedtls-mbedtls-2.11.0)
1)mkdir build && cd build
2)cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On ..
3)make
3,build libwebsockets
export LIBS_INSTALL_PATH=/home/xxx/share/tmp/cross/lib
1)mkdir build && cd build
2)cmake .. -DCMAKE_INSTALL_PREFIX=${LIBS_INSTALL_PATH} -DLWS_WITH_LWSWS=1 -DLWS_WITH_MBEDTLS=1 -DLWS_WITHOUT_TESTAPPS=1 -DLWS_MBEDTLS_LIBRARIES="${LIBS_INSTALL_PATH}/libmbedcrypto.so;${LIBS_INSTALL_PATH}/libmbedtls.so;${LIBS_INSTALL_PATH}/libmbedx509.so" -DLWS_MBEDTLS_INCLUDE_DIRS=${LIBS_INSTALL_PATH}/../include -DLWS_LIBUV_LIBRARIES=${LIBS_INSTALL_PATH}/libuv.so -DLWS_LIBUV_INCLUDE_DIRS=${LIBS_INSTALL_PATH}/../include
3)make && make install
网友评论