Skip to content

Commit 1fadcb9

Browse files
committed
fix libwebsockets android arm64 build issue and delete gafplayer
1 parent dcef6bf commit 1fadcb9

File tree

5 files changed

+49
-47
lines changed

5 files changed

+49
-47
lines changed

build/android.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cfg_default_build_api=9
88
cfg_default_gcc_version=4.9
99
cfg_arm_alias_folder_name="armeabi"
1010
cfg_armv7_alias_folder_name="armeabi-v7a"
11-
cfg_arm64_alias_folder_name="armeabi-v8a"
11+
cfg_arm64_alias_folder_name="arm64-v8a"
1212
#specific the STL version, currently only clang and gnu is supported
1313
cfg_default_build_stl="gnu" #clang is another option
1414

contrib/bootstrap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ check_android_sdk()
229229
## FIXME: the android toolchain path is hardcoded, only MACOSX will work.
230230
if [ ${ANDROID_ABI} = "x86" ]; then
231231
toolchain_path_prefix=x86
232-
elif [ ${ANDROID_ABI} = "armeabi-v8a" ];then
232+
elif [ ${ANDROID_ABI} = "arm64-v8a" ];then
233233
toolchain_path_prefix=aarch64-linux-android
234234
else
235235
toolchain_path_prefix=arm-linux-androideabi
236236
fi
237237

238238
# check whether sysroot is exists
239-
if [ $ANDROID_ABI = "armeabi-v8a" ]; then
239+
if [ $ANDROID_ABI = "arm64-v8a" ]; then
240240
if [ ! -d ${ANDROID_NDK}/platforms/${ANDROID_API}/arch-arm64 ];then
241241
echo "${ANDROID_NDK} ${ANDROID_API} doesn't support build arm64 architecture!"
242242
exit $?
@@ -268,7 +268,7 @@ check_android_sdk()
268268
add_make "EXTRA_CFLAGS := -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float ${THUMB_FLAG} -fomit-frame-pointer -fno-strict-aliasing -DANDROID -Wa,--noexecstack -Wformat "
269269
fi
270270

271-
if [ ${ANDROID_ABI} = "armeabi-v8a" ]; then
271+
if [ ${ANDROID_ABI} = "arm64-v8a" ]; then
272272
add_make_enabled "HAVE_NEON"
273273
add_make_enabled "HAVE_ARMV8A"
274274
add_make "EXTRA_CFLAGS := -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes"

contrib/src/gafplayer/rules.mak

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff --git a/lib/context.c b/lib/context.c
2+
index f2f30ad..2b04f36 100755
3+
--- a/lib/context.c
4+
+++ b/lib/context.c
5+
@@ -123,7 +123,12 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
6+
context->options = info->options;
7+
context->iface = info->iface;
8+
/* to reduce this allocation, */
9+
- context->max_fds = getdtablesize();
10+
+ //context->max_fds = getdtablesize();
11+
+ context->max_fds = OPEN_MAX;
12+
+ struct rlimit rl;
13+
+ if (getrlimit(RLIMIT_NOFILE, &rl) != -1) {
14+
+ context->max_fds = rl.rlim_cur;
15+
+ }
16+
lwsl_notice(" static allocation: %u + (%u x %u fds) = %u bytes\n",
17+
sizeof(struct libwebsocket_context),
18+
sizeof(struct libwebsocket_pollfd) +
19+
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
20+
index 6fae889..c1aac6f 100755
21+
--- a/lib/private-libwebsockets.h
22+
+++ b/lib/private-libwebsockets.h
23+
@@ -42,6 +42,7 @@
24+
#include <ctype.h>
25+
#include <limits.h>
26+
#include <stdarg.h>
27+
+#include <sys/resource.h>
28+
29+
#ifdef HAVE_SYS_STAT_H
30+
#include <sys/stat.h>
31+
@@ -145,8 +146,10 @@
32+
#endif
33+
34+
#ifndef HAVE_BZERO
35+
+#ifndef bzero
36+
#define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
37+
#endif
38+
+#endif
39+
40+
#ifndef HAVE_STRERROR
41+
#define strerror(x) ""

contrib/src/websockets/rules.mak

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ websockets: libwebsockets-1.3-chrome37-firefox30.zip .sum-websockets
1212
$(UNPACK)
1313
ifdef HAVE_ANDROID
1414
$(APPLY) $(SRC)/websockets/websocket_android.patch
15+
ifeq ($(MY_TARGET_ARCH),arm64-v8a)
16+
$(APPLY) $(SRC)/websockets/android-arm64.patch
17+
endif
1518
endif
1619
$(MOVE)
1720

@@ -23,6 +26,6 @@ endif
2326
DEPS_websockets = zlib $(DEPS_zlib)
2427

2528
.websockets: websockets .zlib toolchain.cmake
26-
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) $(EX_ECFLAGS)" $(CMAKE) -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_PING=1
29+
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) $(EX_ECFLAGS)" $(CMAKE) -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_PING=1 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1
2730
cd $< && $(MAKE) VERBOSE=1 install
2831
touch $@

0 commit comments

Comments
 (0)