diff mbox series

[LEDE-DEV,1/5] tools/zlib: move zlib build to tools

Message ID 20180415225325.15797-1-hauke@hauke-m.de
State Superseded
Headers show
Series [LEDE-DEV,1/5] tools/zlib: move zlib build to tools | expand

Commit Message

Hauke Mehrtens April 15, 2018, 10:53 p.m. UTC
This allows us to link the other tools against our libz and we do not
need the system zlib any more.

Only the static linked library is copied to the staging directory so we
have a statically linked library on all systems and not only on Linux.
This also adds the new dependencies of the packages which are depending
on zlib.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/prereq-build.mk                         |  5 ----
 package/libs/zlib/Makefile                      |  2 --
 tools/Makefile                                  | 14 +++++----
 tools/lzma-old/Makefile                         |  2 ++
 tools/lzma-old/patches/120-add-cflags.patch     | 11 +++++++
 tools/make-ext4fs/Makefile                      |  8 +----
 tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++++++
 tools/squashfs4/Makefile                        |  2 +-
 tools/zlib/Makefile                             | 40 +++++++++++++++++++++++++
 9 files changed, 75 insertions(+), 20 deletions(-)
 create mode 100644 tools/lzma-old/patches/120-add-cflags.patch
 create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch
 create mode 100644 tools/zlib/Makefile

Comments

