Socket.cpp Build Error for Android on Linux

Hey all

I recently installed openfl on a new machine and set up the android target, and when I attempt to build for android I get an odd error:


$ openfl build android

- Compiling group 'hxcpp_std' with flags --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=330(haxe) -I/usr/lib/haxe/lib/hxcpp/3,3,49/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D_LINUX_STDDEF_H  -Wno-psabi -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=9 -Wa,--noexecstack -O2 -DNDEBUG -c tags=[haxe,static]
 - Compile : Socket.cpp
Error: While running :arm-linux-androideabi-g++ --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -I/usr/lib/haxe/lib/hxcpp/3,3,49/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=9 -Wa,--noexecstack -O2 -DNDEBUG -c -x c++ -Wno-invalid-offsetof -frtti /usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp -o/home/me/project/Export/android/obj/obj/android-v7/b5cfb7af_Socket.obj
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp: In function 'void _hx_std_socket_connect(Dynamic, int, int)':
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp:409: error: '__builtin_bswap16' was not declared in this scope
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp: In function 'void _hx_std_socket_bind(Dynamic, int, int)':
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp:601: error: '__builtin_bswap16' was not declared in this scope
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp: In function 'Array<int> _hx_std_socket_peer(Dynamic)':
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp:665: error: '__builtin_bswap16' was not declared in this scope
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp: In function 'Array<int> _hx_std_socket_host(Dynamic)':
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp:688: error: '__builtin_bswap16' was not declared in this scope
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp: In function 'int _hx_std_socket_send_to(Dynamic, Array<unsigned char>, int, int, Dynamic)':
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp:1084: error: '__builtin_bswap16' was not declared in this scope
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp: In function 'int _hx_std_socket_recv_from(Dynamic, Array<unsigned char>, int, int, Dynamic)':
/usr/lib/haxe/lib/hxcpp/3,3,49/src/hx/libs/std/Socket.cpp:1133: error: '__builtin_bswap16' was not declared in this scope


I am using haxe 3.3.0, hxcpp 3.3.49 (as the error above shows), gcc/g++ 4.8.4 , openfl 3.6.1, lime 2.9.1

What step have I left out?

I just removed the android-ndk and reinstalled it - the issue no longer occurrs.

1 Like