2018-12-11 21:40 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0005329libmicrohttpdportabilitypublic2018-12-11 09:46
Reportersilvioprog 
Assigned Tosilvioprog 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionno change required 
Product Versioncurrent SVN 
Target Version0.9.62Fixed in Version0.9.62 
Summary0005329: libmicrohttpd building fail for Android (arm)
DescriptionHello.

The stable version 0.9.59 builds fine, however, the trunk version returns the following error at build time:

[snip]

/tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -DHAVE_CONFIG_H -I. -I../..  -I../../src/include -DDATA_DIR=\"../../src/datadir/\" -DCPU_COUNT=8    -g -O2 -fno-strict-aliasing -MT suspend_resume_epoll-suspend_resume_epoll.o -MD -MP -MF .deps/suspend_resume_epoll-suspend_resume_epoll.Tpo -c -o suspend_resume_epoll-suspend_resume_epoll.o `test -f 'suspend_resume_epoll.c' || echo './'`suspend_resume_epoll.c
suspend_resume_epoll.c:120:1: warning: control reaches end of non-void function
      [-Wreturn-type]
}
^
1 warning generated.
mv -f .deps/suspend_resume_epoll-suspend_resume_epoll.Tpo .deps/suspend_resume_epoll-suspend_resume_epoll.Po
/bin/bash ../../libtool  --tag=CC   --mode=link /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang   -g -O2 -fno-strict-aliasing  -pie -o suspend_resume_epoll suspend_resume_epoll-suspend_resume_epoll.o ../../src/microhttpd/libmicrohttpd.la 
libtool: link: /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -g -O2 -fno-strict-aliasing -pie -o suspend_resume_epoll suspend_resume_epoll-suspend_resume_epoll.o  ../../src/microhttpd/.libs/libmicrohttpd.a -pthread
depbase=`echo post_example.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
/tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -DHAVE_CONFIG_H -I. -I../..  -I../../src/include -DDATA_DIR=\"../../src/datadir/\"    -g -O2 -fno-strict-aliasing -MT post_example.o -MD -MP -MF $depbase.Tpo -c -o post_example.o post_example.c &&\
mv -f $depbase.Tpo $depbase.Po
/bin/bash ../../libtool  --tag=CC   --mode=link /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang   -g -O2 -fno-strict-aliasing  -pie -o post_example post_example.o ../../src/microhttpd/libmicrohttpd.la 
libtool: link: /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -g -O2 -fno-strict-aliasing -pie -o post_example post_example.o  ../../src/microhttpd/.libs/libmicrohttpd.a -pthread
/tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -DHAVE_CONFIG_H -I. -I../..  -I../../src/include -DDATA_DIR=\"../../src/datadir/\" -DCPU_COUNT=8  -pthread   -g -O2 -fno-strict-aliasing -MT demo-demo.o -MD -MP -MF .deps/demo-demo.Tpo -c -o demo-demo.o `test -f 'demo.c' || echo './'`demo.c
mv -f .deps/demo-demo.Tpo .deps/demo-demo.Po
/bin/bash ../../libtool  --tag=CC   --mode=link /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -pthread   -g -O2 -fno-strict-aliasing  -pie -o demo demo-demo.o ../../src/microhttpd/libmicrohttpd.la   
libtool: link: /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -pthread -g -O2 -fno-strict-aliasing -pie -o demo demo-demo.o  ../../src/microhttpd/.libs/libmicrohttpd.a -pthread
depbase=`echo authorization_example.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
/tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -DHAVE_CONFIG_H -I. -I../..  -I../../src/include -DDATA_DIR=\"../../src/datadir/\"    -g -O2 -fno-strict-aliasing -MT authorization_example.o -MD -MP -MF $depbase.Tpo -c -o authorization_example.o authorization_example.c &&\
mv -f $depbase.Tpo $depbase.Po
/bin/bash ../../libtool  --tag=CC   --mode=link /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang   -g -O2 -fno-strict-aliasing  -pie -o authorization_example authorization_example.o ../../src/microhttpd/libmicrohttpd.la 
libtool: link: /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -g -O2 -fno-strict-aliasing -pie -o authorization_example authorization_example.o  ../../src/microhttpd/.libs/libmicrohttpd.a -pthread
make[4]: Leaving directory '/home/silvioprog/libmicrohttpd/src/examples'
make[3]: Leaving directory '/home/silvioprog/libmicrohttpd/src/examples'
Making all in lib
make[3]: Entering directory '/home/silvioprog/libmicrohttpd/src/lib'
/bin/bash ../../libtool  --tag=CC   --mode=compile /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -DHAVE_CONFIG_H -I. -I../..  -I../../src/include -I../../src/lib  -DBUILDING_MHD_LIB=1  -fvisibility=hidden  -pthread -g -O2 -fno-strict-aliasing -MT libmicrohttpd2_la-action_continue.lo -MD -MP -MF .deps/libmicrohttpd2_la-action_continue.Tpo -c -o libmicrohttpd2_la-action_continue.lo `test -f 'action_continue.c' || echo './'`action_continue.c
libtool: compile:  /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -DHAVE_CONFIG_H -I. -I../.. -I../../src/include -I../../src/lib -DBUILDING_MHD_LIB=1 -fvisibility=hidden -pthread -g -O2 -fno-strict-aliasing -MT libmicrohttpd2_la-action_continue.lo -MD -MP -MF .deps/libmicrohttpd2_la-action_continue.Tpo -c action_continue.c -o libmicrohttpd2_la-action_continue.o
In file included from action_continue.c:25:
In file included from ./internal.h:32:
../../src/include/microhttpd2.h:1488:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1501:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1526:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1537:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1570:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1603:3: error: expected function body after
      function declarator
  MHD_NONNULL(1,2,3,4);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1640:3: error: expected function body after
      function declarator
  MHD_NONNULL(1,2,3,4);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1691:3: error: expected function body after
      function declarator
  MHD_NONNULL(1,2);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1714:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1744:3: error: expected function body after
      function declarator
  MHD_NONNULL(1,2,3,4);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1779:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1797:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1819:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1832:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1846:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1862:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1909:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1963:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
