Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Android mobile phone supported? #66

Open
kxdkxd opened this issue Jun 23, 2022 · 4 comments · May be fixed by #68
Open

Is Android mobile phone supported? #66

kxdkxd opened this issue Jun 23, 2022 · 4 comments · May be fixed by #68

Comments

@kxdkxd
Copy link

kxdkxd commented Jun 23, 2022

I have cross compiled libpcap, libev, libnl-3 to armeabi using NDK and it went well. (While configuring libnl-3, I changed -lpthread to -pthread in the libnl-3 cmake files, because I read the docs and it shows that -lpthread is just similar as -pthread, and since the -lpthread is causing error, I changed -lpthread into -pthread directly.)
However, when I trying to cmake owl, something wrong happened.

build git:(master) cmake ..
CMake Deprecation Warning at googletest/CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at googletest/googlemock/CMakeLists.txt:45 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at googletest/googletest/CMakeLists.txt:56 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Found PythonInterp: /home/kxd/.pyenv/shims/python (found version "2.7.17") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kxd/Android/owl/build

Then I tried make directly, but error occurred.

➜  build git:(master) make -j6       
[  2%] Building C object CMakeFiles/radiotap.dir/radiotap/radiotap.c.o
[  5%] Building CXX object googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
/home/kxd/Android/owl/radiotap/radiotap.c:104:39: warning: taking address of packed member 'it_len' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        if (max_length < get_unaligned_le16(&radiotap_header->it_len))
                                             ^~~~~~~~~~~~~~~~~~~~~~~
/home/kxd/Android/owl/radiotap/platform.h:19:70: note: expanded from macro 'get_unaligned_le16'
#define get_unaligned_le16(p)   le16_to_cpu(get_unaligned((uint16_t *)(p)))
                                                                       ^
/home/kxd/Android/owl/radiotap/platform.h:14:12: note: expanded from macro 'get_unaligned'
                typeof(*(p)) __val;                             \
                         ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:105:28: note: expanded from macro 'le16toh'
#define le16toh(x) htole16(x)
                           ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:89:21: note: expanded from macro 'htole16'
#define htole16(x) (x)
                    ^
/home/kxd/Android/owl/radiotap/radiotap.c:104:39: warning: taking address of packed member 'it_len' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        if (max_length < get_unaligned_le16(&radiotap_header->it_len))
                                             ^~~~~~~~~~~~~~~~~~~~~~~
/home/kxd/Android/owl/radiotap/platform.h:19:70: note: expanded from macro 'get_unaligned_le16'
#define get_unaligned_le16(p)   le16_to_cpu(get_unaligned((uint16_t *)(p)))
                                                                       ^
/home/kxd/Android/owl/radiotap/platform.h:15:47: note: expanded from macro 'get_unaligned'
        } __attribute__((packed)) *__ptr = (void *) (p);        \
                                                     ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:105:28: note: expanded from macro 'le16toh'
#define le16toh(x) htole16(x)
                           ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:89:21: note: expanded from macro 'htole16'
#define htole16(x) (x)
                    ^
/home/kxd/Android/owl/radiotap/radiotap.c:108:46: warning: taking address of packed member 'it_len' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        iterator->_max_length = get_unaligned_le16(&radiotap_header->it_len);
                                                    ^~~~~~~~~~~~~~~~~~~~~~~
/home/kxd/Android/owl/radiotap/platform.h:19:70: note: expanded from macro 'get_unaligned_le16'
#define get_unaligned_le16(p)   le16_to_cpu(get_unaligned((uint16_t *)(p)))
                                                                       ^
/home/kxd/Android/owl/radiotap/platform.h:14:12: note: expanded from macro 'get_unaligned'
                typeof(*(p)) __val;                             \
                         ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:105:28: note: expanded from macro 'le16toh'
#define le16toh(x) htole16(x)
                           ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:89:21: note: expanded from macro 'htole16'
#define htole16(x) (x)
                    ^
/home/kxd/Android/owl/radiotap/radiotap.c:108:46: warning: taking address of packed member 'it_len' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        iterator->_max_length = get_unaligned_le16(&radiotap_header->it_len);
                                                    ^~~~~~~~~~~~~~~~~~~~~~~
/home/kxd/Android/owl/radiotap/platform.h:19:70: note: expanded from macro 'get_unaligned_le16'
#define get_unaligned_le16(p)   le16_to_cpu(get_unaligned((uint16_t *)(p)))
                                                                       ^
/home/kxd/Android/owl/radiotap/platform.h:15:47: note: expanded from macro 'get_unaligned'
        } __attribute__((packed)) *__ptr = (void *) (p);        \
                                                     ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:105:28: note: expanded from macro 'le16toh'
#define le16toh(x) htole16(x)
                           ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:89:21: note: expanded from macro 'htole16'
#define htole16(x) (x)
                    ^
/home/kxd/Android/owl/radiotap/radiotap.c:110:50: warning: taking address of packed member 'it_present' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        iterator->_bitmap_shifter = get_unaligned_le32(&radiotap_header->it_present);
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kxd/Android/owl/radiotap/platform.h:20:70: note: expanded from macro 'get_unaligned_le32'
#define get_unaligned_le32(p)   le32_to_cpu(get_unaligned((uint32_t *)(p)))
                                                                       ^
/home/kxd/Android/owl/radiotap/platform.h:14:12: note: expanded from macro 'get_unaligned'
                typeof(*(p)) __val;                             \
                         ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:106:28: note: expanded from macro 'le32toh'
#define le32toh(x) htole32(x)
                           ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:90:21: note: expanded from macro 'htole32'
#define htole32(x) (x)
                    ^
/home/kxd/Android/owl/radiotap/radiotap.c:110:50: warning: taking address of packed member 'it_present' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        iterator->_bitmap_shifter = get_unaligned_le32(&radiotap_header->it_present);
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kxd/Android/owl/radiotap/platform.h:20:70: note: expanded from macro 'get_unaligned_le32'
#define get_unaligned_le32(p)   le32_to_cpu(get_unaligned((uint32_t *)(p)))
                                                                       ^
/home/kxd/Android/owl/radiotap/platform.h:15:47: note: expanded from macro 'get_unaligned'
        } __attribute__((packed)) *__ptr = (void *) (p);        \
                                                     ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:106:28: note: expanded from macro 'le32toh'
#define le32toh(x) htole32(x)
                           ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/endian.h:90:21: note: expanded from macro 'htole32'
#define htole32(x) (x)
                    ^
/home/kxd/Android/owl/radiotap/radiotap.c:113:28: warning: taking address of packed member 'it_present' of class or structure 'ieee80211_radiotap_header' may result in an unaligned pointer value [-Waddress-of-packed-member]
        iterator->_next_bitmap = &radiotap_header->it_present;
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
7 warnings generated.
[  8%] Linking C static library libradiotap.a
[  8%] Built target radiotap
[ 10%] Building C object src/CMakeFiles/awdl.dir/log.c.o
[ 16%] Building C object src/CMakeFiles/awdl.dir/state.c.o
[ 16%] Building C object src/CMakeFiles/awdl.dir/channel.c.o
[ 18%] Building C object src/CMakeFiles/awdl.dir/sync.c.o
[ 21%] Building C object src/CMakeFiles/awdl.dir/election.c.o
In file included from /home/kxd/Android/owl/src/sync.c:21:
/home/kxd/Android/owl/src/ieee80211.h:142:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr1; /* dst */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/sync.c:21:
/home/kxd/Android/owl/src/ieee80211.h:143:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr2; /* src */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/sync.c:21:
/home/kxd/Android/owl/src/ieee80211.h:144:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr3; /* bssid */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
3 errors generated.
In file included from /home/kxd/Android/owl/src/channel.c:21:
/home/kxd/Android/owl/src/ieee80211.h:142:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr1; /* dst */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/channel.c:21:
/home/kxd/Android/owl/src/ieee80211.h:143:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr2; /* src */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/channel.c:21:
/home/kxd/Android/owl/src/ieee80211.h:144:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr3; /* bssid */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
src/CMakeFiles/awdl.dir/build.make:117: recipe for target 'src/CMakeFiles/awdl.dir/sync.c.o' failed
make[2]: *** [src/CMakeFiles/awdl.dir/sync.c.o] Error 1
make[2]: *** 正在等待未完成的任务....
3 errors generated.
src/CMakeFiles/awdl.dir/build.make:131: recipe for target 'src/CMakeFiles/awdl.dir/channel.c.o' failed
make[2]: *** [src/CMakeFiles/awdl.dir/channel.c.o] Error 1
In file included from /home/kxd/Android/owl/src/election.c:23:
In file included from /home/kxd/Android/owl/src/election.h:23:
/home/kxd/Android/owl/src/ieee80211.h:142:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr1; /* dst */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/election.c:23:
In file included from /home/kxd/Android/owl/src/election.h:23:
/home/kxd/Android/owl/src/ieee80211.h:143:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr2; /* src */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/election.c:23:
In file included from /home/kxd/Android/owl/src/election.h:23:
/home/kxd/Android/owl/src/ieee80211.h:144:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr addr3; /* bssid */
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/election.c:23:
/home/kxd/Android/owl/src/election.h:32:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr master_addr;
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/election.c:23:
/home/kxd/Android/owl/src/election.h:33:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr sync_addr;
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
In file included from /home/kxd/Android/owl/src/election.c:23:
/home/kxd/Android/owl/src/election.h:34:20: error: field has incomplete type 'struct ether_addr'
        struct ether_addr self_addr;
                          ^
/home/kxd/Android/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
struct ether_addr* ether_aton(const char* __ascii);
       ^
6 errors generated.
src/CMakeFiles/awdl.dir/build.make:103: recipe for target 'src/CMakeFiles/awdl.dir/election.c.o' failed
make[2]: *** [src/CMakeFiles/awdl.dir/election.c.o] Error 1
CMakeFiles/Makefile2:215: recipe for target 'src/CMakeFiles/awdl.dir/all' failed
make[1]: *** [src/CMakeFiles/awdl.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
[ 24%] Linking CXX static library ../../lib/libgtest.a
[ 24%] Built target gtest
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

It seems that NDK does not have a fully-implemented ether library? Or did I made something wrong?

@midozalouk
Copy link

It works in android using kali nethunter

@samolego
Copy link

samolego commented Mar 5, 2024

Did you ever succeed? I'm trying to build it in termux but getting some errors ...

Logs
build git:(master) ✗ make
[  5%] Built target radiotap
[  8%] Building C object src/CMakeFiles/awdl.dir/election.c.o
In file included from /data/data/com.termux/files/home/owl/src/election.c:23:
In file included from /data/data/com.termux/files/home/owl/src/election.h:23:
/data/data/com.termux/files/home/owl/src/ieee80211.h:142:20: error: field has incomplete type 'struct ether_addr'
142 |         struct ether_addr addr1; /* dst */            |                           ^
/data/data/com.termux/files/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
 63 | struct ether_addr* _Nullable ether_aton(const char* _Nonnull __ascii);
    |        ^                                        In file included from /data/data/com.termux/files/home/owl/src/election.c:23:                                   In file included from /data/data/com.termux/files/home/owl/src/election.h:23:
/data/data/com.termux/files/home/owl/src/ieee80211.h:143:20: error: field has incomplete type 'struct ether_addr'
143 |         struct ether_addr addr2; /* src */            |                           ^
/data/data/com.termux/files/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
 63 | struct ether_addr* _Nullable ether_aton(const char* _Nonnull __ascii);
    |        ^
In file included from /data/data/com.termux/files/home/owl/src/election.c:23:
In file included from /data/data/com.termux/files/home/owl/src/election.h:23:
/data/data/com.termux/files/home/owl/src/ieee80211.h:144:20: error: field has incomplete type 'struct ether_addr'
144 |         struct ether_addr addr3; /* bssid */
    |                           ^
/data/data/com.termux/files/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
 63 | struct ether_addr* _Nullable ether_aton(const char* _Nonnull __ascii);
    |        ^
In file included from /data/data/com.termux/files/home/owl/src/election.c:23:
/data/data/com.termux/files/home/owl/src/election.h:33:20: error: field has incomplete type 'struct ether_addr'
 33 |         struct ether_addr master_addr;
    |                           ^
/data/data/com.termux/files/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
 63 | struct ether_addr* _Nullable ether_aton(const char* _Nonnull __ascii);
    |        ^
In file included from /data/data/com.termux/files/home/owl/src/election.c:23:
/data/data/com.termux/files/home/owl/src/election.h:34:20: error: field has incomplete type 'struct ether_addr'
 34 |         struct ether_addr sync_addr;
    |                           ^
/data/data/com.termux/files/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
 63 | struct ether_addr* _Nullable ether_aton(const char* _Nonnull __ascii);
    |        ^
In file included from /data/data/com.termux/files/home/owl/src/election.c:23:
/data/data/com.termux/files/home/owl/src/election.h:35:20: error: field has incomplete type 'struct ether_addr'
 35 |         struct ether_addr self_addr;
    |                           ^
/data/data/com.termux/files/usr/include/netinet/ether.h:63:8: note: forward declaration of 'struct ether_addr'
 63 | struct ether_addr* _Nullable ether_aton(const char* _Nonnull __ascii);
    |        ^
6 errors generated.
make[2]: *** [src/CMakeFiles/awdl.dir/build.make:104: src/CMakeFiles/awdl.dir/election.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:216: src/CMakeFiles/awdl.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@samolego
Copy link

samolego commented Mar 6, 2024

Tried fork (#68) and it builds.

@samolego
Copy link

samolego commented Mar 6, 2024

Ah, running still fails:

13:17:22 ERROR: Error while receiving via netlink: Operation not supported
13:17:22 ERROR: Could not put device in monitor mode: wlan0
13:17:22 ERROR: could not initialize core

(Even if I put device in monitor mode manually ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@midozalouk @samolego @kxdkxd and others