Message ID | 20190404153904.69693-1-giulio.benetti@micronovasrl.com |
---|---|
State | Superseded |
Headers | show |
Series | package/android-tools: fix static build failure due to missing -latomic | expand |
Hello Giulio, On Thu, 4 Apr 2019 17:39:04 +0200 Giulio Benetti <giulio.benetti@micronovasrl.com> wrote: > +# Uses __atomic_fetch_add_4. In adbd.mk Makefile there is no hunk to the end of > +# linking command. So need to add -latomic to LIBS using sed to provide > +# -latomic at the correct place in the linking command. > +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) > +define ANDROID_TOOLS_FIX_MAKEFILE > + $(SED) 's/-lz -lcrypt/-lz -lcrypt -latomic/' $(@D)/debian/makefiles/adbd.mk > +endef > +ANDROID_TOOLS_POST_PATCH_HOOKS = ANDROID_TOOLS_FIX_MAKEFILE > +endif Instead of this, please do regular patch on adbd.mk that does this: -LIBS+= -lc -lpthread -lz -lcrypto -lcrypt `pkg-config --libs glib-2.0 gio-2.0` +LIBS+= -lc -lpthread -lz `pkg-config --libs libcrypto` -lcrypt `pkg-config --libs glib-2.0 gio-2.0` and that's it. Also, adding host-pkgconf to ANDROID_TOOLS_DEPENDENCIES when adbd is selected would be necessary (but it should already be needed anyway, as pkg-config is already used to detect glib). Thanks! Thomas
Hello Thomas, Il 05/04/2019 00:32, Giulio Benetti ha scritto: > Hello > > Il 04/04/2019 22:45, Thomas Petazzoni ha scritto: >> Hello Giulio, >> >> On Thu, 4 Apr 2019 17:39:04 +0200 >> Giulio Benetti <giulio.benetti@micronovasrl.com> wrote: >> >>> +# Uses __atomic_fetch_add_4. In adbd.mk Makefile there is no hunk to the end of >>> +# linking command. So need to add -latomic to LIBS using sed to provide >>> +# -latomic at the correct place in the linking command. >>> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) >>> +define ANDROID_TOOLS_FIX_MAKEFILE >>> + $(SED) 's/-lz -lcrypt/-lz -lcrypt -latomic/' $(@D)/debian/makefiles/adbd.mk >>> +endef >>> +ANDROID_TOOLS_POST_PATCH_HOOKS = ANDROID_TOOLS_FIX_MAKEFILE >>> +endif >> >> Instead of this, please do regular patch on adbd.mk that does this: >> >> -LIBS+= -lc -lpthread -lz -lcrypto -lcrypt `pkg-config --libs glib-2.0 gio-2.0` In current version there is not glib-2.0 or gio-2.0, do I add them anyway as follows? >> +LIBS+= -lc -lpthread -lz `pkg-config --libs libcrypto` -lcrypt `pkg-config --libs glib-2.0 gio-2.0` >> >> and that's it. >> >> Also, adding host-pkgconf to ANDROID_TOOLS_DEPENDENCIES when adbd is >> selected would be necessary (but it should already be needed anyway, as >> pkg-config is already used to detect glib). Sure, I've checked it's needed otherwise my distro's pkgconfig will be used(checked it to understand how it works). Thanks
Hello Giulio, On Sun, 7 Apr 2019 23:55:38 +0200 Giulio Benetti <giulio.benetti@micronovasrl.com> wrote: > >> -LIBS+= -lc -lpthread -lz -lcrypto -lcrypt `pkg-config --libs glib-2.0 gio-2.0` > > In current version there is not glib-2.0 or gio-2.0, do I add them > anyway as follows? Wow, I got confused about this. pkg-config is used for glib-2.0 and gio-2.0 in the upstream android-tools code, but we remove that in our 0002-Fix-adbd-for-non-Ubuntu-systems.patch patch. So of course, don't re-add those pkg-config calls for glib-2.0 and gio-2.0. However, use pkg-config for OpenSSL. This will also allow you to drop patch 0005-fix-static-link-zlib.patch, which was needed for the same reason: pkg-config is not used to find OpenSSL. Thanks! Thomas
Il 08/04/2019 09:18, Thomas Petazzoni ha scritto: > Hello Giulio, > > On Sun, 7 Apr 2019 23:55:38 +0200 > Giulio Benetti <giulio.benetti@micronovasrl.com> wrote: > >>>> -LIBS+= -lc -lpthread -lz -lcrypto -lcrypt `pkg-config --libs glib-2.0 gio-2.0` >> >> In current version there is not glib-2.0 or gio-2.0, do I add them >> anyway as follows? > > Wow, I got confused about this. pkg-config is used for glib-2.0 and > gio-2.0 in the upstream android-tools code, but we remove that in our > 0002-Fix-adbd-for-non-Ubuntu-systems.patch patch. > > So of course, don't re-add those pkg-config calls for glib-2.0 and gio-2.0. Ok > However, use pkg-config for OpenSSL. This will also allow you to drop > patch 0005-fix-static-link-zlib.patch, which was needed for the same > reason: pkg-config is not used to find OpenSSL. Oh yes. In this case, can I substitute "0005-fix-static-link-zlib.patch" with the new one I'm going to create? I mean "0005-...patch" ? Thanks
On Mon, 8 Apr 2019 09:43:53 +0200 Giulio Benetti <giulio.benetti@micronovasrl.com> wrote: > In this case, can I substitute "0005-fix-static-link-zlib.patch" with > the new one I'm going to create? I mean "0005-...patch" ? Yes, sure. Thomas
diff --git a/package/android-tools/android-tools.mk b/package/android-tools/android-tools.mk index 6f6ca7729b..cd06afa2c2 100644 --- a/package/android-tools/android-tools.mk +++ b/package/android-tools/android-tools.mk @@ -12,6 +12,16 @@ HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS = $(ANDROID_TOOLS_EXTRA_DOWNLOADS) ANDROID_TOOLS_LICENSE = Apache-2.0 ANDROID_TOOLS_LICENSE_FILES = debian/copyright +# Uses __atomic_fetch_add_4. In adbd.mk Makefile there is no hunk to the end of +# linking command. So need to add -latomic to LIBS using sed to provide +# -latomic at the correct place in the linking command. +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) +define ANDROID_TOOLS_FIX_MAKEFILE + $(SED) 's/-lz -lcrypt/-lz -lcrypt -latomic/' $(@D)/debian/makefiles/adbd.mk +endef +ANDROID_TOOLS_POST_PATCH_HOOKS = ANDROID_TOOLS_FIX_MAKEFILE +endif + # Extract the Debian tarball inside the sources define ANDROID_TOOLS_DEBIAN_EXTRACT $(call suitable-extractor,$(notdir $(ANDROID_TOOLS_EXTRA_DOWNLOADS))) \
During static linking build fails because -lcrypto doesn't inherit its dependency like -latomic. So need to fix Makefile before building. Add check in package recipe for TOOLCHAIN_HAS_LIBATOMIC. If toolchain has libatomic use sed to append -latomic at the end of libs list in adbd.mk makefile. Fixes: http://autobuild.buildroot.net/results/d75/d75a6cf99f58fb5f42abaf9d54cde28224bc44fb/ Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> --- package/android-tools/android-tools.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)