../../src/include/microhttpd2.h:1979:3: error: expected function body after
      function declarator
  MHD_NONNULL(1);
  ^
../../src/include/microhttpd2.h:280:26: note: expanded from macro 'MHD_NONNULL'
#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
                         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Makefile:648: recipe for target 'libmicrohttpd2_la-action_continue.lo' failed
make[3]: *** [libmicrohttpd2_la-action_continue.lo] Error 1
make[3]: Leaving directory '/home/silvioprog/libmicrohttpd/src/lib'
Makefile:445: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/silvioprog/libmicrohttpd/src'
Makefile:571: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/silvioprog/libmicrohttpd'
Makefile:478: recipe for target 'all' failed
make: *** [all] Error 2
Steps To ReproduceI've used the current stable Google's NDK. The package is "android-ndk-r17-linux-x86_64.zip" (for Linux) that can be downloaded from: https://developer.android.com/ndk/downloads/ .

Steps to reproduce the error (all commands doesn't requires root privileges):

1. extract the android-ndk-r17-linux-x86_64.zip package
2. supposing you extracted it on your $HOME: export NDK=$HOME/android-ndk-r17
3. make a stand alone NDK for you environment, in my case, arch ARM and API-level 24: $NDK/build/tools/make_standalone_toolchain.py --arch arm --api 24 --install-dir /tmp/my-android-toolchain
4. clone the MHD trunk: git clone https://gnunet.org/git/libmicrohttpd.git
5. build it: cd libmicrohttpd/ && ./configure --host=arm-linux-androideabi --enable-static=yes --enable-shared=no --enable-messages=yes --enable-https=no --enable-asserts=no --enable-coverage=no --disable-httpupgrade --disable-dauth --disable-doc --disable-curl && make CC=/tmp/my-android-toolchain/bin/arm-linux-androideabi-clang LD=/tmp/my-android-toolchain/bin/arm-linux-androideabi-ld LDFLAGS='-pie'
6. use adb to send the MHD's "minimal_example" example to your device (I'm using a Xiaome Redmi 5 + Android 7.1.2): adb push src/examples/minimal_example /data/local/tmp/
7. run it: adb shell /data/local/tmp/minimal_example 8080

If you use all steps above choosing to the current stable MHD 0.9.59 version the library and all examples compiles and works like a charm.
Additional InformationIt seems the error is related to the new added microhttpd2's macros MHD_NONNULL, __THROW etc.
TagsNo tags attached.
Attached Files

-Relationships Relation Graph ] Dependency Graph ]
+Relationships

-Notes

~0013400

Christian Grothoff (manager)

I just tried this, albeit with NDK r18b. No problems, clean build:

/bin/bash ../../libtool --tag=CC --mode=link /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -g -O0 -Wall -fno-strict-aliasing -pie -o authorization_example authorization_example.o ../../src/microhttpd/libmicrohttpd.la
libtool: link: /tmp/my-android-toolchain/bin/arm-linux-androideabi-clang -g -O0 -Wall -fno-strict-aliasing -pie -o authorization_example authorization_example.o ../../src/microhttpd/.libs/libmicrohttpd.a -pthread

~0013401

silvioprog (developer)

Awesome and thanks for sharing. I'm going to test it using r18b ...

~0013402

silvioprog (developer)

Reopening to comment (Mantis doesn't allow to comment a resolved issue :/ ). It's OK in r17 and r18. Thanks a lot for fixing! :-)
+Notes

-Issue History
Date Modified Username Field Change
2018-05-21 03:54 silvioprog New Issue
2018-05-21 03:56 silvioprog Steps to Reproduce Updated View Revisions
2018-05-21 21:37 silvioprog Assigned To => silvioprog
2018-05-21 21:37 silvioprog Status new => assigned
2018-12-07 08:38 Christian Grothoff Assigned To silvioprog => Christian Grothoff
2018-12-08 22:55 Christian Grothoff Target Version current SVN => 0.9.62
2018-12-08 23:06 Christian Grothoff Note Added: 0013400
2018-12-08 23:06 Christian Grothoff Assigned To Christian Grothoff => silvioprog
2018-12-08 23:06 Christian Grothoff Status assigned => feedback
2018-12-09 02:42 silvioprog Note Added: 0013401
2018-12-09 03:05 silvioprog Status feedback => resolved
2018-12-09 03:05 silvioprog Resolution open => fixed
2018-12-09 03:07 silvioprog Status resolved => feedback
2018-12-09 03:07 silvioprog Resolution fixed => reopened
2018-12-09 03:07 silvioprog Note Added: 0013402
2018-12-09 03:07 silvioprog Status feedback => resolved
2018-12-09 03:07 silvioprog Resolution reopened => fixed
2018-12-11 09:46 Christian Grothoff Status resolved => closed
2018-12-11 09:46 Christian Grothoff Resolution fixed => no change required
2018-12-11 09:46 Christian Grothoff Fixed in Version => 0.9.62
+Issue History