Lucian Cristian April 17, 2018, 5:16 p.m. UTC | #1
On 16.04.2018 01:53, Hauke Mehrtens wrote:
> This allows us to link the other tools against our libz and we do not
> need the system zlib any more.
>
> Only the static linked library is copied to the staging directory so we
> have a statically linked library on all systems and not only on Linux.
> This also adds the new dependencies of the packages which are depending
> on zlib.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   include/prereq-build.mk                         |  5 ----
>   package/libs/zlib/Makefile                      |  2 --
>   tools/Makefile                                  | 14 +++++----
>   tools/lzma-old/Makefile                         |  2 ++
>   tools/lzma-old/patches/120-add-cflags.patch     | 11 +++++++
>   tools/make-ext4fs/Makefile                      |  8 +----
>   tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++++++
>   tools/squashfs4/Makefile                        |  2 +-
>   tools/zlib/Makefile                             | 40 +++++++++++++++++++++++++
>   9 files changed, 75 insertions(+), 20 deletions(-)
>   create mode 100644 tools/lzma-old/patches/120-add-cflags.patch
>   create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch
>   create mode 100644 tools/zlib/Makefile
>
> diff --git a/include/prereq-build.mk b/include/prereq-build.mk
> index 6917716342..5b9a7e049d 100644
> --- a/include/prereq-build.mk
> +++ b/include/prereq-build.mk
> @@ -76,11 +76,6 @@ else
>     zlib_link_flags := -lz
>   endif
>   
> -$(eval $(call TestHostCommand,zlib, \
> -	Please install a static zlib. (Missing libz.a or zlib.h), \
> -	echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
> -		gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
> -
>   $(eval $(call TestHostCommand,perl-thread-queue, \
>   	Please install the Perl Thread::Queue module, \
>   	perl -MThread::Queue -e 1))
> diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
> index a7c61f7dd0..4a2a0e53b0 100644
> --- a/package/libs/zlib/Makefile
> +++ b/package/libs/zlib/Makefile
> @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
>   
>   PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
>   
> -include $(INCLUDE_DIR)/host-build.mk
>   include $(INCLUDE_DIR)/package.mk
>   include $(INCLUDE_DIR)/cmake.mk
>   
> @@ -95,6 +94,5 @@ define Package/zlib-dev/install
>   	  $(1)/usr/lib/pkgconfig/
>   endef
>   
> -$(eval $(call HostBuild))
>   $(eval $(call BuildPackage,zlib))
>   $(eval $(call BuildPackage,zlib-dev))
> diff --git a/tools/Makefile b/tools/Makefile
> index 50bd552d75..8dfab9892b 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -22,7 +22,7 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
>   endif
>   
>   tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat
> -tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs
> +tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs zlib
>   tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
>   tools-y += firmware-utils patch-image quilt padjffs2
>   tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf
> @@ -43,16 +43,16 @@ $(curdir)/bison/compile := $(curdir)/flex/compile
>   $(curdir)/flex/compile := $(curdir)/libtool/compile
>   $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
>   $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
> -$(curdir)/squashfs4/compile := $(curdir)/xz/compile
> +$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
>   $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
>   $(curdir)/autoconf/compile := $(curdir)/m4/compile
>   $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile
>   $(curdir)/gmp/compile := $(curdir)/libtool/compile
>   $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
>   $(curdir)/mpfr/compile := $(curdir)/gmp/compile
> -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
> +$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
>   $(curdir)/mklibs/compile := $(curdir)/libtool/compile
> -$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
> +$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
>   $(curdir)/upslug2/compile := $(curdir)/libtool/compile
>   $(curdir)/mm-macros/compile := $(curdir)/libtool/compile
>   $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
> @@ -69,8 +69,12 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile
>   $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
>   $(curdir)/libressl/compile := $(curdir)/pkg-config/compile
>   $(curdir)/mkimage/compile += $(curdir)/libressl/compile
> -$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
> +$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile
>   $(curdir)/cmake/compile += $(curdir)/libressl/compile
> +$(curdir)/zlib/compile := $(curdir)/cmake/compile
> +$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile
> +$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
> +$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
>   
>   ifneq ($(HOST_OS),Linux)
>     tools-y += coreutils
> diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile
> index 5982eab5db..5204127a80 100644
> --- a/tools/lzma-old/Makefile
> +++ b/tools/lzma-old/Makefile
> @@ -21,7 +21,9 @@ LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib
>   ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone
>   
>   define Host/Compile
> +	+$(HOST_MAKE_VARS) \
>   	$(MAKE) -C $(LIB_DIR)
> +	+$(HOST_MAKE_VARS) \
>   	$(MAKE) -f makefile.gcc -C $(ALONE_DIR)
>   endef
>   
> diff --git a/tools/lzma-old/patches/120-add-cflags.patch b/tools/lzma-old/patches/120-add-cflags.patch
> new file mode 100644
> index 0000000000..9022e7cd27
> --- /dev/null
> +++ b/tools/lzma-old/patches/120-add-cflags.patch
> @@ -0,0 +1,11 @@
> +--- a/C/7zip/Compress/LZMA_Lib/makefile
> ++++ b/C/7zip/Compress/LZMA_Lib/makefile
> +@@ -2,7 +2,7 @@ PROG = liblzma.a
> + CXX = g++ -O3 -Wall
> + AR = ar
> + RM = rm -f
> +-CFLAGS = -c  -I ../../../
> ++CFLAGS += -c  -I ../../../
> +
> + OBJS = \
> +   ZLib.o \
> diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile
> index f140101c8e..97f9e6369c 100644
> --- a/tools/make-ext4fs/Makefile
> +++ b/tools/make-ext4fs/Makefile
> @@ -17,13 +17,7 @@ PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507
>   
>   include $(INCLUDE_DIR)/host-build.mk
>   
> -ifeq ($(HOST_OS),Linux)
> - MAKE_STATIC := STATIC=1
> -endif
> -
> -define Host/Compile
> -	$(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC)
> -endef
> +HOST_MAKE_FLAGS += STATIC=1
>   
>   define Host/Install
>   	$(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs $(STAGING_DIR_HOST)/bin/
> diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch b/tools/make-ext4fs/patches/100-add-ldflags.patch
> new file mode 100644
> index 0000000000..d9ce47bb80
> --- /dev/null
> +++ b/tools/make-ext4fs/patches/100-add-ldflags.patch
> @@ -0,0 +1,11 @@
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -27,7 +27,7 @@ OBJ := \
> + 	$(CC) $(CFLAGS) -c -o $@ $^
> +
> + make_ext4fs: $(OBJ) libsparse/libsparse.a
> +-	$(CC) -o $@ $^ $(ZLIB)
> ++	$(CC) $(LDFLAGS)-o $@ $^ $(ZLIB)
> +
> + libsparse/libsparse.a:
> + 	$(MAKE) -C libsparse/ libsparse.a
> diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile
> index e9e2b7ca9a..409b1b5a23 100644
> --- a/tools/squashfs4/Makefile
> +++ b/tools/squashfs4/Makefile
> @@ -20,8 +20,8 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION)
>   include $(INCLUDE_DIR)/host-build.mk
>   
>   define Host/Compile
> +	+$(HOST_MAKE_VARS) \
>   	$(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \
> -		CC="$(HOSTCC)" \
>   		XZ_SUPPORT=1 \
>   		LZMA_XZ_SUPPORT=1 \
>   		XATTR_SUPPORT= \
> diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> new file mode 100644
> index 0000000000..2746d95b72
> --- /dev/null
> +++ b/tools/zlib/Makefile
> @@ -0,0 +1,40 @@
> +#
> +# Copyright (C) 2006-2013 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=zlib
> +PKG_VERSION:=1.2.11
> +PKG_RELEASE:=1
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
> +PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
> +PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
> +
> +PKG_LICENSE:=Zlib
> +PKG_LICENSE_FILES:=README
> +PKG_CPE_ID:=cpe:/a:gnu:zlib
> +
> +include $(INCLUDE_DIR)/host-build.mk
> +include $(INCLUDE_DIR)/cmake.mk
> +
> +
> +define Host/Install
> +	$(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/
> +	$(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/
> +	$(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/
> +	$(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
> +endef
> +
> +define Host/Clean
> +	rm -f $(STAGING_DIR_HOST)/lib/libz.a
> +	rm -f $(STAGING_DIR_HOST)/include/zconf.h
> +	rm -f $(STAGING_DIR_HOST)/include/zlib.h
> +	rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc
> +endef
> +
> +$(eval $(call HostBuild))

I tested the patch series because I have a linking problem with zlib and 
python an I wanted to see if this fixes it (it does not) but on i686 I 
have this error


make[8]: Entering directory 
'/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
   CCLD     libgio-2.0.la
/usr/bin/ld: /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o): 
relocation R_X86_64_PC32 against symbol `_length_code' can not be used 
when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:2183: recipe for target 'libgio-2.0.la' failed
Koen Vandeputte April 17, 2018, 10:24 p.m. UTC | #2
On 17-04-18 19:16, Lucian Cristian wrote:
> On 16.04.2018 01:53, Hauke Mehrtens wrote:
>> This allows us to link the other tools against our libz and we do not
>> need the system zlib any more.
>>
>> Only the static linked library is copied to the staging directory so we
>> have a statically linked library on all systems and not only on Linux.
>> This also adds the new dependencies of the packages which are depending
>> on zlib.
>>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>   include/prereq-build.mk                         |  5 ----
>>   package/libs/zlib/Makefile                      |  2 --
>>   tools/Makefile                                  | 14 +++++----
>>   tools/lzma-old/Makefile                         |  2 ++
>>   tools/lzma-old/patches/120-add-cflags.patch     | 11 +++++++
>>   tools/make-ext4fs/Makefile                      |  8 +----
>>   tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++++++
>>   tools/squashfs4/Makefile                        |  2 +-
>>   tools/zlib/Makefile                             | 40 
>> +++++++++++++++++++++++++
>>   9 files changed, 75 insertions(+), 20 deletions(-)
>>   create mode 100644 tools/lzma-old/patches/120-add-cflags.patch
>>   create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch
>>   create mode 100644 tools/zlib/Makefile
>>
>> diff --git a/include/prereq-build.mk b/include/prereq-build.mk
>> index 6917716342..5b9a7e049d 100644
>> --- a/include/prereq-build.mk
>> +++ b/include/prereq-build.mk
>> @@ -76,11 +76,6 @@ else
>>     zlib_link_flags := -lz
>>   endif
>>   -$(eval $(call TestHostCommand,zlib, \
>> -    Please install a static zlib. (Missing libz.a or zlib.h), \
>> -    echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 
>> 0; }' | \
>> -        gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - 
>> $(zlib_link_flags)))
>> -
>>   $(eval $(call TestHostCommand,perl-thread-queue, \
>>       Please install the Perl Thread::Queue module, \
>>       perl -MThread::Queue -e 1))
>> diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
>> index a7c61f7dd0..4a2a0e53b0 100644
>> --- a/package/libs/zlib/Makefile
>> +++ b/package/libs/zlib/Makefile
>> @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
>>     PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
>>   -include $(INCLUDE_DIR)/host-build.mk
>>   include $(INCLUDE_DIR)/package.mk
>>   include $(INCLUDE_DIR)/cmake.mk
>>   @@ -95,6 +94,5 @@ define Package/zlib-dev/install
>>         $(1)/usr/lib/pkgconfig/
>>   endef
>>   -$(eval $(call HostBuild))
>>   $(eval $(call BuildPackage,zlib))
>>   $(eval $(call BuildPackage,zlib-dev))
>> diff --git a/tools/Makefile b/tools/Makefile
>> index 50bd552d75..8dfab9892b 100644
>> --- a/tools/Makefile
>> +++ b/tools/Makefile
>> @@ -22,7 +22,7 @@ ifneq 
>> ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
>>   endif
>>     tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat
>> -tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs
>> +tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs 
>> zlib
>>   tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
>>   tools-y += firmware-utils patch-image quilt padjffs2
>>   tools-y += mm-macros missing-macros cmake scons bc findutils 
>> gengetopt patchelf
>> @@ -43,16 +43,16 @@ $(curdir)/bison/compile := $(curdir)/flex/compile
>>   $(curdir)/flex/compile := $(curdir)/libtool/compile
>>   $(curdir)/libtool/compile := $(curdir)/m4/compile 
>> $(curdir)/autoconf/compile $(curdir)/automake/compile 
>> $(curdir)/missing-macros/compile
>>   $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
>> -$(curdir)/squashfs4/compile := $(curdir)/xz/compile
>> +$(curdir)/squashfs4/compile := $(curdir)/xz/compile 
>> $(curdir)/zlib/compile
>>   $(curdir)/quilt/compile := $(curdir)/autoconf/compile 
>> $(curdir)/findutils/compile
>>   $(curdir)/autoconf/compile := $(curdir)/m4/compile
>>   $(curdir)/automake/compile := $(curdir)/m4/compile 
>> $(curdir)/autoconf/compile $(curdir)/pkg-config/compile 
>> $(curdir)/xz/compile
>>   $(curdir)/gmp/compile := $(curdir)/libtool/compile
>>   $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
>>   $(curdir)/mpfr/compile := $(curdir)/gmp/compile
>> -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
>> +$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile 
>> $(curdir)/zlib/compile
>>   $(curdir)/mklibs/compile := $(curdir)/libtool/compile
>> -$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
>> +$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile 
>> $(curdir)/zlib/compile
>>   $(curdir)/upslug2/compile := $(curdir)/libtool/compile
>>   $(curdir)/mm-macros/compile := $(curdir)/libtool/compile
>>   $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
>> @@ -69,8 +69,12 @@ $(curdir)/patchelf/compile := 
>> $(curdir)/libtool/compile
>>   $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile 
>> $(curdir)/automake/compile
>>   $(curdir)/libressl/compile := $(curdir)/pkg-config/compile
>>   $(curdir)/mkimage/compile += $(curdir)/libressl/compile
>> -$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
>> +$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile 
>> $(curdir)/zlib/compile
>>   $(curdir)/cmake/compile += $(curdir)/libressl/compile
>> +$(curdir)/zlib/compile := $(curdir)/cmake/compile
>> +$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile
>> +$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
>> +$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
>>     ifneq ($(HOST_OS),Linux)
>>     tools-y += coreutils
>> diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile
>> index 5982eab5db..5204127a80 100644
>> --- a/tools/lzma-old/Makefile
>> +++ b/tools/lzma-old/Makefile
>> @@ -21,7 +21,9 @@ LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib
>>   ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone
>>     define Host/Compile
>> +    +$(HOST_MAKE_VARS) \
>>       $(MAKE) -C $(LIB_DIR)
>> +    +$(HOST_MAKE_VARS) \
>>       $(MAKE) -f makefile.gcc -C $(ALONE_DIR)
>>   endef
>>   diff --git a/tools/lzma-old/patches/120-add-cflags.patch 
>> b/tools/lzma-old/patches/120-add-cflags.patch
>> new file mode 100644
>> index 0000000000..9022e7cd27
>> --- /dev/null
>> +++ b/tools/lzma-old/patches/120-add-cflags.patch
>> @@ -0,0 +1,11 @@
>> +--- a/C/7zip/Compress/LZMA_Lib/makefile
>> ++++ b/C/7zip/Compress/LZMA_Lib/makefile
>> +@@ -2,7 +2,7 @@ PROG = liblzma.a
>> + CXX = g++ -O3 -Wall
>> + AR = ar
>> + RM = rm -f
>> +-CFLAGS = -c  -I ../../../
>> ++CFLAGS += -c  -I ../../../
>> +
>> + OBJS = \
>> +   ZLib.o \
>> diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile
>> index f140101c8e..97f9e6369c 100644
>> --- a/tools/make-ext4fs/Makefile
>> +++ b/tools/make-ext4fs/Makefile
>> @@ -17,13 +17,7 @@ 
>> PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507
>>     include $(INCLUDE_DIR)/host-build.mk
>>   -ifeq ($(HOST_OS),Linux)
>> - MAKE_STATIC := STATIC=1
>> -endif
>> -
>> -define Host/Compile
>> -    $(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC)
>> -endef
>> +HOST_MAKE_FLAGS += STATIC=1
>>     define Host/Install
>>       $(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs 
>> $(STAGING_DIR_HOST)/bin/
>> diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch 
>> b/tools/make-ext4fs/patches/100-add-ldflags.patch
>> new file mode 100644
>> index 0000000000..d9ce47bb80
>> --- /dev/null
>> +++ b/tools/make-ext4fs/patches/100-add-ldflags.patch
>> @@ -0,0 +1,11 @@
>> +--- a/Makefile
>> ++++ b/Makefile
>> +@@ -27,7 +27,7 @@ OBJ := \
>> +     $(CC) $(CFLAGS) -c -o $@ $^
>> +
>> + make_ext4fs: $(OBJ) libsparse/libsparse.a
>> +-    $(CC) -o $@ $^ $(ZLIB)
>> ++    $(CC) $(LDFLAGS)-o $@ $^ $(ZLIB)
>> +
>> + libsparse/libsparse.a:
>> +     $(MAKE) -C libsparse/ libsparse.a
>> diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile
>> index e9e2b7ca9a..409b1b5a23 100644
>> --- a/tools/squashfs4/Makefile
>> +++ b/tools/squashfs4/Makefile
>> @@ -20,8 +20,8 @@ 
>> HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION)
>>   include $(INCLUDE_DIR)/host-build.mk
>>     define Host/Compile
>> +    +$(HOST_MAKE_VARS) \
>>       $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \
>> -        CC="$(HOSTCC)" \
>>           XZ_SUPPORT=1 \
>>           LZMA_XZ_SUPPORT=1 \
>>           XATTR_SUPPORT= \
>> diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
>> new file mode 100644
>> index 0000000000..2746d95b72
>> --- /dev/null
>> +++ b/tools/zlib/Makefile
>> @@ -0,0 +1,40 @@
>> +#
>> +# Copyright (C) 2006-2013 OpenWrt.org
>> +#
>> +# This is free software, licensed under the GNU General Public 
>> License v2.
>> +# See /LICENSE for more information.
>> +#
>> +
>> +include $(TOPDIR)/rules.mk
>> +
>> +PKG_NAME:=zlib
>> +PKG_VERSION:=1.2.11
>> +PKG_RELEASE:=1
>> +
>> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>> +PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
>> +PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066 
>>
>> +
>> +PKG_LICENSE:=Zlib
>> +PKG_LICENSE_FILES:=README
>> +PKG_CPE_ID:=cpe:/a:gnu:zlib
>> +
>> +include $(INCLUDE_DIR)/host-build.mk
>> +include $(INCLUDE_DIR)/cmake.mk
>> +
>> +
>> +define Host/Install
>> +    $(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/
>> +    $(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/
>> +    $(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/
>> +    $(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
>> +endef
>> +
>> +define Host/Clean
>> +    rm -f $(STAGING_DIR_HOST)/lib/libz.a
>> +    rm -f $(STAGING_DIR_HOST)/include/zconf.h
>> +    rm -f $(STAGING_DIR_HOST)/include/zlib.h
>> +    rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc
>> +endef
>> +
>> +$(eval $(call HostBuild))
>
> I tested the patch series because I have a linking problem with zlib 
> and python an I wanted to see if this fixes it (it does not) but on 
> i686 I have this error
>
>
> make[8]: Entering directory 
> '/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
>   CCLD     libgio-2.0.la
> /usr/bin/ld: /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o): 
> relocation R_X86_64_PC32 against symbol `_length_code' can not be used 
> when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
> Makefile:2183: recipe for target 'libgio-2.0.la' failed
>
>
Hi Hauke,

Probably related to the above?

When I'm building using this patch series, I'm getting a python build error.
Please see attached logfile.
Reverting the series fixes the build issue.


Do note that I'm also using my own config, which adds all feeds and uses 
a lot more packages than default OpenWrt.

Thanks,

Koen
/usr/bin/install -c -m 644 ./Include/setobject.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/sliceobject.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/stringobject.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/structmember.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/structseq.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/symtable.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/sysmodule.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/timefuncs.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/token.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/traceback.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/tupleobject.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/ucnhash.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/unicodeobject.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/warnings.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 ./Include/weakrefobject.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7
/usr/bin/install -c -m 644 pyconfig.h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include/python2.7/pyconfig.h
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python2.7," < ./Misc/python-config.in >python-config
/usr/bin/install -c -m 644 Modules/config.c /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/config.c
/usr/bin/install -c -m 644 Modules/python.o /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/python.o
/usr/bin/install -c -m 644 ./Modules/config.c.in /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/config.c.in
/usr/bin/install -c -m 644 Makefile /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/Makefile
/usr/bin/install -c -m 644 Modules/Setup /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/Setup
/usr/bin/install -c -m 644 Modules/Setup.local /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/Setup.local
/usr/bin/install -c -m 644 Modules/Setup.config /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/Setup.config
/usr/bin/install -c -m 644 Misc/python.pc /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig/python-2.7.pc
/usr/bin/install -c ./Modules/makesetup /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/makesetup
/usr/bin/install -c ./install-sh /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/config/install-sh
/usr/bin/install -c python-config /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python2.7-config
rm python-config
./python -E ./setup.py install \
   	--prefix=/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg \
	--install-scripts=/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin \
	--install-platlib=/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload \
	--root=/
running install
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building 'crypt' extension
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/cryptmodule.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/cryptmodule.o
ccache gcc -pthread -shared -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/cryptmodule.o -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -o build/lib.linux-x86_64-2.7/crypt.so
*** WARNING: renaming "crypt" since importing it failed: build/lib.linux-x86_64-2.7/crypt.so: undefined symbol: crypt
building '_ssl' extension
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.o
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:141:12: error: static declaration of 'X509_NAME_ENTRY_set' follows non-static declaration
 static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
            ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:66:0:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509.h:1139:6: note: previous declaration of 'X509_NAME_ENTRY_set' was here
 int  X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne);
      ^
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:153:25: error: static declaration of 'SSL_CTX_get_default_passwd_cb' follows non-static declaration
 static pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx)
                         ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:69:0:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/ssl.h:1368:18: note: previous declaration of 'SSL_CTX_get_default_passwd_cb' was here
 pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx);
                  ^
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:158:14: error: static declaration of 'SSL_CTX_get_default_passwd_cb_userdata' follows non-static declaration
 static void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx)
              ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:69:0:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/ssl.h:1370:7: note: previous declaration of 'SSL_CTX_get_default_passwd_cb_userdata' was here
 void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx);
       ^
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:163:12: error: conflicting types for 'X509_OBJECT_get_type'
 static int X509_OBJECT_get_type(X509_OBJECT *x)
            ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509.h:595:0,
                 from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:66:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509_vfy.h:428:5: note: previous declaration of 'X509_OBJECT_get_type' was here
 int X509_OBJECT_get_type(const X509_OBJECT *a);
     ^
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:168:14: error: conflicting types for 'X509_OBJECT_get0_X509'
 static X509 *X509_OBJECT_get0_X509(X509_OBJECT *x)
              ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509.h:595:0,
                 from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:66:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509_vfy.h:430:7: note: previous declaration of 'X509_OBJECT_get0_X509' was here
 X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo);
       ^
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:173:31: error: static declaration of 'X509_STORE_get0_objects' follows non-static declaration
 static STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *store) {
                               ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509.h:595:0,
                 from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:66:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509_vfy.h:438:24: note: previous declaration of 'X509_STORE_get0_objects' was here
 STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *xs);
                        ^
/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:177:27: error: static declaration of 'X509_STORE_get0_param' follows non-static declaration
 static X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *store)
                           ^
In file included from /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509.h:595:0,
                 from /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_ssl.c:66:
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include/openssl/x509_vfy.h:450:20: note: previous declaration of 'X509_STORE_get0_param' was here
 X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx);
                    ^
building 'nis' extension
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/nismodule.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/nismodule.o
ccache gcc -pthread -shared -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/nismodule.o -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -o build/lib.linux-x86_64-2.7/nis.so
*** WARNING: renaming "nis" since importing it failed: build/lib.linux-x86_64-2.7/nis.so: undefined symbol: yp_master
building 'binascii' extension
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/binascii.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/binascii.o -DUSE_ZLIB_CRC32
ccache gcc -pthread -shared -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/binascii.o -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lz -o build/lib.linux-x86_64-2.7/binascii.so
/usr/bin/ld: /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib/libz.a(crc32.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
building '_multiprocessing' extension
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IModules/_multiprocessing -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/multiprocessing.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/multiprocessing.o
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IModules/_multiprocessing -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/socket_connection.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/socket_connection.o
ccache gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IModules/_multiprocessing -I. -IInclude -I./Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14 -c /mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/semaphore.c -o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/semaphore.o
ccache gcc -pthread -shared -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -fno-strict-aliasing -O2 -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/include -I/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/host/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/multiprocessing.o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/socket_connection.o build/temp.linux-x86_64-2.7/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Modules/_multiprocessing/semaphore.o -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib -L/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib -o build/lib.linux-x86_64-2.7/_multiprocessing.so
*** WARNING: renaming "_multiprocessing" since importing it failed: No module named binascii

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _curses            _curses_panel   
_sqlite3           _tkinter           bsddb185        
dbm                dl                 gdbm            
imageop            readline           sunaudiodev     
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_multiprocessing   _ssl               binascii        
crypt              nis                                

running build_scripts
running install_lib
copying build/lib.linux-x86_64-2.7/_multiprocessing_failed.so -> /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload
copying build/lib.linux-x86_64-2.7/nis_failed.so -> /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload
copying build/lib.linux-x86_64-2.7/crypt_failed.so -> /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload
copying build/lib.linux-x86_64-2.7/_sysconfigdata.py -> /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_multiprocessing_failed.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/nis_failed.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/crypt_failed.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_ctypes.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/ossaudiodev.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/linuxaudiodev.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_codecs_iso2022.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_codecs_hk.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_codecs_tw.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_codecs_cn.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_codecs_jp.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_codecs_kr.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_multibytecodec.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_elementtree.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/pyexpat.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/bz2.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/resource.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/termios.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_hashlib.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_socket.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_csv.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/audioop.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/syslog.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/mmap.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/cPickle.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/cStringIO.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/parser.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/select.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/spwd.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/grp.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/fcntl.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_locale.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/unicodedata.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_lsprof.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_hotshot.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_testcapi.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_json.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_functools.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_io.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/operator.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_heapq.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_bisect.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_collections.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_random.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/future_builtins.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/itertools.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/datetime.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/time.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/strop.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/math.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/cmath.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/array.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_ctypes_test.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_struct.so to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_sysconfigdata.py to 644
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/ to 755
running install_scripts
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/smtpd.py to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/2to3 to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/idle to 755
changing mode of /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/pydoc to 755
running install_egg_info
Removing /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/Python-2.7.14-py2.7.egg-info
Writing /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/Python-2.7.14-py2.7.egg-info
rm /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/python2.7/lib-dynload/_sysconfigdata.py*
/usr/bin/install -c -m 644 ./Misc/python.man \
	/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/share/man/man1/python2.7.1
if test ! -d /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig; then \
	echo "Creating directory /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig"; \
	/usr/bin/install -c -d -m 755 /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig; \
fi
if test -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python -o -h /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python; \
then rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python; \
else true; \
fi
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin; ln -s python2 python)
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python2
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin; ln -s python2.7 python2)
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python2-config
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin; ln -s python2.7-config python2-config)
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin/python-config
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/bin; ln -s python2-config python-config)
test -d /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig || /usr/bin/install -c -d -m 755 /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig/python2.pc
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig; ln -s python-2.7.pc python2.pc)
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig/python.pc
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/lib/pkgconfig; ln -s python2.pc python.pc)
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/share/man/man1/python2.1
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/share/man/man1; ln -s python2.7.1 python2.1)
rm -f /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/share/man/man1/python.1
(cd /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/share/man/man1; ln -s python2.1 python.1)
if test "xinstall" != "xno"  ; then \
	case install in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Traceback (most recent call last):
  File "/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Lib/runpy.py", line 163, in _run_module_as_main
    mod_name, _Error)
  File "/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Lib/runpy.py", line 111, in _get_module_details
    __import__(mod_name)  # Do not catch exceptions initializing package
  File "/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Lib/ensurepip/__init__.py", line 9, in <module>
    import tempfile
  File "/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Lib/tempfile.py", line 35, in <module>
    from random import Random as _Random
  File "/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14/Lib/random.py", line 48, in <module>
    from binascii import hexlify as _hexlify
ImportError: No module named binascii
Makefile:932: recipe for target 'install' failed
make[4]: *** [install] Error 1
make[4]: Leaving directory '/mnt/ramdisk/test/firmware/builds/generic_imx6/build_dir/hostpkg/Python-2.7.14'
Makefile:298: recipe for target '/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/stamp/.python_installed' failed
make[3]: *** [/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/hostpkg/stamp/.python_installed] Error 2
make[3]: Leaving directory '/mnt/ramdisk/test/firmware/builds/generic_imx6/feeds/packages/lang/python/python'
package/Makefile:107: recipe for target 'package/feeds/packages/python/host/compile' failed
make[2]: *** [package/feeds/packages/python/host/compile] Error 2
make[2]: Leaving directory '/mnt/ramdisk/test/firmware/builds/generic_imx6'
package/Makefile:103: recipe for target '/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/stamp/.package_compile' failed
make[1]: *** [/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/target-arm_cortex-a9+neon_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/mnt/ramdisk/test/firmware/builds/generic_imx6'
/mnt/ramdisk/test/firmware/builds/generic_imx6/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2
koen@bob:~/firmware/builds/generic_imx6$
Lucian Cristian April 18, 2018, 7:44 a.m. UTC | #3
On 18.04.2018 01:24, Koen Vandeputte wrote:
>
>
> On 17-04-18 19:16, Lucian Cristian wrote:
>> On 16.04.2018 01:53, Hauke Mehrtens wrote:
>>> This allows us to link the other tools against our libz and we do not
>>> need the system zlib any more.
>>>
[...]
>>> +endef
>>> +
>>> +$(eval $(call HostBuild))
>>
>> I tested the patch series because I have a linking problem with zlib 
>> and python an I wanted to see if this fixes it (it does not) but on 
>> i686 I have this error
>>
>>
>> make[8]: Entering directory 
>> '/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
>>   CCLD     libgio-2.0.la
>> /usr/bin/ld: 
>> /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o): relocation 
>> R_X86_64_PC32 against symbol `_length_code' can not be used when 
>> making a shared object; recompile with -fPIC
>> /usr/bin/ld: final link failed: Bad value
>> collect2: error: ld returned 1 exit status
>> Makefile:2183: recipe for target 'libgio-2.0.la' failed
>>
>>
> Hi Hauke,
>
> Probably related to the above?
>
> When I'm building using this patch series, I'm getting a python build 
> error.
> Please see attached logfile.
> Reverting the series fixes the build issue.
>
>
> Do note that I'm also using my own config, which adds all feeds and 
> uses a lot more packages than default OpenWrt.
>
> Thanks,
>
> Koen

/usr/bin/ld: /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib/libz.a(crc32.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

I looked in Makefile and there is TARGET_CFLAGS += $(FPIC) so it means 
it should already have -fPIC ?


Regards
Hauke Mehrtens April 19, 2018, 10:13 p.m. UTC | #4
On 04/18/2018 09:44 AM, Lucian Cristian wrote:
> On 18.04.2018 01:24, Koen Vandeputte wrote:
>>
>>
>> On 17-04-18 19:16, Lucian Cristian wrote:
>>> On 16.04.2018 01:53, Hauke Mehrtens wrote:
>>>> This allows us to link the other tools against our libz and we do not
>>>> need the system zlib any more.
>>>>
> [...]
>>>> +endef
>>>> +
>>>> +$(eval $(call HostBuild))
>>>
>>> I tested the patch series because I have a linking problem with zlib
>>> and python an I wanted to see if this fixes it (it does not) but on
>>> i686 I have this error
>>>
>>>
>>> make[8]: Entering directory
>>> '/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
>>>   CCLD     libgio-2.0.la
>>> /usr/bin/ld:
>>> /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o): relocation
>>> R_X86_64_PC32 against symbol `_length_code' can not be used when
>>> making a shared object; recompile with -fPIC
>>> /usr/bin/ld: final link failed: Bad value
>>> collect2: error: ld returned 1 exit status
>>> Makefile:2183: recipe for target 'libgio-2.0.la' failed
>>>
>>>
>> Hi Hauke,
>>
>> Probably related to the above?
>>
>> When I'm building using this patch series, I'm getting a python build
>> error.
>> Please see attached logfile.
>> Reverting the series fixes the build issue.
>>
>>
>> Do note that I'm also using my own config, which adds all feeds and
>> uses a lot more packages than default OpenWrt.
>>
>> Thanks,
>>
>> Koen
> 
> /usr/bin/ld:
> /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib/libz.a(crc32.o):
> relocation R_X86_64_32S against `.rodata' can not be used when making a
> shared object; recompile with -fPIC
> /mnt/ramdisk/test/firmware/builds/generic_imx6/staging_dir/host/lib/libz.a:
> error adding symbols: Bad value
> collect2: error: ld returned 1 exit status
> 
> I looked in Makefile and there is TARGET_CFLAGS += $(FPIC) so it means
> it should already have -fPIC ?
> 

H,

I fixed the build error in glib2 by adding a -fPIC host cflag to the zlib.

Hauke
Hauke Mehrtens April 19, 2018, 10:15 p.m. UTC | #5
On 04/18/2018 12:24 AM, Koen Vandeputte wrote:
> 
> 
> On 17-04-18 19:16, Lucian Cristian wrote:
>> On 16.04.2018 01:53, Hauke Mehrtens wrote:
>>> This allows us to link the other tools against our libz and we do not
>>> need the system zlib any more.
>>>
>>> Only the static linked library is copied to the staging directory so we
>>> have a statically linked library on all systems and not only on Linux.
>>> This also adds the new dependencies of the packages which are depending
>>> on zlib.
>>>
>>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>>> ---
>>>   include/prereq-build.mk                         |  5 ----
>>>   package/libs/zlib/Makefile                      |  2 --
>>>   tools/Makefile                                  | 14 +++++----
>>>   tools/lzma-old/Makefile                         |  2 ++
>>>   tools/lzma-old/patches/120-add-cflags.patch     | 11 +++++++
>>>   tools/make-ext4fs/Makefile                      |  8 +----
>>>   tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++++++
>>>   tools/squashfs4/Makefile                        |  2 +-
>>>   tools/zlib/Makefile                             | 40
>>> +++++++++++++++++++++++++
>>>   9 files changed, 75 insertions(+), 20 deletions(-)
>>>   create mode 100644 tools/lzma-old/patches/120-add-cflags.patch
>>>   create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch
>>>   create mode 100644 tools/zlib/Makefile
>>>
>>> diff --git a/include/prereq-build.mk b/include/prereq-build.mk
>>> index 6917716342..5b9a7e049d 100644
>>> --- a/include/prereq-build.mk
>>> +++ b/include/prereq-build.mk
>>> @@ -76,11 +76,6 @@ else
>>>     zlib_link_flags := -lz
>>>   endif
>>>   -$(eval $(call TestHostCommand,zlib, \
>>> -    Please install a static zlib. (Missing libz.a or zlib.h), \
>>> -    echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return
>>> 0; }' | \
>>> -        gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -
>>> $(zlib_link_flags)))
>>> -
>>>   $(eval $(call TestHostCommand,perl-thread-queue, \
>>>       Please install the Perl Thread::Queue module, \
>>>       perl -MThread::Queue -e 1))
>>> diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
>>> index a7c61f7dd0..4a2a0e53b0 100644
>>> --- a/package/libs/zlib/Makefile
>>> +++ b/package/libs/zlib/Makefile
>>> @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
>>>     PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
>>>   -include $(INCLUDE_DIR)/host-build.mk
>>>   include $(INCLUDE_DIR)/package.mk
>>>   include $(INCLUDE_DIR)/cmake.mk
>>>   @@ -95,6 +94,5 @@ define Package/zlib-dev/install
>>>         $(1)/usr/lib/pkgconfig/
>>>   endef
>>>   -$(eval $(call HostBuild))
>>>   $(eval $(call BuildPackage,zlib))
>>>   $(eval $(call BuildPackage,zlib-dev))
>>> diff --git a/tools/Makefile b/tools/Makefile
>>> index 50bd552d75..8dfab9892b 100644
>>> --- a/tools/Makefile
>>> +++ b/tools/Makefile
>>> @@ -22,7 +22,7 @@ ifneq
>>> ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
>>>
>>>   endif
>>>     tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat
>>> -tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs
>>> +tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs
>>> zlib
>>>   tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
>>>   tools-y += firmware-utils patch-image quilt padjffs2
>>>   tools-y += mm-macros missing-macros cmake scons bc findutils
>>> gengetopt patchelf
>>> @@ -43,16 +43,16 @@ $(curdir)/bison/compile := $(curdir)/flex/compile
>>>   $(curdir)/flex/compile := $(curdir)/libtool/compile
>>>   $(curdir)/libtool/compile := $(curdir)/m4/compile
>>> $(curdir)/autoconf/compile $(curdir)/automake/compile
>>> $(curdir)/missing-macros/compile
>>>   $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
>>> -$(curdir)/squashfs4/compile := $(curdir)/xz/compile
>>> +$(curdir)/squashfs4/compile := $(curdir)/xz/compile
>>> $(curdir)/zlib/compile
>>>   $(curdir)/quilt/compile := $(curdir)/autoconf/compile
>>> $(curdir)/findutils/compile
>>>   $(curdir)/autoconf/compile := $(curdir)/m4/compile
>>>   $(curdir)/automake/compile := $(curdir)/m4/compile
>>> $(curdir)/autoconf/compile $(curdir)/pkg-config/compile
>>> $(curdir)/xz/compile
>>>   $(curdir)/gmp/compile := $(curdir)/libtool/compile
>>>   $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
>>>   $(curdir)/mpfr/compile := $(curdir)/gmp/compile
>>> -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
>>> +$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
>>> $(curdir)/zlib/compile
>>>   $(curdir)/mklibs/compile := $(curdir)/libtool/compile
>>> -$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
>>> +$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
>>> $(curdir)/zlib/compile
>>>   $(curdir)/upslug2/compile := $(curdir)/libtool/compile
>>>   $(curdir)/mm-macros/compile := $(curdir)/libtool/compile
>>>   $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
>>> @@ -69,8 +69,12 @@ $(curdir)/patchelf/compile :=
>>> $(curdir)/libtool/compile
>>>   $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile
>>> $(curdir)/automake/compile
>>>   $(curdir)/libressl/compile := $(curdir)/pkg-config/compile
>>>   $(curdir)/mkimage/compile += $(curdir)/libressl/compile
>>> -$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
>>> +$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
>>> $(curdir)/zlib/compile
>>>   $(curdir)/cmake/compile += $(curdir)/libressl/compile
>>> +$(curdir)/zlib/compile := $(curdir)/cmake/compile
>>> +$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile
>>> +$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
>>> +$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
>>>     ifneq ($(HOST_OS),Linux)
>>>     tools-y += coreutils
>>> diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile
>>> index 5982eab5db..5204127a80 100644
>>> --- a/tools/lzma-old/Makefile
>>> +++ b/tools/lzma-old/Makefile
>>> @@ -21,7 +21,9 @@ LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib
>>>   ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone
>>>     define Host/Compile
>>> +    +$(HOST_MAKE_VARS) \
>>>       $(MAKE) -C $(LIB_DIR)
>>> +    +$(HOST_MAKE_VARS) \
>>>       $(MAKE) -f makefile.gcc -C $(ALONE_DIR)
>>>   endef
>>>   diff --git a/tools/lzma-old/patches/120-add-cflags.patch
>>> b/tools/lzma-old/patches/120-add-cflags.patch
>>> new file mode 100644
>>> index 0000000000..9022e7cd27
>>> --- /dev/null
>>> +++ b/tools/lzma-old/patches/120-add-cflags.patch
>>> @@ -0,0 +1,11 @@
>>> +--- a/C/7zip/Compress/LZMA_Lib/makefile
>>> ++++ b/C/7zip/Compress/LZMA_Lib/makefile
>>> +@@ -2,7 +2,7 @@ PROG = liblzma.a
>>> + CXX = g++ -O3 -Wall
>>> + AR = ar
>>> + RM = rm -f
>>> +-CFLAGS = -c  -I ../../../
>>> ++CFLAGS += -c  -I ../../../
>>> +
>>> + OBJS = \
>>> +   ZLib.o \
>>> diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile
>>> index f140101c8e..97f9e6369c 100644
>>> --- a/tools/make-ext4fs/Makefile
>>> +++ b/tools/make-ext4fs/Makefile
>>> @@ -17,13 +17,7 @@
>>> PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507
>>>
>>>     include $(INCLUDE_DIR)/host-build.mk
>>>   -ifeq ($(HOST_OS),Linux)
>>> - MAKE_STATIC := STATIC=1
>>> -endif
>>> -
>>> -define Host/Compile
>>> -    $(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC)
>>> -endef
>>> +HOST_MAKE_FLAGS += STATIC=1
>>>     define Host/Install
>>>       $(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs
>>> $(STAGING_DIR_HOST)/bin/
>>> diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch
>>> b/tools/make-ext4fs/patches/100-add-ldflags.patch
>>> new file mode 100644
>>> index 0000000000..d9ce47bb80
>>> --- /dev/null
>>> +++ b/tools/make-ext4fs/patches/100-add-ldflags.patch
>>> @@ -0,0 +1,11 @@
>>> +--- a/Makefile
>>> ++++ b/Makefile
>>> +@@ -27,7 +27,7 @@ OBJ := \
>>> +     $(CC) $(CFLAGS) -c -o $@ $^
>>> +
>>> + make_ext4fs: $(OBJ) libsparse/libsparse.a
>>> +-    $(CC) -o $@ $^ $(ZLIB)
>>> ++    $(CC) $(LDFLAGS)-o $@ $^ $(ZLIB)
>>> +
>>> + libsparse/libsparse.a:
>>> +     $(MAKE) -C libsparse/ libsparse.a
>>> diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile
>>> index e9e2b7ca9a..409b1b5a23 100644
>>> --- a/tools/squashfs4/Makefile
>>> +++ b/tools/squashfs4/Makefile
>>> @@ -20,8 +20,8 @@
>>> HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION)
>>>   include $(INCLUDE_DIR)/host-build.mk
>>>     define Host/Compile
>>> +    +$(HOST_MAKE_VARS) \
>>>       $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \
>>> -        CC="$(HOSTCC)" \
>>>           XZ_SUPPORT=1 \
>>>           LZMA_XZ_SUPPORT=1 \
>>>           XATTR_SUPPORT= \
>>> diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
>>> new file mode 100644
>>> index 0000000000..2746d95b72
>>> --- /dev/null
>>> +++ b/tools/zlib/Makefile
>>> @@ -0,0 +1,40 @@
>>> +#
>>> +# Copyright (C) 2006-2013 OpenWrt.org
>>> +#
>>> +# This is free software, licensed under the GNU General Public
>>> License v2.
>>> +# See /LICENSE for more information.
>>> +#
>>> +
>>> +include $(TOPDIR)/rules.mk
>>> +
>>> +PKG_NAME:=zlib
>>> +PKG_VERSION:=1.2.11
>>> +PKG_RELEASE:=1
>>> +
>>> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>>> +PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
>>> +PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
>>>
>>> +
>>> +PKG_LICENSE:=Zlib
>>> +PKG_LICENSE_FILES:=README
>>> +PKG_CPE_ID:=cpe:/a:gnu:zlib
>>> +
>>> +include $(INCLUDE_DIR)/host-build.mk
>>> +include $(INCLUDE_DIR)/cmake.mk
>>> +
>>> +
>>> +define Host/Install
>>> +    $(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/
>>> +    $(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/
>>> +    $(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/
>>> +    $(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
>>> +endef
>>> +
>>> +define Host/Clean
>>> +    rm -f $(STAGING_DIR_HOST)/lib/libz.a
>>> +    rm -f $(STAGING_DIR_HOST)/include/zconf.h
>>> +    rm -f $(STAGING_DIR_HOST)/include/zlib.h
>>> +    rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc
>>> +endef
>>> +
>>> +$(eval $(call HostBuild))
>>
>> I tested the patch series because I have a linking problem with zlib
>> and python an I wanted to see if this fixes it (it does not) but on
>> i686 I have this error
>>
>>
>> make[8]: Entering directory
>> '/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
>>   CCLD     libgio-2.0.la
>> /usr/bin/ld: /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o):
>> relocation R_X86_64_PC32 against symbol `_length_code' can not be used
>> when making a shared object; recompile with -fPIC
>> /usr/bin/ld: final link failed: Bad value
>> collect2: error: ld returned 1 exit status
>> Makefile:2183: recipe for target 'libgio-2.0.la' failed
>>
>>
> Hi Hauke,
> 
> Probably related to the above?
> 
> When I'm building using this patch series, I'm getting a python build
> error.
> Please see attached logfile.
> Reverting the series fixes the build issue.
> 
> 
> Do note that I'm also using my own config, which adds all feeds and uses
> a lot more packages than default OpenWrt.
> 
> Thanks,
> 
> Koen

I am not able to reproduce this problem and it looks strange because you
have some compile problems related to OpenSSL functions.

Can you provide me with a configuration which triggers this problem
please? Are you only using these 5 patches on top of master or do you
use also some other patches on top of master?

Hauke
Koen Vandeputte April 20, 2018, 11:10 a.m. UTC | #6
On 2018-04-20 00:15, Hauke Mehrtens wrote:
> On 04/18/2018 12:24 AM, Koen Vandeputte wrote:

> <snip>

>>> I tested the patch series because I have a linking problem with zlib
>>> and python an I wanted to see if this fixes it (it does not) but on
>>> i686 I have this error
>>>
>>>
>>> make[8]: Entering directory
>>> '/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
>>>    CCLD     libgio-2.0.la
>>> /usr/bin/ld: /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o):
>>> relocation R_X86_64_PC32 against symbol `_length_code' can not be used
>>> when making a shared object; recompile with -fPIC
>>> /usr/bin/ld: final link failed: Bad value
>>> collect2: error: ld returned 1 exit status
>>> Makefile:2183: recipe for target 'libgio-2.0.la' failed
>>>
>>>
>> Hi Hauke,
>>
>> Probably related to the above?
>>
>> When I'm building using this patch series, I'm getting a python build
>> error.
>> Please see attached logfile.
>> Reverting the series fixes the build issue.
>>
>>
>> Do note that I'm also using my own config, which adds all feeds and uses
>> a lot more packages than default OpenWrt.
>>
>> Thanks,
>>
>> Koen
> I am not able to reproduce this problem and it looks strange because you
> have some compile problems related to OpenSSL functions.
>
> Can you provide me with a configuration which triggers this problem
> please? Are you only using these 5 patches on top of master or do you
> use also some other patches on top of master?
>
> Hauke
Hi Hauke,

I'm currently testing the V2 series.
The fpic addition fixes the build issues.


Also,

Previously I mentioned the following issue on imx6 (ubi):

- Make owrt build
- Add custom files using imagebuilder
- Flash (jtag or tftp via uboot)
- Boot 1st time (all is OK)
- Boot 2nd time (custom files are corrupt now)


After testing this a few times using JTAG on the same board (which had a 
repro rate of 100%) .. the issue seems fixed at first glance.
I wasn't able to reproduce it in the last 5 tests.



There are 2 warnings left:

WARNING: Makefile 'package/feeds/packages/python/Makefile' has a build 
dependency on 'zlib/host', which does not exist
WARNING: Makefile 'package/feeds/packages/python3/Makefile' has a build 
dependency on 'zlib/host', which does not exist


So when applying the series, an extra fix is probably needed in the 
package repo to get rid of the warnings.

Besides this, no regression seen so far ..


Thank you for the efforts!

Koen
Hauke Mehrtens April 20, 2018, 10:45 p.m. UTC | #7
On 04/20/2018 01:10 PM, Koen Vandeputte wrote:
> 
> 
> On 2018-04-20 00:15, Hauke Mehrtens wrote:
>> On 04/18/2018 12:24 AM, Koen Vandeputte wrote:
> 
>> <snip>
> 
>>>> I tested the patch series because I have a linking problem with zlib
>>>> and python an I wanted to see if this fixes it (it does not) but on
>>>> i686 I have this error
>>>>
>>>>
>>>> make[8]: Entering directory
>>>> '/home/build/proxy/build_dir/hostpkg/glib-2.56.1/gio'
>>>>    CCLD     libgio-2.0.la
>>>> /usr/bin/ld: /home/build/proxy/staging_dir/host/lib/libz.a(deflate.o):
>>>> relocation R_X86_64_PC32 against symbol `_length_code' can not be used
>>>> when making a shared object; recompile with -fPIC
>>>> /usr/bin/ld: final link failed: Bad value
>>>> collect2: error: ld returned 1 exit status
>>>> Makefile:2183: recipe for target 'libgio-2.0.la' failed
>>>>
>>>>
>>> Hi Hauke,
>>>
>>> Probably related to the above?
>>>
>>> When I'm building using this patch series, I'm getting a python build
>>> error.
>>> Please see attached logfile.
>>> Reverting the series fixes the build issue.
>>>
>>>
>>> Do note that I'm also using my own config, which adds all feeds and uses
>>> a lot more packages than default OpenWrt.
>>>
>>> Thanks,
>>>
>>> Koen
>> I am not able to reproduce this problem and it looks strange because you
>> have some compile problems related to OpenSSL functions.
>>
>> Can you provide me with a configuration which triggers this problem
>> please? Are you only using these 5 patches on top of master or do you
>> use also some other patches on top of master?
>>
>> Hauke
> Hi Hauke,
> 
> I'm currently testing the V2 series.
> The fpic addition fixes the build issues.
> 
> 
> Also,
> 
> Previously I mentioned the following issue on imx6 (ubi):
> 
> - Make owrt build
> - Add custom files using imagebuilder
> - Flash (jtag or tftp via uboot)
> - Boot 1st time (all is OK)
> - Boot 2nd time (custom files are corrupt now)
> 
> 
> After testing this a few times using JTAG on the same board (which had a
> repro rate of 100%) .. the issue seems fixed at first glance.
> I wasn't able to reproduce it in the last 5 tests.

