Hello, im trying to built slikenet with ndk, is there any detailed tutorial using cygwin? Because the one I read from raknet didn't work for me and I don't know what I am doing wrong.
I tried to built it with Android Studio and I get an error, can not find asm/io.h
Do I have to set a macro to let it know I'm going to built it for android? If yes would anyone tell me where?
Thanks in advance!
Android build
Re: Android build
First of all, sorry for the late reply. Got too much side-tracked with other work.
Getting Android support in for SLikeNet is on our roadmap for 0.3.0 atm (SLNET-187). Unfortunately, that's currently not our priority and we didn't work on adding Android support much. This RakNet pull request might however be a starting point: https://github.com/facebookarchive/RakNet/pull/82
While we didn't review it yet, it claims to add Android support and should also mostly work with SLikeNet if it does the job for RakNet.
Does this help?
Getting Android support in for SLikeNet is on our roadmap for 0.3.0 atm (SLNET-187). Unfortunately, that's currently not our priority and we didn't work on adding Android support much. This RakNet pull request might however be a starting point: https://github.com/facebookarchive/RakNet/pull/82
While we didn't review it yet, it claims to add Android support and should also mostly work with SLikeNet if it does the job for RakNet.
Does this help?
Re: Android build
Thank you Luke for taking the time to answer.
I tried that pull with NDK-r19c, NDK-r16b, NDK-r10e
Generated libslikenet.a and .so and tried to link the shared object with no luck, and then the static lib with the same error:
error: undefined reference to 'SLNet::SystemAddress::SystemAddress()' at types.h line 34
clang++.exe: error: linker command failed with exit code 1
So i included all the cpp files and tried to build it directly from source code with API 16
i got:
fatal error: 'ifaddrs.h' file not found at RaknetSocket2.cpp line 34
with API 24 i get:
fatal error: 'asm/io.h' file not found at FileList.cpp line 23
i really dont know what to do, it looks like never worked on android.
If you want more info just let me know and i will make a detailed post with all i 'd tried.

I tried that pull with NDK-r19c, NDK-r16b, NDK-r10e
Generated libslikenet.a and .so and tried to link the shared object with no luck, and then the static lib with the same error:
error: undefined reference to 'SLNet::SystemAddress::SystemAddress()' at types.h line 34
clang++.exe: error: linker command failed with exit code 1
So i included all the cpp files and tried to build it directly from source code with API 16
i got:
fatal error: 'ifaddrs.h' file not found at RaknetSocket2.cpp line 34
with API 24 i get:
fatal error: 'asm/io.h' file not found at FileList.cpp line 23
i really dont know what to do, it looks like never worked on android.

