NDK build libwebsockets

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容