Interesting problem, this is fixed now with the v2 patches, so probably
with the update to version 2.0.2, but there are not so many changes in
there.

> There are 2 warnings left:
> 
> WARNING: Makefile 'package/feeds/packages/python/Makefile' has a build
> dependency on 'zlib/host', which does not exist
> WARNING: Makefile 'package/feeds/packages/python3/Makefile' has a build
> dependency on 'zlib/host', which does not exist
> 
> 
> So when applying the series, an extra fix is probably needed in the
> package repo to get rid of the warnings.

I will take care of these later.

> Besides this, no regression seen so far ..

Thanks for testing.

Hauke
Koen Vandeputte April 21, 2018, 8:12 p.m. UTC | #8
<snip>

>> Previously I mentioned the following issue on imx6 (ubi):
>>
>> - Make owrt build
>> - Add custom files using imagebuilder
>> - Flash (jtag or tftp via uboot)
>> - Boot 1st time (all is OK)
>> - Boot 2nd time (custom files are corrupt now)
>>
>>
>> After testing this a few times using JTAG on the same board (which had a
>> repro rate of 100%) .. the issue seems fixed at first glance.
>> I wasn't able to reproduce it in the last 5 tests.
> Interesting problem, this is fixed now with the v2 patches, so probably
> with the update to version 2.0.2, but there are not so many changes in
> there.
Judging the changes for ubi in the jump from 2.0.1 to 2.0.2,  I'm 
guessing V1 solved it.
I actually didn't test the V1 of the series due to the build error. :)

