Hello masters,

I'm developing an embedded HTTP server for ARM using MHD as HTTP core
library, however, I couldn't compile it as static library in my Xubuntu.
Below all steps I've tried:

*Configuration:*

configure: libmicrohttpd 0.9.52 Configuration Summary:
  Cross-compiling:   yes
  Operating System:  linux-androideabi
  Threading lib:     posix
  Use thread names:  yes
  Inter-thread comm: eventfd
  libcurl (testing): no, many unit tests will not run
  Target directory:  /usr/local
  Messages:          yes
  Basic auth.:       yes
  Digest auth.:      yes
  Postproc:          yes
  HTTPS support:     no (disabled)
  poll support:      yes
  epoll support:     yes
  build docs:        yes
  build examples:    yes

configure:
  License         :  LGPL or eCos

*Step 1:*

./configure --host=arm-linux-androideabi --enable-shared=no
--enable-static=yes --disable-https
make CFLAGS="-Wno-sign-compare -Wno-unused-parameter"

*(the CFLAGS idea above was extracted from:
https://android.googlesource.com/platform/external/libmicrohttpd/+/3b641bc5341bd35a4b798224d4c637c65d78ada0/Android.mk
<https://android.googlesource.com/platform/external/libmicrohttpd/+/3b641bc5341bd35a4b798224d4c637c65d78ada0/Android.mk>)*

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
  Error while executing
'/home/silvioprog/Android/Sdk/cmake/3.6.3155560/bin/cmake' with arguments
{--build
/home/silvioprog/Android/Projects/MyApplication/app/.externalNativeBuild/cmake/arm7Debug/armeabi-v7a
--target mhd}
  [1/1] Linking C shared library
/home/silvioprog/Android/Projects/MyApplication/app/build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/libmhd.so
  FAILED: : &&
/home/silvioprog/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
 -target armv7-none-linux-androideabi -gcc-toolchain
/home/silvioprog/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
--sysroot=/home/silvioprog/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm
-fPIC -g -DANDROID -ffunction-sections -funwind-tables
-fstack-protector-strong -no-canonical-prefixes -march=armv7-a
-mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb
-Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID
-ffunction-sections -funwind-tables -fstack-protector-strong
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
-fno-integrated-as -mthumb -Wa,--noexecstack -Wformat
-Werror=format-security  -O0 -fno-limit-debug-info -O0
-fno-limit-debug-info  -Wl,--build-id -Wl,--warn-shared-textrel
-Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined
-Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings
-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack
-Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libmhd.so -o
/home/silvioprog/Android/Projects/MyApplication/app/build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/libmhd.so
CMakeFiles/mhd.dir/src/mhd.c.o
 
/home/silvioprog/Android/Projects/MyApplication/app/src/main/jniLibs/armeabi-v7a/libmicrohttpd.a
-lm && :

/home/silvioprog/Android/Projects/MyApplication/app/src/main/jniLibs/armeabi-v7a/libmicrohttpd.a(libmicrohttpd_la-daemon.o):daemon.c:function
MHD_ip_limit_add: error: undefined reference to 'tsearch'

/home/silvioprog/Android/Projects/MyApplication/app/src/main/jniLibs/armeabi-v7a/libmicrohttpd.a(libmicrohttpd_la-daemon.o):daemon.c:function
MHD_ip_limit_del: error: undefined reference to 'tfind'

/home/silvioprog/Android/Projects/MyApplication/app/src/main/jniLibs/armeabi-v7a/libmicrohttpd.a(libmicrohttpd_la-daemon.o):daemon.c:function
MHD_ip_limit_del: error: undefined reference to 'tdelete'
  clang: error: linker command failed with exit code 1 (use -v to see
invocation)
  ninja: build stopped: subcommand failed.

*Step 2:*

./configure --host=arm-linux-androideabi --enable-shared=no
--enable-static=yes --disable-https
make

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
  Error while executing
'/home/silvioprog/Android/Sdk/cmake/3.6.3155560/bin/cmake' with arguments
{--build
/home/silvioprog/Android/Projects/MyApplication/app/.externalNativeBuild/cmake/arm7Debug/armeabi-v7a
--target mhd}
  [1/1] Linking C shared library
/home/silvioprog/Android/Projects/MyApplication/app/build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/libmhd.so
  FAILED: : &&
/home/silvioprog/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
 -target armv7-none-linux-androideabi -gcc-toolchain
/home/silvioprog/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
--sysroot=/home/silvioprog/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm
-fPIC -g -DANDROID -ffunction-sections -funwind-tables
-fstack-protector-strong -no-canonical-prefixes -march=armv7-a
-mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb
-Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID
-ffunction-sections -funwind-tables -fstack-protector-strong
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
-fno-integrated-as -mthumb -Wa,--noexecstack -Wformat
-Werror=format-security  -O0 -fno-limit-debug-info -O0
-fno-limit-debug-info  -Wl,--build-id -Wl,--warn-shared-textrel
-Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined
-Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings
-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack
-Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libmhd.so -o
/home/silvioprog/Android/Projects/MyApplication/app/build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/libmhd.so
CMakeFiles/mhd.dir/src/mhd.c.o
 
/home/silvioprog/Android/Projects/MyApplication/app/src/main/jniLibs/armeabi-v7a/libmicrohttpd.a
-lm && :
  daemon.c:375: error: undefined reference to 'tfind'
  daemon.c:392: error: undefined reference to 'tdelete'
  daemon.c:317: error: undefined reference to 'tsearch'
  clang: error: linker command failed with exit code 1 (use -v to see
invocation)
  ninja: build stopped: subcommand failed.

*Step 3:*

./configure --host=arm-linux-androideabi --enable-shared=no
--enable-static=yes --disable-https --disable-curl
make CC=arm-linux-androideabi-gcc LD=arm-linux-androideabi-ld

*(inspired by https://gnunet.org/mhd-on-openwrt
<https://gnunet.org/mhd-on-openwrt>)*

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
  Error while executing
'/home/silvioprog/Android/Sdk/cmake/3.6.3155560/bin/cmake' with arguments
{--build
/home/silvioprog/Android/Projects/MyApplication/app/.externalNativeBuild/cmake/arm7Debug/armeabi-v7a
--target mhd}
  [1/1] Linking C shared library
/home/silvioprog/Android/Projects/MyApplication/app/build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/libmhd.so
  FAILED: : &&
/home/silvioprog/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
 -target armv7-none-linux-androideabi -gcc-toolchain
/home/silvioprog/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
--sysroot=/home/silvioprog/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm
-fPIC -g -DANDROID -ffunction-sections -funwind-tables
-fstack-protector-strong -no-canonical-prefixes -march=armv7-a
-mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb
-Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID
-ffunction-sections -funwind-tables -fstack-protector-strong
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
-fno-integrated-as -mthumb -Wa,--noexecstack -Wformat
-Werror=format-security  -O0 -fno-limit-debug-info -O0
-fno-limit-debug-info  -Wl,--build-id -Wl,--warn-shared-textrel
-Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined
-Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings
-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack
-Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libmhd.so -o
/home/silvioprog/Android/Projects/MyApplication/app/build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/libmhd.so
CMakeFiles/mhd.dir/src/mhd.c.o
 
/home/silvioprog/Android/Projects/MyApplication/app/src/main/jniLibs/armeabi-v7a/libmicrohttpd.a
-lm && :
  daemon.c:375: error: undefined reference to 'tfind'
  daemon.c:392: error: undefined reference to 'tdelete'
  daemon.c:317: error: undefined reference to 'tsearch'
  clang: error: linker command failed with exit code 1 (use -v to see
invocation)
  ninja: build stopped: subcommand failed.

*Step 4:*

Downloaded the package "https://archlinuxarm.org/packages/arm/libmicrohttpd";,
but unfortunately it distribute only the shared library that isn't
compatible with my ARM version. :-/

So, what are the tricks to compile MHD for ARM? :-)

Thank you!

*(I successfully compiled libcurl using this steps:
https://github.com/gcesarmza/curl-android-ios
<https://github.com/gcesarmza/curl-android-ios>, it would by nice a script
like this for MHD :-) )*