If you want more info just let me know and i will make a detailed post with all i 'd tried.
Re: Android build
I made a mistake compiling .so and .a libs.
That is why i got those undefined reference errors.
Android.mk
Application.mk
So i tried Again:
NDK-r16b | APP_PLATFORM := android-24:
NDK-r16b | APP_PLATFORM := android-16:
[armeabi-v7a] Compile++ thumb: slikenet <= FileList.cpp
jni/../../Source/src/FileList.cpp:23:10: fatal error: 'asm/io.h' file not found
#include <asm/io.h>
^~~~~~~~~~
1 error generated.
make: *** [obj/local/armeabi-v7a/objs/slikenet/__/__/Source/src/FileList.o] Error 1
NDK-r10e | APP_PLATFORM := android-9:
NDK-r10e | APP_PLATFORM := android-16:
NDK-r10e | APP_PLATFORM := android-19:
[armeabi-v7a] Compile++ thumb: slikenet <= RakNetSocket2.cpp
In file included from jni/../../Source/src/RakNetSocket2.cpp:49:0:
jni/../../Source/src/RakNetSocket2_Windows_Linux.cpp:25:48: fatal error: ifaddrs.h: No such file or directory
#include <ifaddrs.h> // used for getifaddrs()
^
compilation terminated.
make.exe: *** [obj/local/armeabi-v7a/objs/slikenet/__/__/Source/src/RakNetSocket2.o] Error 1
NDK-r10e | APP_PLATFORM := android-21:
[armeabi-v7a] Compile++ thumb: slikenet <= FileList.cpp
jni/../../Source/src/FileList.cpp:23:20: fatal error: asm/io.h: No such file or directory
#include <asm/io.h>
^
compilation terminated.
make.exe: *** [obj/local/armeabi-v7a/objs/slikenet/__/__/Source/src/FileList.o] Error 1
I write this post just to make it clearer, but are the same errors when trying to compile the source code directly in the project.
I'd read that ifaddrs.h was added to android in API 24, so i wonder how it works in that pull using api level 9?
That is why i got those undefined reference errors.
Android.mk
Code: Select all
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libslikenet
FILE_LIST := $(wildcard $(LOCAL_PATH)/../../Source/src/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Source/src/crypto/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Source
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Source/include
include $(BUILD_STATIC_LIBRARY)
Code: Select all
APP_STL := c++_static
APP_ABI := armeabi-v7a
APP_PLATFORM := android-9
NDK-r16b | APP_PLATFORM := android-24:
NDK-r16b | APP_PLATFORM := android-16:
[armeabi-v7a] Compile++ thumb: slikenet <= FileList.cpp
jni/../../Source/src/FileList.cpp:23:10: fatal error: 'asm/io.h' file not found
#include <asm/io.h>
^~~~~~~~~~
1 error generated.
make: *** [obj/local/armeabi-v7a/objs/slikenet/__/__/Source/src/FileList.o] Error 1
NDK-r10e | APP_PLATFORM := android-9:
NDK-r10e | APP_PLATFORM := android-16:
NDK-r10e | APP_PLATFORM := android-19:
[armeabi-v7a] Compile++ thumb: slikenet <= RakNetSocket2.cpp
In file included from jni/../../Source/src/RakNetSocket2.cpp:49:0:
jni/../../Source/src/RakNetSocket2_Windows_Linux.cpp:25:48: fatal error: ifaddrs.h: No such file or directory
#include <ifaddrs.h> // used for getifaddrs()
^
compilation terminated.
make.exe: *** [obj/local/armeabi-v7a/objs/slikenet/__/__/Source/src/RakNetSocket2.o] Error 1
NDK-r10e | APP_PLATFORM := android-21:
[armeabi-v7a] Compile++ thumb: slikenet <= FileList.cpp
jni/../../Source/src/FileList.cpp:23:20: fatal error: asm/io.h: No such file or directory
#include <asm/io.h>
^
compilation terminated.
make.exe: *** [obj/local/armeabi-v7a/objs/slikenet/__/__/Source/src/FileList.o] Error 1
I write this post just to make it clearer, but are the same errors when trying to compile the source code directly in the project.
I'd read that ifaddrs.h was added to android in API 24, so i wonder how it works in that pull using api level 9?

Re: Android build
Some more news: it Compiled
i found this:
NDK-r16b (starts at line 55) in file "ndk-bundle/sysroot/usr/include/ifaddrs.h"
and also removed the line:
#include <asm/io.h>
on FileList.cpp at line 23
Final configuration:
Android.mk
Application.mk
i couldnt include crypto like i did before, i got 8 errors like this one:
/crypto/securestring.h:27:5: error: unknown type name 'size_t'
size_t m_EncryptedBufferSize;
I also get errors if i uncomment
on NativeFeatureIncludesOverrides.h line 17
i had built an app succesfully.
should i try to add LIBCAT_SECURITY or will crypto do it in some future?
i found this:
NDK-r16b (starts at line 55) in file "ndk-bundle/sysroot/usr/include/ifaddrs.h"
Code: Select all
#if __ANDROID_API__ >= 24
void freeifaddrs(struct ifaddrs* __ptr) __INTRODUCED_IN(24);
int getifaddrs(struct ifaddrs** __list_ptr) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#include <asm/io.h>
on FileList.cpp at line 23
Final configuration:
Android.mk
Code: Select all
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libslikenet
FILE_LIST := $(wildcard $(LOCAL_PATH)/../../Source/src/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Source
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Source/include
include $(BUILD_STATIC_LIBRARY)
Code: Select all
APP_STL := c++_static
APP_ABI := armeabi-v7a
APP_PLATFORM := android-24
/crypto/securestring.h:27:5: error: unknown type name 'size_t'
size_t m_EncryptedBufferSize;
I also get errors if i uncomment
Code: Select all
//#define LIBCAT_SECURITY 1
i had built an app succesfully.
should i try to add LIBCAT_SECURITY or will crypto do it in some future?
Re: Android build
Android build is available here: github.com/HeYuHan/Unity_RakNet/tree/master/Assets/Plugins/Android/libs/armeabi-v7a
-
- Newbie
- Posts: 1
- Joined: Tue Nov 05, 2019 5:40 am
Android build
Too bad. Are there any possibilities to solve that in an update? Problem must be the same for several further apps like Runtastic or WhatsApp-Live tracking too?
https://www.youtube.com/watch?v=uwiVVpQM5-0 kinder surprise disney
Who is online
Users browsing this forum: No registered users and 1 guest