>
Thanks again for your work!

Koen
diff mbox series

Patch

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 6917716342..5b9a7e049d 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -76,11 +76,6 @@  else
   zlib_link_flags := -lz
 endif
 
-$(eval $(call TestHostCommand,zlib, \
-	Please install a static zlib. (Missing libz.a or zlib.h), \
-	echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
-		gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
-
 $(eval $(call TestHostCommand,perl-thread-queue, \
 	Please install the Perl Thread::Queue module, \
 	perl -MThread::Queue -e 1))
diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
index a7c61f7dd0..4a2a0e53b0 100644
--- a/package/libs/zlib/Makefile
+++ b/package/libs/zlib/Makefile
@@ -21,7 +21,6 @@  PKG_CPE_ID:=cpe:/a:gnu:zlib
 
 PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
 
-include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
@@ -95,6 +94,5 @@  define Package/zlib-dev/install
 	  $(1)/usr/lib/pkgconfig/
 endef
 
-$(eval $(call HostBuild))
 $(eval $(call BuildPackage,zlib))
 $(eval $(call BuildPackage,zlib-dev))
diff --git a/tools/Makefile b/tools/Makefile
index 50bd552d75..8dfab9892b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -22,7 +22,7 @@  ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
 endif
 
 tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat
-tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs
+tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs zlib
 tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
 tools-y += firmware-utils patch-image quilt padjffs2
 tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf
@@ -43,16 +43,16 @@  $(curdir)/bison/compile := $(curdir)/flex/compile
 $(curdir)/flex/compile := $(curdir)/libtool/compile
 $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
 $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
-$(curdir)/squashfs4/compile := $(curdir)/xz/compile
+$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
 $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
 $(curdir)/autoconf/compile := $(curdir)/m4/compile
 $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile
 $(curdir)/gmp/compile := $(curdir)/libtool/compile
 $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
 $(curdir)/mpfr/compile := $(curdir)/gmp/compile
-$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
+$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
 $(curdir)/mklibs/compile := $(curdir)/libtool/compile
-$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
+$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
 $(curdir)/upslug2/compile := $(curdir)/libtool/compile
 $(curdir)/mm-macros/compile := $(curdir)/libtool/compile
 $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
@@ -69,8 +69,12 @@  $(curdir)/patchelf/compile := $(curdir)/libtool/compile
 $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
 $(curdir)/libressl/compile := $(curdir)/pkg-config/compile
 $(curdir)/mkimage/compile += $(curdir)/libressl/compile
-$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
+$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile
 $(curdir)/cmake/compile += $(curdir)/libressl/compile
+$(curdir)/zlib/compile := $(curdir)/cmake/compile
+$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile
+$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
+$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
 
 ifneq ($(HOST_OS),Linux)
   tools-y += coreutils
diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile
index 5982eab5db..5204127a80 100644
--- a/tools/lzma-old/Makefile
+++ b/tools/lzma-old/Makefile
@@ -21,7 +21,9 @@  LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib
 ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone
 
 define Host/Compile
+	+$(HOST_MAKE_VARS) \
 	$(MAKE) -C $(LIB_DIR)
+	+$(HOST_MAKE_VARS) \
 	$(MAKE) -f makefile.gcc -C $(ALONE_DIR)
 endef
 
diff --git a/tools/lzma-old/patches/120-add-cflags.patch b/tools/lzma-old/patches/120-add-cflags.patch
new file mode 100644
index 0000000000..9022e7cd27
--- /dev/null
+++ b/tools/lzma-old/patches/120-add-cflags.patch
@@ -0,0 +1,11 @@ 
+--- a/C/7zip/Compress/LZMA_Lib/makefile
++++ b/C/7zip/Compress/LZMA_Lib/makefile
+@@ -2,7 +2,7 @@ PROG = liblzma.a
+ CXX = g++ -O3 -Wall
+ AR = ar
+ RM = rm -f
+-CFLAGS = -c  -I ../../../
++CFLAGS += -c  -I ../../../
+ 
+ OBJS = \
+   ZLib.o \
diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile
index f140101c8e..97f9e6369c 100644
--- a/tools/make-ext4fs/Makefile
+++ b/tools/make-ext4fs/Makefile
@@ -17,13 +17,7 @@  PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507
 
 include $(INCLUDE_DIR)/host-build.mk
 
-ifeq ($(HOST_OS),Linux)
- MAKE_STATIC := STATIC=1
-endif
-
-define Host/Compile
-	$(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC)
-endef
+HOST_MAKE_FLAGS += STATIC=1
 
 define Host/Install
 	$(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs $(STAGING_DIR_HOST)/bin/
diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch b/tools/make-ext4fs/patches/100-add-ldflags.patch
new file mode 100644
index 0000000000..d9ce47bb80
--- /dev/null
+++ b/tools/make-ext4fs/patches/100-add-ldflags.patch
@@ -0,0 +1,11 @@ 
+--- a/Makefile
++++ b/Makefile
+@@ -27,7 +27,7 @@ OBJ := \
+ 	$(CC) $(CFLAGS) -c -o $@ $^
+ 
+ make_ext4fs: $(OBJ) libsparse/libsparse.a
+-	$(CC) -o $@ $^ $(ZLIB)
++	$(CC) $(LDFLAGS)-o $@ $^ $(ZLIB)
+ 
+ libsparse/libsparse.a:
+ 	$(MAKE) -C libsparse/ libsparse.a
diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile
index e9e2b7ca9a..409b1b5a23 100644
--- a/tools/squashfs4/Makefile
+++ b/tools/squashfs4/Makefile
@@ -20,8 +20,8 @@  HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION)
 include $(INCLUDE_DIR)/host-build.mk
 
 define Host/Compile
+	+$(HOST_MAKE_VARS) \
 	$(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \
-		CC="$(HOSTCC)" \
 		XZ_SUPPORT=1 \
 		LZMA_XZ_SUPPORT=1 \
 		XATTR_SUPPORT= \
diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
new file mode 100644
index 0000000000..2746d95b72
--- /dev/null
+++ b/tools/zlib/Makefile
@@ -0,0 +1,40 @@ 
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=zlib
+PKG_VERSION:=1.2.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
+PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
+
+PKG_LICENSE:=Zlib
+PKG_LICENSE_FILES:=README
+PKG_CPE_ID:=cpe:/a:gnu:zlib
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+
+define Host/Install
+	$(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/
+	$(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/
+	$(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/
+	$(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
+endef
+
+define Host/Clean
+	rm -f $(STAGING_DIR_HOST)/lib/libz.a
+	rm -f $(STAGING_DIR_HOST)/include/zconf.h
+	rm -f $(STAGING_DIR_HOST)/include/zlib.h
+	rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc
+endef
+
+$(eval $(call HostBuild))