My environment:

*$ lsb_release -a*
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

*$ arm-linux-androideabi-gcc -v*
Using built-in specs.
COLLECT_GCC=arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-androideabi/4.7.4/lto-wrapper
Target: arm-linux-androideabi
Configured with: ../src/configure --prefix=/usr --libexecdir=/usr/lib
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=arm-linux-androideabi
--with-build-sysroot=/build/gcc-arm-linux-androideabi-LAi2yM/gcc-arm-linux-androideabi-0.20130705.1/sys-root
--disable-multilib --with-gnu-as --with-gnu-ld --enable-languages=c,c++
--disable-ppl-version-check --disable-cloog-version-check
--enable-cloog-backend=ppl --disable-libssp --disable-nls
--disable-libmudflap --disable-shared --disable-sjlj-exceptions
--disable-libquadmath --disable-libitm --disable-libatomic
--with-float=soft --with-fpu=vfp --with-arch=armv5te
--enable-target-optspace --disable-docs --disable-nls --enable-threads
--enable-tls --enable-libgomp --disable-libitm --disable-libatomic
--disable-libstdc__-v3
Thread model: posix
gcc version 4.7.4 (Linaro GCC 4.7-2014.04-1~dev)

*$ adb shell cat /proc/cpuinfo*
Processor : ARMv7 Processor rev 3 (v7l)
processor : 0
BogoMIPS : 38.40

processor : 1
BogoMIPS : 38.40

processor : 2
BogoMIPS : 38.40

processor : 3
BogoMIPS : 38.40

Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva
idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 3

Hardware : Qualcomm MSM8226
Revision : 0006
Serial : 0000000000000000

--
Silvio Clécio

Reply via email to