12/2/2023 0 Comments Android ndk c 11Seems like the ifaddrs.h I used does not work as the normal one provided by linux.ĭoes anyone know how to solve this? I'm afraid the C++ code I wrote contains some C++11 specific methods (not sure here, it just works on my host system) thus I don't want to miss that feature (apart from that, libtins runs faster with C++11). Info->bcast_addr=IPv4Address(((struct sockaddr_in*)addr->ifa_ifu.ifu_broadaddr)->sin_addr.s_addr) libtins-master/src/network_interface.cpp:96:85: error: 'const struct ifaddrs' has no member named 'ifa_ifu' libtins-master/src/network_interface.cpp: In member function 'bool InterfaceInfoCollector::operator()(const ifaddrs*)': Adding this lib and its header file to the libtins directory solves the ifaddrs.h: no such file or directoy issue but causes a another one. I found this git repository which offers a ifaddrs.h file that I could cross compile with the same standalone toolchain creating a static lib. However, compiling gives an error since ifaddrs.h is not found. Turning off C++11 support for libtins makes cmake run through. Which confuses me since according to the NDK documentation C++11 is supported. Configuring incomplete, errors occurred! Found PCAP: /home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/lib/libpcap.aĬMake Error at CMakeLists.txt:60 (MESSAGE):Ĭ++11 features requested but the compiler does not support them. Setting build type to 'RelWithDebInfo' as none was specified. Check for working CXX compiler: /home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/bin/arm-linux-androideabi-gcc-4.8 - works Check for working CXX compiler: /home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/bin/arm-linux-androideabi-gcc-4.8 Check for working C compiler: /home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/bin/arm-linux-androideabi-gcc-4.8 - works Check for working C compiler: /home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/bin/arm-linux-androideabi-gcc-4.8 Gives me this error: - The CXX compiler identification is GNU 4.8.0 DCMAKE_C_COMPILER=/home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/bin/arm-linux-androideabi-gcc-4.8 DCMAKE_CXX_COMPILER=/home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/bin/arm-linux-androideabi-gcc-4.8 DCMAKE_FIND_ROOT_PATH=/home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain/ As I also compile it with the -std=c++11 flag on my host system (debian 7 btw) I try to use C++11 with the NDK as well. I followed the cross compile tutorial on the libtins homepage. In order to compile it I set up a standalone toolchain from the Android NDK with the following command: make-standalone-toolchain.sh -platform=android-19 -install-dir=/home/henrik/Bachelorarbeit/Sources/lib/Android-19_Toolchain -toolchain=arm-linux-androideabi-4.8 -stl=libc++ Therefore I'm trying to cross compile libtins in order to use my code on Android. Now I need to use that code in my Android app. The sniffer itself is written in C++ using libtins, "a high-level, multiplatform C++ network packet sniffing and crafting library." It works fine and without problems. I have to write a Wifi Sniffer for Android for my bachelor thesis.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |