public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/8] Add --with-system-zlib in bfd
@ 2015-03-26 15:57 H.J. Lu
  2015-03-29 14:10 ` H.J. Lu
  2015-03-31  6:13 ` Mike Frysinger
  0 siblings, 2 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-26 15:57 UTC (permalink / raw)
  To: binutils; +Cc: GDB

I imported zlib from GCC.  This patch adds --with-system-zlib and remove
--with-zlib in bfd.  OK for master?

Thanks.


H.J.
---
	* Makefile.am (ZLIB): New.
	(ZLIBINC): Likewise.
	(AM_CFLAGS): Add $(ZLIBINC).
	(libbfd_la_LIBADD): Add $(ZLIB).
	* compress.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
	(decompress_contents): Don't check HAVE_ZLIB_H.
	(decompress_contents): Likewise.
	(bfd_compress_section_contents): Likewise.
	(bfd_get_full_section_contents): Likewise.
	(bfd_init_section_decompress_status): Likewise.
	(bfd_init_section_compress_status): Likewise.
	* configure.ac (AM_ZLIB): Removed
	(zlibdir): New.  AC_SUBST.
	(zlibinc): Likewise.
	Add --with-system-zlib.
	* Makefile.in: Regenerated.
	* acinclude.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
---
 bfd/Makefile.am     | 10 ++++--
 bfd/Makefile.in     | 16 ++++++---
 bfd/acinclude.m4    |  2 --
 bfd/compress.c      | 36 ++++----------------
 bfd/config.in       |  3 --
 bfd/configure       | 97 +++++++----------------------------------------------
 bfd/configure.ac    | 13 +++++--
 bfd/doc/Makefile.in |  6 ++--
 8 files changed, 53 insertions(+), 130 deletions(-)

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 5d7f899..03b6442 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -43,9 +43,15 @@ noinst_LTLIBRARIES = libbfd.la
 libbfd_la_LDFLAGS += -rpath $(rpath_bfdlibdir)
 endif
 
+# This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
+# -I../zlib, unless we were configured with --with-system-zlib, in which
+# case both are empty.
+ZLIB = @zlibdir@ -lz
+ZLIBINC = @zlibinc@
+
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
 AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
 if PLUGINS
 bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -840,7 +846,7 @@ ofiles: stamp-ofiles ; @true
 libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
 EXTRA_libbfd_la_SOURCES = $(CFILES)
 libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL)
+libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB)
 libbfd_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@
 
 # libtool will build .libs/libbfd.a.  We create libbfd.a in the build
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 60d994f..92eb33d 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -79,8 +79,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
-	$(top_srcdir)/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -334,6 +334,8 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wordsize = @wordsize@
+zlibdir = @zlibdir@
+zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = 1.11 no-dist foreign
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 INCDIR = $(srcdir)/../include
@@ -349,7 +351,13 @@ libbfd_la_LDFLAGS = $(am__append_1) -release `cat libtool-soversion` \
 @INSTALL_LIBBFD_TRUE@	$(INCDIR)/bfdlink.h $(am__append_2)
 @INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@
 @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la
-AM_CFLAGS = $(WARN_CFLAGS)
+
+# This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
+# -I../zlib, unless we were configured with --with-system-zlib, in which
+# case both are empty.
+ZLIB = @zlibdir@ -lz
+ZLIBINC = @zlibinc@
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
 AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
 @PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
 
@@ -1113,7 +1121,7 @@ OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@
 libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
 EXTRA_libbfd_la_SOURCES = $(CFILES)
 libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL)
+libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB)
 
 # libtool will build .libs/libbfd.a.  We create libbfd.a in the build
 # directory so that we don't have to convert all the programs that use
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index acb6419..ce6a72e 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -16,8 +16,6 @@ dnl along with this program; see the file COPYING3.  If not see
 dnl <http://www.gnu.org/licenses/>.
 dnl
 
-sinclude([../config/zlib.m4])
-
 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
 AC_DEFUN([BFD_BINARY_FOPEN],
 [AC_REQUIRE([AC_CANONICAL_TARGET])
diff --git a/bfd/compress.c b/bfd/compress.c
index 993a1d3..7e498fa 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -19,14 +19,11 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
+#include <zlib.h>
 #include "bfd.h"
 #include "libbfd.h"
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
 #include "safe-ctype.h"
 
-#ifdef HAVE_ZLIB_H
 static bfd_boolean
 decompress_contents (bfd_byte *compressed_buffer,
 		     bfd_size_type compressed_size,
@@ -72,10 +69,9 @@ decompress_contents (bfd_byte *compressed_buffer,
    successfully.  */
 
 static bfd_boolean
-bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED,
-			       sec_ptr sec ATTRIBUTE_UNUSED,
-			       bfd_byte *uncompressed_buffer ATTRIBUTE_UNUSED,
-			       bfd_size_type uncompressed_size ATTRIBUTE_UNUSED)
+bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec,
+			       bfd_byte *uncompressed_buffer,
+			       bfd_size_type uncompressed_size)
 {
   uLong compressed_size;
   bfd_byte *compressed_buffer;
@@ -127,7 +123,6 @@ bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED,
 
   return TRUE;
 }
-#endif  /* HAVE_ZLIB_H */
 
 /*
 FUNCTION
@@ -152,12 +147,10 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
 {
   bfd_size_type sz;
   bfd_byte *p = *ptr;
-#ifdef HAVE_ZLIB_H
   bfd_boolean ret;
   bfd_size_type save_size;
   bfd_size_type save_rawsize;
   bfd_byte *compressed_buffer;
-#endif
 
   if (abfd->direction != write_direction && sec->rawsize != 0)
     sz = sec->rawsize;
@@ -189,10 +182,6 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
       return TRUE;
 
     case DECOMPRESS_SECTION_SIZED:
-#ifndef HAVE_ZLIB_H
-      bfd_set_error (bfd_error_invalid_operation);
-      return FALSE;
-#else
       /* Read in the full compressed section contents.  */
       compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size);
       if (compressed_buffer == NULL)
@@ -232,7 +221,6 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
       free (compressed_buffer);
       *ptr = p;
       return TRUE;
-#endif
 
     case COMPRESS_SECTION_DONE:
       if (sec->contents == NULL)
@@ -337,13 +325,8 @@ DESCRIPTION
 */
 
 bfd_boolean
-bfd_init_section_decompress_status (bfd *abfd ATTRIBUTE_UNUSED,
-				    sec_ptr sec ATTRIBUTE_UNUSED)
+bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
 {
-#ifndef HAVE_ZLIB_H
-  bfd_set_error (bfd_error_invalid_operation);
-  return FALSE;
-#else
   bfd_byte compressed_buffer [12];
   bfd_size_type uncompressed_size;
 
@@ -378,7 +361,6 @@ bfd_init_section_decompress_status (bfd *abfd ATTRIBUTE_UNUSED,
   sec->compress_status = DECOMPRESS_SECTION_SIZED;
 
   return TRUE;
-#endif
 }
 
 /*
@@ -399,13 +381,8 @@ DESCRIPTION
 */
 
 bfd_boolean
-bfd_init_section_compress_status (bfd *abfd ATTRIBUTE_UNUSED,
-				  sec_ptr sec ATTRIBUTE_UNUSED)
+bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
 {
-#ifndef HAVE_ZLIB_H
-  bfd_set_error (bfd_error_invalid_operation);
-  return FALSE;
-#else
   bfd_size_type uncompressed_size;
   bfd_byte *uncompressed_buffer;
   bfd_boolean ret;
@@ -433,5 +410,4 @@ bfd_init_section_compress_status (bfd *abfd ATTRIBUTE_UNUSED,
 					 uncompressed_size);
 
   return ret;
-#endif
 }
diff --git a/bfd/config.in b/bfd/config.in
index 96a3e74..1ee1081 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -271,9 +271,6 @@
 /* Define to 1 if you have the <windows.h> header file. */
 #undef HAVE_WINDOWS_H
 
-/* Define to 1 if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
 #undef LT_OBJDIR
diff --git a/bfd/configure b/bfd/configure
index a328813..b8f1b2b 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -620,6 +620,8 @@ SHARED_LDFLAGS
 LIBM
 COREFLAG
 COREFILE
+zlibinc
+zlibdir
 EXEEXT_FOR_BUILD
 CC_FOR_BUILD
 BFD_HOSTPTR_T
@@ -797,7 +799,7 @@ enable_build_warnings
 enable_maintainer_mode
 enable_install_libbfd
 enable_nls
-with_zlib
+with_system_zlib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1463,7 +1465,7 @@ Optional Packages:
   --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                           Binutils"
   --with-bugurl=URL       Direct users to URL to report a bug
-  --with-zlib             include zlib support (auto/yes/no) default=auto
+  --with-system-zlib      use installed libz
 
 Some influential environment variables:
   CC          C compiler command
@@ -11421,7 +11423,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11424 "configure"
+#line 11426 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11527,7 +11529,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11530 "configure"
+#line 11532 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13851,91 +13853,18 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# Link in zlib if we can.  This allows us to read compressed debug sections.
-# This is used only by compress.c.
+# Use the system's zlib library.
+zlibdir=-L../zlib
+zlibinc="-I\$(srcdir)/../zlib"
 
-  # See if the user specified whether he wants zlib support or not.
+# Check whether --with-system-zlib was given.
+if test "${with_system_zlib+set}" = set; then :
+  withval=$with_system_zlib; zlibdir=
+zlibinc=
 
-# Check whether --with-zlib was given.
-if test "${with_zlib+set}" = set; then :
-  withval=$with_zlib;
-else
-  with_zlib=auto
 fi
 
 
-  if test "$with_zlib" != "no"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
-$as_echo_n "checking for library containing zlibVersion... " >&6; }
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char zlibVersion ();
-int
-main ()
-{
-return zlibVersion ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' z; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_zlibVersion=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if test "${ac_cv_search_zlibVersion+set}" = set; then :
-  break
-fi
-done
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
-
-else
-  ac_cv_search_zlibVersion=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5
-$as_echo "$ac_cv_search_zlibVersion" >&6; }
-ac_res=$ac_cv_search_zlibVersion
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  for ac_header in zlib.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_ZLIB_H 1
-_ACEOF
-
-fi
-
-done
-
-fi
-
-    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
-      as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
-    fi
-  fi
 
 
 # If we are configured native, pick a core file support file.
diff --git a/bfd/configure.ac b/bfd/configure.ac
index a1b2035..5426781 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -236,9 +236,16 @@ AC_CHECK_DECLS(snprintf)
 AC_CHECK_DECLS(vsnprintf)
 AC_CHECK_DECLS(strnlen)
 
-# Link in zlib if we can.  This allows us to read compressed debug sections.
-# This is used only by compress.c.
-AM_ZLIB
+# Use the system's zlib library.
+zlibdir=-L../zlib
+zlibinc="-I\$(srcdir)/../zlib"
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+zlibdir=
+zlibinc=
+)
+AC_SUBST(zlibdir)
+AC_SUBST(zlibinc)
 
 # If we are configured native, pick a core file support file.
 COREFILE=
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 72099f1..6038113 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -75,8 +75,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
-	$(top_srcdir)/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -289,6 +289,8 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wordsize = @wordsize@
+zlibdir = @zlibdir@
+zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = 1.9 cygnus
 DOCFILES = aoutx.texi  archive.texi archures.texi \
 	bfdt.texi  cache.texi coffcode.texi \
-- 
2.1.0


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-26 15:57 [PATCH 1/8] Add --with-system-zlib in bfd H.J. Lu
@ 2015-03-29 14:10 ` H.J. Lu
  2015-03-30 15:52   ` Steve Ellcey
  2015-03-31  6:13 ` Mike Frysinger
  1 sibling, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-29 14:10 UTC (permalink / raw)
  To: Binutils; +Cc: GDB

On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> I imported zlib from GCC.  This patch adds --with-system-zlib and remove
> --with-zlib in bfd.  OK for master?
>
> Thanks.
>
>
> H.J.
> ---
>         * Makefile.am (ZLIB): New.
>         (ZLIBINC): Likewise.
>         (AM_CFLAGS): Add $(ZLIBINC).
>         (libbfd_la_LIBADD): Add $(ZLIB).
>         * compress.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
>         (decompress_contents): Don't check HAVE_ZLIB_H.
>         (decompress_contents): Likewise.
>         (bfd_compress_section_contents): Likewise.
>         (bfd_get_full_section_contents): Likewise.
>         (bfd_init_section_decompress_status): Likewise.
>         (bfd_init_section_compress_status): Likewise.
>         * configure.ac (AM_ZLIB): Removed
>         (zlibdir): New.  AC_SUBST.
>         (zlibinc): Likewise.
>         Add --with-system-zlib.
>         * Makefile.in: Regenerated.
>         * acinclude.m4: Likewise.
>         * config.in: Likewise.
>         * configure: Likewise.
>         * doc/Makefile.in: Likewise.

I will check in this patch shortly.

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-29 14:10 ` H.J. Lu
@ 2015-03-30 15:52   ` Steve Ellcey
  2015-03-30 16:32     ` H.J. Lu
  0 siblings, 1 reply; 38+ messages in thread
From: Steve Ellcey @ 2015-03-30 15:52 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

On Sun, 2015-03-29 at 07:10 -0700, H.J. Lu wrote:
> On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > I imported zlib from GCC.  This patch adds --with-system-zlib and remove
> > --with-zlib in bfd.  OK for master?

I think the global binutils-gdb Makefile needs to have a dependency of
bfd on zlib.  If I build 'all-binutils' (using just the binutils-gdb
repository, not a combined tree with GCC) I get a build failure.  If I
explicitly build all-zlib before building all-binutils it works, but I
should not have to do that.


/bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/scratch/sellcey/repos/nightly/src/binutils-gdb/bfd/../zlib -g -O2 -rpath /scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/x86_64-unknown-linux-gnu/mips-mti-linux-gnu/lib -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo `cat ofiles`  -ldl -L../zlib -lz -ldl
./libtool: line 5195: cd: ../zlib: No such file or directory
libtool: link: cannot determine absolute directory name of `../zlib'
make[3]: *** [libbfd.la] Error 1
make[3]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
make: *** [all-bfd] Error 2
Error: Make command failed, stopping build.


Steve Ellcey
sellcey@imgtec.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 15:52   ` Steve Ellcey
@ 2015-03-30 16:32     ` H.J. Lu
  2015-03-30 16:45       ` Luis Machado
  2015-03-30 17:20       ` H.J. Lu
  0 siblings, 2 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-30 16:32 UTC (permalink / raw)
  To: sellcey; +Cc: Binutils, GDB

On Mon, Mar 30, 2015 at 8:52 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
> On Sun, 2015-03-29 at 07:10 -0700, H.J. Lu wrote:
>> On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> > I imported zlib from GCC.  This patch adds --with-system-zlib and remove
>> > --with-zlib in bfd.  OK for master?
>
> I think the global binutils-gdb Makefile needs to have a dependency of
> bfd on zlib.  If I build 'all-binutils' (using just the binutils-gdb
> repository, not a combined tree with GCC) I get a build failure.  If I
> explicitly build all-zlib before building all-binutils it works, but I
> should not have to do that.
>
>
> /bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/scratch/sellcey/repos/nightly/src/binutils-gdb/bfd/../zlib -g -O2 -rpath /scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/x86_64-unknown-linux-gnu/mips-mti-linux-gnu/lib -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo `cat ofiles`  -ldl -L../zlib -lz -ldl
> ./libtool: line 5195: cd: ../zlib: No such file or directory
> libtool: link: cannot determine absolute directory name of `../zlib'
> make[3]: *** [libbfd.la] Error 1
> make[3]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
> make: *** [all-bfd] Error 2
> Error: Make command failed, stopping build.

I will take a look.

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 16:32     ` H.J. Lu
@ 2015-03-30 16:45       ` Luis Machado
  2015-03-30 16:51         ` H.J. Lu
  2015-03-30 17:20       ` H.J. Lu
  1 sibling, 1 reply; 38+ messages in thread
From: Luis Machado @ 2015-03-30 16:45 UTC (permalink / raw)
  To: H.J. Lu, sellcey; +Cc: Binutils, GDB

On 03/30/2015 01:31 PM, H.J. Lu wrote:
> On Mon, Mar 30, 2015 at 8:52 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
>> On Sun, 2015-03-29 at 07:10 -0700, H.J. Lu wrote:
>>> On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> I imported zlib from GCC.  This patch adds --with-system-zlib and remove
>>>> --with-zlib in bfd.  OK for master?
>>
>> I think the global binutils-gdb Makefile needs to have a dependency of
>> bfd on zlib.  If I build 'all-binutils' (using just the binutils-gdb
>> repository, not a combined tree with GCC) I get a build failure.  If I
>> explicitly build all-zlib before building all-binutils it works, but I
>> should not have to do that.
>>
>>
>> /bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/scratch/sellcey/repos/nightly/src/binutils-gdb/bfd/../zlib -g -O2 -rpath /scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/x86_64-unknown-linux-gnu/mips-mti-linux-gnu/lib -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo `cat ofiles`  -ldl -L../zlib -lz -ldl
>> ./libtool: line 5195: cd: ../zlib: No such file or directory
>> libtool: link: cannot determine absolute directory name of `../zlib'
>> make[3]: *** [libbfd.la] Error 1
>> make[3]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>> make[2]: *** [all-recursive] Error 1
>> make[2]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>> make[1]: *** [all] Error 2
>> make[1]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>> make: *** [all-bfd] Error 2
>> Error: Make command failed, stopping build.
>
> I will take a look.
>

It seems GDB's Makefile.in is also missing a few bits to make sure it 
includes ../zlib/libz.a in the final link step, otherwise it tries to 
pick the system's zlib instead of the included zlib, which may fail if 
you have an older libz installed.

--

/usr/bin/ld: ../bfd/libbfd.a(compress.o): undefined reference to symbol 
'compressBound@@ZLIB_1.2.0'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from 
command line
collect2: error: ld returned 1 exit status
make[2]: *** [gdb] Error 1

--

We need something like libiberty in gdb/Makefile.in, but conditionalized 
based on the configure switches to use the system's or the include zlib.

gdb/Makefile.in:

# Where is the "-liberty" library?  Typically in ../libiberty.
LIBIBERTY = ../libiberty/libiberty.a

... and then ...

CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) 
$(LIBDECNUMBER) \
         $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) \
         @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
         $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) \
         $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 16:45       ` Luis Machado
@ 2015-03-30 16:51         ` H.J. Lu
  2015-03-30 17:13           ` Steve Ellcey
  2015-03-30 18:18           ` Luis Machado
  0 siblings, 2 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-30 16:51 UTC (permalink / raw)
  To: lgustavo; +Cc: sellcey, Binutils, GDB

On Mon, Mar 30, 2015 at 9:45 AM, Luis Machado <lgustavo@codesourcery.com> wrote:
> On 03/30/2015 01:31 PM, H.J. Lu wrote:
>>
>> On Mon, Mar 30, 2015 at 8:52 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
>>>
>>> On Sun, 2015-03-29 at 07:10 -0700, H.J. Lu wrote:
>>>>
>>>> On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>
>>>>> I imported zlib from GCC.  This patch adds --with-system-zlib and
>>>>> remove
>>>>> --with-zlib in bfd.  OK for master?
>>>
>>>
>>> I think the global binutils-gdb Makefile needs to have a dependency of
>>> bfd on zlib.  If I build 'all-binutils' (using just the binutils-gdb
>>> repository, not a combined tree with GCC) I get a build failure.  If I
>>> explicitly build all-zlib before building all-binutils it works, but I
>>> should not have to do that.
>>>
>>>
>>> /bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes
>>> -Wmissing-prototypes -Wshadow -Werror
>>> -I/scratch/sellcey/repos/nightly/src/binutils-gdb/bfd/../zlib -g -O2 -rpath
>>> /scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/x86_64-unknown-linux-gnu/mips-mti-linux-gnu/lib
>>> -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o
>>> libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo
>>> coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo
>>> linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo
>>> stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
>>> `cat ofiles`  -ldl -L../zlib -lz -ldl
>>> ./libtool: line 5195: cd: ../zlib: No such file or directory
>>> libtool: link: cannot determine absolute directory name of `../zlib'
>>> make[3]: *** [libbfd.la] Error 1
>>> make[3]: Leaving directory
>>> `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>>> make[2]: *** [all-recursive] Error 1
>>> make[2]: Leaving directory
>>> `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>>> make[1]: *** [all] Error 2
>>> make[1]: Leaving directory
>>> `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>>> make: *** [all-bfd] Error 2
>>> Error: Make command failed, stopping build.
>>
>>
>> I will take a look.
>>
>
> It seems GDB's Makefile.in is also missing a few bits to make sure it
> includes ../zlib/libz.a in the final link step, otherwise it tries to pick
> the system's zlib instead of the included zlib, which may fail if you have
> an older libz installed.
>
> --
>
> /usr/bin/ld: ../bfd/libbfd.a(compress.o): undefined reference to symbol
> 'compressBound@@ZLIB_1.2.0'
> //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from
> command line
> collect2: error: ld returned 1 exit status
> make[2]: *** [gdb] Error 1
>
> --
>
> We need something like libiberty in gdb/Makefile.in, but conditionalized
> based on the configure switches to use the system's or the include zlib.
>

Please check out users/hjl/zlib branch.


-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 16:51         ` H.J. Lu
@ 2015-03-30 17:13           ` Steve Ellcey
  2015-03-30 17:21             ` H.J. Lu
  2015-03-30 18:18           ` Luis Machado
  1 sibling, 1 reply; 38+ messages in thread
From: Steve Ellcey @ 2015-03-30 17:13 UTC (permalink / raw)
  To: H.J. Lu; +Cc: lgustavo, Binutils, GDB

On Mon, 2015-03-30 at 09:50 -0700, H.J. Lu wrote:

> > We need something like libiberty in gdb/Makefile.in, but conditionalized
> > based on the configure switches to use the system's or the include zlib.
> >
> 
> Please check out users/hjl/zlib branch.


This didn't do anything for my build.

Steve Ellcey
sellcey@imgtec.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 16:32     ` H.J. Lu
  2015-03-30 16:45       ` Luis Machado
@ 2015-03-30 17:20       ` H.J. Lu
  1 sibling, 0 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-30 17:20 UTC (permalink / raw)
  To: sellcey; +Cc: Binutils, GDB

On Mon, Mar 30, 2015 at 9:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Mar 30, 2015 at 8:52 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
>> On Sun, 2015-03-29 at 07:10 -0700, H.J. Lu wrote:
>>> On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> > I imported zlib from GCC.  This patch adds --with-system-zlib and remove
>>> > --with-zlib in bfd.  OK for master?
>>
>> I think the global binutils-gdb Makefile needs to have a dependency of
>> bfd on zlib.  If I build 'all-binutils' (using just the binutils-gdb
>> repository, not a combined tree with GCC) I get a build failure.  If I
>> explicitly build all-zlib before building all-binutils it works, but I
>> should not have to do that.
>>
>>
>> /bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/scratch/sellcey/repos/nightly/src/binutils-gdb/bfd/../zlib -g -O2 -rpath /scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/x86_64-unknown-linux-gnu/mips-mti-linux-gnu/lib -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo `cat ofiles`  -ldl -L../zlib -lz -ldl
>> ./libtool: line 5195: cd: ../zlib: No such file or directory
>> libtool: link: cannot determine absolute directory name of `../zlib'
>> make[3]: *** [libbfd.la] Error 1
>> make[3]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>> make[2]: *** [all-recursive] Error 1
>> make[2]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>> make[1]: *** [all] Error 2
>> make[1]: Leaving directory `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>> make: *** [all-bfd] Error 2
>> Error: Make command failed, stopping build.
>
> I will take a look.
>

This is the patch I checked in.

-- 
H.J.
---
From 1ca8e8df45bcdd08b7a8fbb35368478ddbf890bf Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 30 Mar 2015 10:17:40 -0700
Subject: [PATCH] Make all-bfd depend on all-zlib

* Makefile.def (dependencies): Add all-zlib to all-bfd.
* Makefile.in: Regenerated.
---
 ChangeLog    | 5 +++++
 Makefile.def | 1 +
 Makefile.in  | 8 ++++++++
 3 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ad04e40..4110c29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+ * Makefile.def (dependencies): Add all-zlib to all-bfd.
+ * Makefile.in: Regenerated.
+
 2015-03-28  H.J. Lu  <hongjiu.lu@intel.com>

  * src-release.sh (do_proto_toplev): Configure with --target
diff --git a/Makefile.def b/Makefile.def
index e0ea2fb..4e76450 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -402,6 +402,7 @@ dependencies = { module=configure-bfd;
on=configure-libiberty; hard=true; };
 dependencies = { module=configure-bfd; on=configure-intl; };
 dependencies = { module=all-bfd; on=all-libiberty; };
 dependencies = { module=all-bfd; on=all-intl; };
+dependencies = { module=all-bfd; on=all-zlib; };
 dependencies = { module=configure-opcodes; on=configure-libiberty;
hard=true; };
 dependencies = { module=all-opcodes; on=all-libiberty; };

diff --git a/Makefile.in b/Makefile.in
index 6f9dfd4..cc05f7b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -49969,6 +49969,14 @@ all-stage3-bfd: maybe-all-stage3-intl
 all-stage4-bfd: maybe-all-stage4-intl
 all-stageprofile-bfd: maybe-all-stageprofile-intl
 all-stagefeedback-bfd: maybe-all-stagefeedback-intl
+all-bfd: maybe-all-zlib
+
+all-stage1-bfd: maybe-all-stage1-zlib
+all-stage2-bfd: maybe-all-stage2-zlib
+all-stage3-bfd: maybe-all-stage3-zlib
+all-stage4-bfd: maybe-all-stage4-zlib
+all-stageprofile-bfd: maybe-all-stageprofile-zlib
+all-stagefeedback-bfd: maybe-all-stagefeedback-zlib
 configure-opcodes: configure-libiberty

 configure-stage1-opcodes: configure-stage1-libiberty
-- 
1.9.3

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 17:13           ` Steve Ellcey
@ 2015-03-30 17:21             ` H.J. Lu
  2015-03-30 17:36               ` Steve Ellcey
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-30 17:21 UTC (permalink / raw)
  To: sellcey; +Cc: lgustavo, Binutils, GDB

On Mon, Mar 30, 2015 at 10:13 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
> On Mon, 2015-03-30 at 09:50 -0700, H.J. Lu wrote:
>
>> > We need something like libiberty in gdb/Makefile.in, but conditionalized
>> > based on the configure switches to use the system's or the include zlib.
>> >
>>
>> Please check out users/hjl/zlib branch.
>
>
> This didn't do anything for my build.
>

master branch is fixed now.


-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 17:21             ` H.J. Lu
@ 2015-03-30 17:36               ` Steve Ellcey
  2015-03-30 19:33                 ` Antoine Tremblay
  0 siblings, 1 reply; 38+ messages in thread
From: Steve Ellcey @ 2015-03-30 17:36 UTC (permalink / raw)
  To: H.J. Lu; +Cc: lgustavo, Binutils, GDB

On Mon, 2015-03-30 at 10:21 -0700, H.J. Lu wrote:

> master branch is fixed now.

Yes, my build is working now.  Thanks.

Steve Ellcey
sellcey@imgtec.com


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 16:51         ` H.J. Lu
  2015-03-30 17:13           ` Steve Ellcey
@ 2015-03-30 18:18           ` Luis Machado
  1 sibling, 0 replies; 38+ messages in thread
From: Luis Machado @ 2015-03-30 18:18 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

On 03/30/2015 01:50 PM, H.J. Lu wrote:
> On Mon, Mar 30, 2015 at 9:45 AM, Luis Machado <lgustavo@codesourcery.com> wrote:
>> On 03/30/2015 01:31 PM, H.J. Lu wrote:
>>>
>>> On Mon, Mar 30, 2015 at 8:52 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
>>>>
>>>> On Sun, 2015-03-29 at 07:10 -0700, H.J. Lu wrote:
>>>>>
>>>>> On Thu, Mar 26, 2015 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>
>>>>>> I imported zlib from GCC.  This patch adds --with-system-zlib and
>>>>>> remove
>>>>>> --with-zlib in bfd.  OK for master?
>>>>
>>>>
>>>> I think the global binutils-gdb Makefile needs to have a dependency of
>>>> bfd on zlib.  If I build 'all-binutils' (using just the binutils-gdb
>>>> repository, not a combined tree with GCC) I get a build failure.  If I
>>>> explicitly build all-zlib before building all-binutils it works, but I
>>>> should not have to do that.
>>>>
>>>>
>>>> /bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes
>>>> -Wmissing-prototypes -Wshadow -Werror
>>>> -I/scratch/sellcey/repos/nightly/src/binutils-gdb/bfd/../zlib -g -O2 -rpath
>>>> /scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/x86_64-unknown-linux-gnu/mips-mti-linux-gnu/lib
>>>> -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o
>>>> libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo
>>>> coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo
>>>> linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo
>>>> stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
>>>> `cat ofiles`  -ldl -L../zlib -lz -ldl
>>>> ./libtool: line 5195: cd: ../zlib: No such file or directory
>>>> libtool: link: cannot determine absolute directory name of `../zlib'
>>>> make[3]: *** [libbfd.la] Error 1
>>>> make[3]: Leaving directory
>>>> `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>>>> make[2]: *** [all-recursive] Error 1
>>>> make[2]: Leaving directory
>>>> `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>>>> make[1]: *** [all] Error 2
>>>> make[1]: Leaving directory
>>>> `/scratch/sellcey/repos/nightly/obj-mips-mti-linux-gnu/binutils-gdb/bfd'
>>>> make: *** [all-bfd] Error 2
>>>> Error: Make command failed, stopping build.
>>>
>>>
>>> I will take a look.
>>>
>>
>> It seems GDB's Makefile.in is also missing a few bits to make sure it
>> includes ../zlib/libz.a in the final link step, otherwise it tries to pick
>> the system's zlib instead of the included zlib, which may fail if you have
>> an older libz installed.
>>
>> --
>>
>> /usr/bin/ld: ../bfd/libbfd.a(compress.o): undefined reference to symbol
>> 'compressBound@@ZLIB_1.2.0'
>> //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from
>> command line
>> collect2: error: ld returned 1 exit status
>> make[2]: *** [gdb] Error 1
>>
>> --
>>
>> We need something like libiberty in gdb/Makefile.in, but conditionalized
>> based on the configure switches to use the system's or the include zlib.
>>
>
> Please check out users/hjl/zlib branch.
>
>

That fixed it.

Thanks,
Luis

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 17:36               ` Steve Ellcey
@ 2015-03-30 19:33                 ` Antoine Tremblay
  2015-03-30 19:37                   ` Antoine Tremblay
  2015-03-30 20:19                   ` H.J. Lu
  0 siblings, 2 replies; 38+ messages in thread
From: Antoine Tremblay @ 2015-03-30 19:33 UTC (permalink / raw)
  To: gdb-patches, hjl.tools


On 03/30/2015 01:36 PM, Steve Ellcey wrote:
> On Mon, 2015-03-30 at 10:21 -0700, H.J. Lu wrote:
>
>> master branch is fixed now.
>
> Yes, my build is working now.  Thanks.

Could there still be something missing ?

Doing a ./configure && make on binutils-gdb I get :

gcc -g -O2   -static-libstdc++ -static-libgcc    \
		-o gdb gdb.o ...

     ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a 
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lmcheck -ldl 
-lncurses -lm -ldl -lexpat   ../libiberty/libiberty.a 
build-gnulib/import/libgnu.a -ldl 
-Wl,--dynamic-list=../../gdb/proc-service.list
../bfd/libbfd.a(compress.o): In function `decompress_contents':
/home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:46: undefined 
reference to `inflateInit_'
/home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:53: undefined 
reference to `inflate'
/home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:56: undefined 
reference to `inflateReset'
/home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:58: undefined 
reference to `inflateEnd'
../bfd/libbfd.a(compress.o): In function `bfd_compress_section_contents':
/home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:79: undefined 
reference to `compressBound'
/home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:85: undefined 
reference to `compress'

Note this is with d2d67aea8e776d63a987f8dcdb96bc524df96e81

On ubuntu 14.04

I do see zlib being built it just seems like the .a is missing from the 
linking... ?

Regards,

Antoine

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 19:33                 ` Antoine Tremblay
@ 2015-03-30 19:37                   ` Antoine Tremblay
  2015-03-31 17:13                     ` Antoine Tremblay
  2015-03-30 20:19                   ` H.J. Lu
  1 sibling, 1 reply; 38+ messages in thread
From: Antoine Tremblay @ 2015-03-30 19:37 UTC (permalink / raw)
  To: gdb-patches, hjl.tools



On 03/30/2015 03:33 PM, Antoine Tremblay wrote:
>
> On 03/30/2015 01:36 PM, Steve Ellcey wrote:
>> On Mon, 2015-03-30 at 10:21 -0700, H.J. Lu wrote:
>>
>>> master branch is fixed now.
>>
>> Yes, my build is working now.  Thanks.
>
> Could there still be something missing ?
>
> Doing a ./configure && make on binutils-gdb I get :
>
> gcc -g -O2   -static-libstdc++ -static-libgcc    \
>          -o gdb gdb.o ...
>
>      ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a
> ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lmcheck -ldl
> -lncurses -lm -ldl -lexpat   ../libiberty/libiberty.a
> build-gnulib/import/libgnu.a -ldl
> -Wl,--dynamic-list=../../gdb/proc-service.list
> ../bfd/libbfd.a(compress.o): In function `decompress_contents':
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:46: undefined
> reference to `inflateInit_'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:53: undefined
> reference to `inflate'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:56: undefined
> reference to `inflateReset'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:58: undefined
> reference to `inflateEnd'
> ../bfd/libbfd.a(compress.o): In function `bfd_compress_section_contents':
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:79: undefined
> reference to `compressBound'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:85: undefined
> reference to `compress'
>
> Note this is with d2d67aea8e776d63a987f8dcdb96bc524df96e81
>
> On ubuntu 14.04
>
> I do see zlib being built it just seems like the .a is missing from the
> linking... ?
>

Also doing ./configure in binutils/zlib I get :

config.status: creating Makefile
config.status: executing default-1 commands
./config.status: line 1190: ./../../config-ml.in: No such file or directory

So configure does not exit cleanly...ideas?


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 19:33                 ` Antoine Tremblay
  2015-03-30 19:37                   ` Antoine Tremblay
@ 2015-03-30 20:19                   ` H.J. Lu
  2015-03-31 12:08                     ` Antoine Tremblay
  1 sibling, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-30 20:19 UTC (permalink / raw)
  To: Antoine Tremblay; +Cc: GDB

On Mon, Mar 30, 2015 at 12:33 PM, Antoine Tremblay
<antoine.tremblay@ericsson.com> wrote:
>
> On 03/30/2015 01:36 PM, Steve Ellcey wrote:
>>
>> On Mon, 2015-03-30 at 10:21 -0700, H.J. Lu wrote:
>>
>>> master branch is fixed now.
>>
>>
>> Yes, my build is working now.  Thanks.
>
>
> Could there still be something missing ?
>
> Doing a ./configure && make on binutils-gdb I get :
>
> gcc -g -O2   -static-libstdc++ -static-libgcc    \
>>     ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a
> ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lmcheck -ldl
> -lncurses -lm -ldl -lexpat   ../libiberty/libiberty.a
> build-gnulib/import/libgnu.a -ldl
> -Wl,--dynamic-list=../../gdb/proc-service.list
> ../bfd/libbfd.a(compress.o): In function `decompress_contents':
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:46: undefined
> reference to `inflateInit_'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:53: undefined
> reference to `inflate'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:56: undefined
> reference to `inflateReset'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:58: undefined
> reference to `inflateEnd'
> ../bfd/libbfd.a(compress.o): In function `bfd_compress_section_contents':
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:79: undefined
> reference to `compressBound'
> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:85: undefined
> reference to `compress'
>                 -o gdb gdb.o ...
>
> Note this is with d2d67aea8e776d63a987f8dcdb96bc524df96e81
>
> On ubuntu 14.04
>
> I do see zlib being built it just seems like the .a is missing from the
> linking... ?

Have you tried users/hjl/zlib branch?


-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-26 15:57 [PATCH 1/8] Add --with-system-zlib in bfd H.J. Lu
  2015-03-29 14:10 ` H.J. Lu
@ 2015-03-31  6:13 ` Mike Frysinger
  2015-03-31 10:10   ` H.J. Lu
  1 sibling, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2015-03-31  6:13 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils, GDB

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

On 26 Mar 2015 08:57, H.J. Lu wrote:
> --- a/bfd/configure.ac
> +++ b/bfd/configure.ac
>  
> -# Link in zlib if we can.  This allows us to read compressed debug sections.
> -# This is used only by compress.c.
> -AM_ZLIB
> +# Use the system's zlib library.
> +zlibdir=-L../zlib
> +zlibinc="-I\$(srcdir)/../zlib"
> +AC_ARG_WITH(system-zlib,
> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> +zlibdir=
> +zlibinc=
> +)

this is wrong.  the 3rd arg is whether the option was specified, not that the 
option was disabled.  you need to check $withval is equal to "no" (or not equal 
to "yes").
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31  6:13 ` Mike Frysinger
@ 2015-03-31 10:10   ` H.J. Lu
  2015-03-31 10:37     ` Pedro Alves
  2015-03-31 16:41     ` Mike Frysinger
  0 siblings, 2 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 10:10 UTC (permalink / raw)
  To: Binutils, GDB

On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 26 Mar 2015 08:57, H.J. Lu wrote:
>> --- a/bfd/configure.ac
>> +++ b/bfd/configure.ac
>>
>> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>> -# This is used only by compress.c.
>> -AM_ZLIB
>> +# Use the system's zlib library.
>> +zlibdir=-L../zlib
>> +zlibinc="-I\$(srcdir)/../zlib"
>> +AC_ARG_WITH(system-zlib,
>> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>> +zlibdir=
>> +zlibinc=
>> +)
>
> this is wrong.  the 3rd arg is whether the option was specified, not that the
> option was disabled.  you need to check $withval is equal to "no" (or not equal
> to "yes").
> -mike

That is what gcc/configure.ac has and it works for me.


-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 10:10   ` H.J. Lu
@ 2015-03-31 10:37     ` Pedro Alves
  2015-03-31 10:46       ` H.J. Lu
  2015-03-31 16:41     ` Mike Frysinger
  1 sibling, 1 reply; 38+ messages in thread
From: Pedro Alves @ 2015-03-31 10:37 UTC (permalink / raw)
  To: H.J. Lu, Binutils, GDB

On 03/31/2015 11:10 AM, H.J. Lu wrote:
> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On 26 Mar 2015 08:57, H.J. Lu wrote:
>>> --- a/bfd/configure.ac
>>> +++ b/bfd/configure.ac
>>>
>>> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>>> -# This is used only by compress.c.
>>> -AM_ZLIB
>>> +# Use the system's zlib library.
>>> +zlibdir=-L../zlib
>>> +zlibinc="-I\$(srcdir)/../zlib"
>>> +AC_ARG_WITH(system-zlib,
>>> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>>> +zlibdir=
>>> +zlibinc=
>>> +)
>>
>> this is wrong.  the 3rd arg is whether the option was specified, not that the
>> option was disabled.  you need to check $withval is equal to "no" (or not equal
>> to "yes").
>> -mike
> 
> That is what gcc/configure.ac has and it works for me.
> 
> 

Why are we patching every tool's configury instead of tweaking
config/zlib.m4 (where AM_ZLIB is from)?  We go from a single
place to edit, to the same configure bits spread around the
tree.  Seems like a step backwards.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 10:37     ` Pedro Alves
@ 2015-03-31 10:46       ` H.J. Lu
  2015-03-31 10:53         ` Pedro Alves
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 10:46 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Binutils, GDB

On Tue, Mar 31, 2015 at 3:37 AM, Pedro Alves <palves@redhat.com> wrote:
> On 03/31/2015 11:10 AM, H.J. Lu wrote:
>> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>>> On 26 Mar 2015 08:57, H.J. Lu wrote:
>>>> --- a/bfd/configure.ac
>>>> +++ b/bfd/configure.ac
>>>>
>>>> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>>>> -# This is used only by compress.c.
>>>> -AM_ZLIB
>>>> +# Use the system's zlib library.
>>>> +zlibdir=-L../zlib
>>>> +zlibinc="-I\$(srcdir)/../zlib"
>>>> +AC_ARG_WITH(system-zlib,
>>>> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>>>> +zlibdir=
>>>> +zlibinc=
>>>> +)
>>>
>>> this is wrong.  the 3rd arg is whether the option was specified, not that the
>>> option was disabled.  you need to check $withval is equal to "no" (or not equal
>>> to "yes").
>>> -mike
>>
>> That is what gcc/configure.ac has and it works for me.
>>
>>
>
> Why are we patching every tool's configury instead of tweaking
> config/zlib.m4 (where AM_ZLIB is from)?  We go from a single
> place to edit, to the same configure bits spread around the
> tree.  Seems like a step backwards.
>

Replace AM_ZLIB in configure.ac isn't complete. I also needed to change

* Makefile.am (ZLIB): New.
(ZLIBINC): Likewise.
(AM_CFLAGS): Add $(ZLIBINC).
(libbfd_la_LIBADD): Add $(ZLIB).

It is better for Makefile.am to use what configure.ac defines

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 10:46       ` H.J. Lu
@ 2015-03-31 10:53         ` Pedro Alves
  2015-03-31 11:33           ` H.J. Lu
  0 siblings, 1 reply; 38+ messages in thread
From: Pedro Alves @ 2015-03-31 10:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

On 03/31/2015 11:46 AM, H.J. Lu wrote:
> On Tue, Mar 31, 2015 at 3:37 AM, Pedro Alves <palves@redhat.com> wrote:
>> On 03/31/2015 11:10 AM, H.J. Lu wrote:
>>> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>>>> On 26 Mar 2015 08:57, H.J. Lu wrote:
>>>>> --- a/bfd/configure.ac
>>>>> +++ b/bfd/configure.ac
>>>>>
>>>>> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>>>>> -# This is used only by compress.c.
>>>>> -AM_ZLIB
>>>>> +# Use the system's zlib library.
>>>>> +zlibdir=-L../zlib
>>>>> +zlibinc="-I\$(srcdir)/../zlib"
>>>>> +AC_ARG_WITH(system-zlib,
>>>>> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>>>>> +zlibdir=
>>>>> +zlibinc=
>>>>> +)
>>>>
>>>> this is wrong.  the 3rd arg is whether the option was specified, not that the
>>>> option was disabled.  you need to check $withval is equal to "no" (or not equal
>>>> to "yes").
>>>> -mike
>>>
>>> That is what gcc/configure.ac has and it works for me.
>>>
>>>
>>
>> Why are we patching every tool's configury instead of tweaking
>> config/zlib.m4 (where AM_ZLIB is from)?  We go from a single
>> place to edit, to the same configure bits spread around the
>> tree.  Seems like a step backwards.
>>
> 
> Replace AM_ZLIB in configure.ac isn't complete. I also needed to change

Never said it was complete.

> 
> * Makefile.am (ZLIB): New.
> (ZLIBINC): Likewise.
> (AM_CFLAGS): Add $(ZLIBINC).
> (libbfd_la_LIBADD): Add $(ZLIB).
> 
> It is better for Makefile.am to use what configure.ac defines

That's orthogonal.  How configure.ac defines what Makefile.am
consumes is the issue.  That can either be through a shared macro,
which makes sure all tools have the exact same command line option
(like AM_ZLIB), or you manually put the same configure.ac bits
everywhere.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 10:53         ` Pedro Alves
@ 2015-03-31 11:33           ` H.J. Lu
  2015-03-31 11:46             ` Pedro Alves
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 11:33 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Binutils, GDB

On Tue, Mar 31, 2015 at 3:53 AM, Pedro Alves <palves@redhat.com> wrote:
> On 03/31/2015 11:46 AM, H.J. Lu wrote:
>> On Tue, Mar 31, 2015 at 3:37 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 03/31/2015 11:10 AM, H.J. Lu wrote:
>>>> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>>>>> On 26 Mar 2015 08:57, H.J. Lu wrote:
>>>>>> --- a/bfd/configure.ac
>>>>>> +++ b/bfd/configure.ac
>>>>>>
>>>>>> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>>>>>> -# This is used only by compress.c.
>>>>>> -AM_ZLIB
>>>>>> +# Use the system's zlib library.
>>>>>> +zlibdir=-L../zlib
>>>>>> +zlibinc="-I\$(srcdir)/../zlib"
>>>>>> +AC_ARG_WITH(system-zlib,
>>>>>> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>>>>>> +zlibdir=
>>>>>> +zlibinc=
>>>>>> +)
>>>>>
>>>>> this is wrong.  the 3rd arg is whether the option was specified, not that the
>>>>> option was disabled.  you need to check $withval is equal to "no" (or not equal
>>>>> to "yes").
>>>>> -mike
>>>>
>>>> That is what gcc/configure.ac has and it works for me.
>>>>
>>>>
>>>
>>> Why are we patching every tool's configury instead of tweaking
>>> config/zlib.m4 (where AM_ZLIB is from)?  We go from a single
>>> place to edit, to the same configure bits spread around the
>>> tree.  Seems like a step backwards.
>>>
>>
>> Replace AM_ZLIB in configure.ac isn't complete. I also needed to change
>
> Never said it was complete.
>
>>
>> * Makefile.am (ZLIB): New.
>> (ZLIBINC): Likewise.
>> (AM_CFLAGS): Add $(ZLIBINC).
>> (libbfd_la_LIBADD): Add $(ZLIB).
>>
>> It is better for Makefile.am to use what configure.ac defines
>
> That's orthogonal.  How configure.ac defines what Makefile.am
> consumes is the issue.  That can either be through a shared macro,
> which makes sure all tools have the exact same command line option
> (like AM_ZLIB), or you manually put the same configure.ac bits
> everywhere.

They aren't the same.  Some tools like ld, which use zlib implicitly
via libfd and libtool, don't need to reference zlib.  Some only need
to reference zlib library.  Some only need to reference header.

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 11:33           ` H.J. Lu
@ 2015-03-31 11:46             ` Pedro Alves
  2015-03-31 12:01               ` H.J. Lu
  0 siblings, 1 reply; 38+ messages in thread
From: Pedro Alves @ 2015-03-31 11:46 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

On 03/31/2015 12:33 PM, H.J. Lu wrote:
> On Tue, Mar 31, 2015 at 3:53 AM, Pedro Alves <palves@redhat.com> wrote:
>> On 03/31/2015 11:46 AM, H.J. Lu wrote:

>>> It is better for Makefile.am to use what configure.ac defines
>>
>> That's orthogonal.  How configure.ac defines what Makefile.am
>> consumes is the issue.  That can either be through a shared macro,
>> which makes sure all tools have the exact same command line option
>> (like AM_ZLIB), or you manually put the same configure.ac bits
>> everywhere.
> 
> They aren't the same.  Some tools like ld, which use zlib implicitly
> via libfd and libtool, don't need to reference zlib. 

Sure, that one just drops AM_ZLIB.

> Some only need
> to reference zlib library.  Some only need to reference header.
> 

And?  If you replace AM_ZLIB's body with:

# Use the system's zlib library.
zlibdir=-L../zlib
zlibinc="-I\$(srcdir)/../zlib"
AC_ARG_WITH(system-zlib,
[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
zlibdir=
zlibinc=
)
AC_SUBST(zlibdir)
AC_SUBST(zlibinc)

then it'll work for those too.  They just won't use zlibinc
or zlibinc if they don't need it.  Currently you have:

bfd:

> +# Use the system's zlib library.
> +zlibdir=-L../zlib
> +zlibinc="-I\$(srcdir)/../zlib"
> +AC_ARG_WITH(system-zlib,
> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> +zlibdir=
> +zlibinc=
> +)
> +AC_SUBST(zlibdir)
> +AC_SUBST(zlibinc)

gold:

+# Use the system's zlib library.
+zlibdir=-L../zlib
+zlibinc="-I\$(srcdir)/../zlib"
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+zlibdir=
+zlibinc=
+)
+AC_SUBST(zlibdir)
+AC_SUBST(zlibinc)

gas:

+# Use the system's zlib library.
+zlibinc="-I\$(srcdir)/../zlib"
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+zlibinc=
+)
+AC_SUBST(zlibinc)

binutils:

+# Use the system's zlib library.
+zlibdir=-L../zlib
+zlibinc="-I\$(srcdir)/../zlib"
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+zlibdir=
+zlibinc=
+)
+AC_SUBST(zlibdir)
+AC_SUBST(zlibinc)

gdb:

+# Use the system's zlib library.
+zlibdir=-L../zlib
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+zlibdir=
+)
+AC_SUBST(zlibdir)

and gcc has:

# Use the system's zlib library.
zlibdir=-L../zlib
zlibinc="-I\$(srcdir)/../zlib"
AC_ARG_WITH(system-zlib,
[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
zlibdir=
zlibinc=
)
AC_SUBST(zlibdir)
AC_SUBST(zlibinc)



They're all the same.  Just a couple doesn't define zlibdir or zlibinc.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 11:46             ` Pedro Alves
@ 2015-03-31 12:01               ` H.J. Lu
  2015-03-31 12:15                 ` Pedro Alves
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 12:01 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Binutils, GDB

On Tue, Mar 31, 2015 at 4:46 AM, Pedro Alves <palves@redhat.com> wrote:
> On 03/31/2015 12:33 PM, H.J. Lu wrote:
>> On Tue, Mar 31, 2015 at 3:53 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 03/31/2015 11:46 AM, H.J. Lu wrote:
>
>>>> It is better for Makefile.am to use what configure.ac defines
>>>
>>> That's orthogonal.  How configure.ac defines what Makefile.am
>>> consumes is the issue.  That can either be through a shared macro,
>>> which makes sure all tools have the exact same command line option
>>> (like AM_ZLIB), or you manually put the same configure.ac bits
>>> everywhere.
>>
>> They aren't the same.  Some tools like ld, which use zlib implicitly
>> via libfd and libtool, don't need to reference zlib.
>
> Sure, that one just drops AM_ZLIB.
>
>> Some only need
>> to reference zlib library.  Some only need to reference header.
>>
>
> And?  If you replace AM_ZLIB's body with:
>
> # Use the system's zlib library.
> zlibdir=-L../zlib
> zlibinc="-I\$(srcdir)/../zlib"
> AC_ARG_WITH(system-zlib,
> [AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> zlibdir=
> zlibinc=
> )
> AC_SUBST(zlibdir)
> AC_SUBST(zlibinc)
>
> then it'll work for those too.  They just won't use zlibinc
> or zlibinc if they don't need it.  Currently you have:
>
> bfd:
>
>> +# Use the system's zlib library.
>> +zlibdir=-L../zlib
>> +zlibinc="-I\$(srcdir)/../zlib"
>> +AC_ARG_WITH(system-zlib,
>> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>> +zlibdir=
>> +zlibinc=
>> +)
>> +AC_SUBST(zlibdir)
>> +AC_SUBST(zlibinc)
>
> gold:
>
> +# Use the system's zlib library.
> +zlibdir=-L../zlib
> +zlibinc="-I\$(srcdir)/../zlib"
> +AC_ARG_WITH(system-zlib,
> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> +zlibdir=
> +zlibinc=
> +)
> +AC_SUBST(zlibdir)
> +AC_SUBST(zlibinc)
>
> gas:
>
> +# Use the system's zlib library.
> +zlibinc="-I\$(srcdir)/../zlib"
> +AC_ARG_WITH(system-zlib,
> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> +zlibinc=
> +)
> +AC_SUBST(zlibinc)
>
> binutils:
>
> +# Use the system's zlib library.
> +zlibdir=-L../zlib
> +zlibinc="-I\$(srcdir)/../zlib"
> +AC_ARG_WITH(system-zlib,
> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> +zlibdir=
> +zlibinc=
> +)
> +AC_SUBST(zlibdir)
> +AC_SUBST(zlibinc)
>
> gdb:
>
> +# Use the system's zlib library.
> +zlibdir=-L../zlib
> +AC_ARG_WITH(system-zlib,
> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> +zlibdir=
> +)
> +AC_SUBST(zlibdir)
>
> and gcc has:
>
> # Use the system's zlib library.
> zlibdir=-L../zlib
> zlibinc="-I\$(srcdir)/../zlib"
> AC_ARG_WITH(system-zlib,
> [AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> zlibdir=
> zlibinc=
> )
> AC_SUBST(zlibdir)
> AC_SUBST(zlibinc)
>
>
>
> They're all the same.  Just a couple doesn't define zlibdir or zlibinc.

If zlib.m4 is changed, I will use it and GCC can also use it. But I
don't know if other packages use zlib.m4.

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 20:19                   ` H.J. Lu
@ 2015-03-31 12:08                     ` Antoine Tremblay
  0 siblings, 0 replies; 38+ messages in thread
From: Antoine Tremblay @ 2015-03-31 12:08 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB



On 03/30/2015 04:19 PM, H.J. Lu wrote:
> On Mon, Mar 30, 2015 at 12:33 PM, Antoine Tremblay
> <antoine.tremblay@ericsson.com> wrote:
>>
>> On 03/30/2015 01:36 PM, Steve Ellcey wrote:
>>>
>>> On Mon, 2015-03-30 at 10:21 -0700, H.J. Lu wrote:
>>>
>>>> master branch is fixed now.
>>>
>>>
>>> Yes, my build is working now.  Thanks.
>>
>>
>> Could there still be something missing ?
>>
>> Doing a ./configure && make on binutils-gdb I get :
>>
>> gcc -g -O2   -static-libstdc++ -static-libgcc    \
>>>      ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a
>> ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lmcheck -ldl
>> -lncurses -lm -ldl -lexpat   ../libiberty/libiberty.a
>> build-gnulib/import/libgnu.a -ldl
>> -Wl,--dynamic-list=../../gdb/proc-service.list
>> ../bfd/libbfd.a(compress.o): In function `decompress_contents':
>> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:46: undefined
>> reference to `inflateInit_'
>> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:53: undefined
>> reference to `inflate'
>> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:56: undefined
>> reference to `inflateReset'
>> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:58: undefined
>> reference to `inflateEnd'
>> ../bfd/libbfd.a(compress.o): In function `bfd_compress_section_contents':
>> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:79: undefined
>> reference to `compressBound'
>> /home/x/src/binutils-gdb/build/bfd/../../bfd/compress.c:85: undefined
>> reference to `compress'
>>                  -o gdb gdb.o ...
>>
>> Note this is with d2d67aea8e776d63a987f8dcdb96bc524df96e81
>>
>> On ubuntu 14.04
>>
>> I do see zlib being built it just seems like the .a is missing from the
>> linking... ?
>
> Have you tried users/hjl/zlib branch?
>

That branch builds... but I need to use master...

I'll have to wait until you reach an agreement with Pedro to build again 
it seems :(

Antoine

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 12:01               ` H.J. Lu
@ 2015-03-31 12:15                 ` Pedro Alves
  2015-03-31 13:43                   ` H.J. Lu
  0 siblings, 1 reply; 38+ messages in thread
From: Pedro Alves @ 2015-03-31 12:15 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

On 03/31/2015 01:01 PM, H.J. Lu wrote:
>> >
>> >
>> > They're all the same.  Just a couple doesn't define zlibdir or zlibinc.
> If zlib.m4 is changed, I will use it and GCC can also use it. But I
> don't know if other packages use zlib.m4.

Please change it.  Packages not in the tree can replace zlib.m4 with
something else if they need it, or adjust to the new body, and thus
end up consistent with the rest of the toolchain.

"git blame" shows that zlib.m4 was invented exactly to make
sure bfd/gdb use the same zlib switches and checks:

 https://sourceware.org/ml/binutils/2009-10/msg00600.html

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 12:15                 ` Pedro Alves
@ 2015-03-31 13:43                   ` H.J. Lu
  2015-03-31 13:46                     ` Pedro Alves
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 13:43 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Binutils, GDB

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

On Tue, Mar 31, 2015 at 5:15 AM, Pedro Alves <palves@redhat.com> wrote:
> On 03/31/2015 01:01 PM, H.J. Lu wrote:
>>> >
>>> >
>>> > They're all the same.  Just a couple doesn't define zlibdir or zlibinc.
>> If zlib.m4 is changed, I will use it and GCC can also use it. But I
>> don't know if other packages use zlib.m4.
>
> Please change it.  Packages not in the tree can replace zlib.m4 with
> something else if they need it, or adjust to the new body, and thus
> end up consistent with the rest of the toolchain.
>
> "git blame" shows that zlib.m4 was invented exactly to make
> sure bfd/gdb use the same zlib switches and checks:
>
>  https://sourceware.org/ml/binutils/2009-10/msg00600.html
>

These are changes I checked in.

Thanks.


-- 
H.J.

[-- Attachment #2: 0001-Replace-with-zlib-with-with-system-zlib.patch --]
[-- Type: text/x-patch, Size: 1960 bytes --]

From fa1f5da0b6ff3622f9bf60e348e149b76920abba Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:53:39 -0700
Subject: [PATCH 1/7] Replace --with-zlib with --with-system-zlib

	* zlib.m4 (AM_ZLIB): Replace --with-zlib with --with-system-zlib.
---
 config/ChangeLog |  4 ++++
 config/zlib.m4   | 27 +++++++++++++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/config/ChangeLog b/config/ChangeLog
index 8a8386d..945f080 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* zlib.m4 (AM_ZLIB): Replace --with-zlib with --with-system-zlib.
+
 2015-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* isl.m4: Sync with GCC tree.
diff --git a/config/zlib.m4 b/config/zlib.m4
index b017499..3664295 100644
--- a/config/zlib.m4
+++ b/config/zlib.m4
@@ -1,18 +1,17 @@
-dnl A function to check for zlib availability.  zlib is used by default
-dnl unless the user configured with --disable-nls.
+dnl A function to check if the system's zlib library should be used.  The
+dnl builtin zlib dnl is used by default unless the user configured with
+dnl --with-system-zlib.
 
 AC_DEFUN([AM_ZLIB],
 [
-  # See if the user specified whether he wants zlib support or not.
-  AC_ARG_WITH(zlib,
-    [  --with-zlib             include zlib support (auto/yes/no) [default=auto]],
-    [], [with_zlib=auto])
-
-  if test "$with_zlib" != "no"; then
-    AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
-    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
-      AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found])
-    fi
-  fi
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
+  AC_ARG_WITH(system-zlib,
+  [AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+  zlibdir=
+  zlibinc=
+  )
+  AC_SUBST(zlibdir)
+  AC_SUBST(zlibinc)
 ])
-
-- 
2.1.0


[-- Attachment #3: 0002-Revert-the-AM_ZLIB-change-in-bfd.patch --]
[-- Type: text/x-patch, Size: 4128 bytes --]

From 9ae46699504c63af285d40ad8856a29300d318e4 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:54:55 -0700
Subject: [PATCH 2/7] Revert the AM_ZLIB change in bfd

	* configure.ac: Revert the AM_ZLIB change.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
---
 bfd/ChangeLog       |  8 ++++++++
 bfd/Makefile.in     |  3 ++-
 bfd/aclocal.m4      |  1 +
 bfd/configure       | 12 ++++++++----
 bfd/configure.ac    | 13 +++----------
 bfd/doc/Makefile.in |  3 ++-
 6 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 25bec34..52ee750 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure.ac: Revert the AM_ZLIB change.
+	* Makefile.in: Regenerated.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+	* doc/Makefile.in: Likewise.
+
 2015-03-30  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/18169
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 92eb33d..aac3eb2 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -75,7 +75,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index d9e743e..d3243c6 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -979,6 +979,7 @@ m4_include([../config/plugins.m4])
 m4_include([../config/po.m4])
 m4_include([../config/progtest.m4])
 m4_include([../config/stdint.m4])
+m4_include([../config/zlib.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/bfd/configure b/bfd/configure
index b8f1b2b..2231e78 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -13853,20 +13853,24 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# Use the system's zlib library.
-zlibdir=-L../zlib
-zlibinc="-I\$(srcdir)/../zlib"
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+# This is used only by compress.c.
+
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
 
 # Check whether --with-system-zlib was given.
 if test "${with_system_zlib+set}" = set; then :
   withval=$with_system_zlib; zlibdir=
-zlibinc=
+  zlibinc=
 
 fi
 
 
 
 
+
 # If we are configured native, pick a core file support file.
 COREFILE=
 COREFLAG=
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 5426781..a1b2035 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -236,16 +236,9 @@ AC_CHECK_DECLS(snprintf)
 AC_CHECK_DECLS(vsnprintf)
 AC_CHECK_DECLS(strnlen)
 
-# Use the system's zlib library.
-zlibdir=-L../zlib
-zlibinc="-I\$(srcdir)/../zlib"
-AC_ARG_WITH(system-zlib,
-[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
-zlibdir=
-zlibinc=
-)
-AC_SUBST(zlibdir)
-AC_SUBST(zlibinc)
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+# This is used only by compress.c.
+AM_ZLIB
 
 # If we are configured native, pick a core file support file.
 COREFILE=
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 6038113..cb9a214 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -71,7 +71,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
-- 
2.1.0


[-- Attachment #4: 0003-Revert-the-AM_ZLIB-change-in-binutils.patch --]
[-- Type: text/x-patch, Size: 3846 bytes --]

From ed2b5077eb36d82ad7763d76fdd8e82d15f72b7a Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:55:46 -0700
Subject: [PATCH 3/7] Revert the AM_ZLIB change in binutils

	* configure.ac: Revert the AM_ZLIB change.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
---
 binutils/ChangeLog    |  7 +++++++
 binutils/Makefile.in  |  6 +++---
 binutils/aclocal.m4   |  1 +
 binutils/configure    | 13 +++++++++----
 binutils/configure.ac | 14 ++++----------
 5 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e0a3d51..bd3890c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,12 @@
 2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* configure.ac: Revert the AM_ZLIB change.
+	* Makefile.in: Regenerated.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* Makefile.am (ZLIB): New.
 	(ZLIBINC): Likewise.
 	(AM_CFLAGS): Add $(ZLIBINC).
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index d675b79..2c4d81b 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -88,9 +88,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4
index fd838a6..074b2ca 100644
--- a/binutils/aclocal.m4
+++ b/binutils/aclocal.m4
@@ -1006,6 +1006,7 @@ m4_include([../config/override.m4])
 m4_include([../config/plugins.m4])
 m4_include([../config/po.m4])
 m4_include([../config/progtest.m4])
+m4_include([../config/zlib.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/binutils/configure b/binutils/configure
index ad3948c..0fc173b 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -13538,14 +13538,18 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# Use the system's zlib library.
-zlibdir=-L../zlib
-zlibinc="-I\$(srcdir)/../zlib"
+# Link in zlib if we can.  This allows us to read compressed debug
+# sections.  This is used only by readelf.c (objdump uses bfd for
+# reading compressed sections).
+
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
 
 # Check whether --with-system-zlib was given.
 if test "${with_system_zlib+set}" = set; then :
   withval=$with_system_zlib; zlibdir=
-zlibinc=
+  zlibinc=
 
 fi
 
@@ -13553,6 +13557,7 @@ fi
 
 
 
+
 case "${host}" in
 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
 
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 0677f9a..31864ec 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -201,16 +201,10 @@ fi
 AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv,
 		sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
 
-# Use the system's zlib library.
-zlibdir=-L../zlib
-zlibinc="-I\$(srcdir)/../zlib"
-AC_ARG_WITH(system-zlib,
-[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
-zlibdir=
-zlibinc=
-)
-AC_SUBST(zlibdir)
-AC_SUBST(zlibinc)
+# Link in zlib if we can.  This allows us to read compressed debug
+# sections.  This is used only by readelf.c (objdump uses bfd for
+# reading compressed sections).
+AM_ZLIB
 
 BFD_BINARY_FOPEN
 
-- 
2.1.0


[-- Attachment #5: 0004-Revert-the-AM_ZLIB-change-in-gas.patch --]
[-- Type: text/x-patch, Size: 5877 bytes --]

From 543b793377eb8c64f8c4e0e68cd3e6b39e857051 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:55:18 -0700
Subject: [PATCH 4/7] Revert the AM_ZLIB change in gas

	* configure.ac: Revert the AM_ZLIB change.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
---
 gas/ChangeLog       |  7 +++++++
 gas/Makefile.in     | 10 ++++++----
 gas/aclocal.m4      |  1 +
 gas/configure       | 17 ++++++++++++-----
 gas/configure.ac    |  9 ++-------
 gas/doc/Makefile.in | 10 ++++++----
 6 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 4c2a20d..e5b1cd5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,12 @@
 2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* configure.ac: Revert the AM_ZLIB change.
+	* Makefile.in: Regenerated.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* Makefile.am (ZLIBINC): New.
 	(AM_CFLAGS): Add $(ZLIBINC).
 	* as.c: (show_usage): Don't check HAVE_ZLIB_H.
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 240d7d9..1efdb5c 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -77,10 +77,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../bfd/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -297,6 +298,7 @@ te_file = @te_file@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+zlibdir = @zlibdir@
 zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = 1.11 dejagnu foreign no-dist
 ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
diff --git a/gas/aclocal.m4 b/gas/aclocal.m4
index ea731ac..53da7c7 100644
--- a/gas/aclocal.m4
+++ b/gas/aclocal.m4
@@ -1002,6 +1002,7 @@ m4_include([../config/override.m4])
 m4_include([../config/plugins.m4])
 m4_include([../config/po.m4])
 m4_include([../config/progtest.m4])
+m4_include([../config/zlib.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/gas/configure b/gas/configure
index 07bcee0..002891d 100755
--- a/gas/configure
+++ b/gas/configure
@@ -603,6 +603,7 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 zlibinc
+zlibdir
 LIBM
 ALLOCA
 GENINSRC_NEVER_FALSE
@@ -10968,7 +10969,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10971 "configure"
+#line 10972 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11074,7 +11075,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11077 "configure"
+#line 11078 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14320,17 +14321,23 @@ $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
  ;;
 esac
 
-# Use the system's zlib library.
-zlibinc="-I\$(srcdir)/../zlib"
+# Link in zlib if we can.  This allows us to write compressed debug sections.
+
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
 
 # Check whether --with-system-zlib was given.
 if test "${with_system_zlib+set}" = set; then :
-  withval=$with_system_zlib; zlibinc=
+  withval=$with_system_zlib; zlibdir=
+  zlibinc=
 
 fi
 
 
 
+
+
 # Support for VMS timestamps via cross compile
 
 if test "$ac_cv_header_time_h" = yes; then
diff --git a/gas/configure.ac b/gas/configure.ac
index fbe8c0b..8e05fb8 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -816,13 +816,8 @@ AC_CHECK_DECLS([free, getenv, malloc, mempcpy, realloc, stpcpy, strstr, vsnprint
 
 BFD_BINARY_FOPEN
 
-# Use the system's zlib library.
-zlibinc="-I\$(srcdir)/../zlib"
-AC_ARG_WITH(system-zlib,
-[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
-zlibinc=
-)
-AC_SUBST(zlibinc)
+# Link in zlib if we can.  This allows us to write compressed debug sections.
+AM_ZLIB
 
 # Support for VMS timestamps via cross compile
 
diff --git a/gas/doc/Makefile.in b/gas/doc/Makefile.in
index 49ddf94..3018dcc 100644
--- a/gas/doc/Makefile.in
+++ b/gas/doc/Makefile.in
@@ -68,10 +68,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../bfd/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -266,6 +267,7 @@ te_file = @te_file@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+zlibdir = @zlibdir@
 zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = 1.8 cygnus
 
-- 
2.1.0


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 13:43                   ` H.J. Lu
@ 2015-03-31 13:46                     ` Pedro Alves
  0 siblings, 0 replies; 38+ messages in thread
From: Pedro Alves @ 2015-03-31 13:46 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

On 03/31/2015 02:43 PM, H.J. Lu wrote:
> On Tue, Mar 31, 2015 at 5:15 AM, Pedro Alves <palves@redhat.com> wrote:
>> On 03/31/2015 01:01 PM, H.J. Lu wrote:
>>>>>
>>>>>
>>>>> They're all the same.  Just a couple doesn't define zlibdir or zlibinc.
>>> If zlib.m4 is changed, I will use it and GCC can also use it. But I
>>> don't know if other packages use zlib.m4.
>>
>> Please change it.  Packages not in the tree can replace zlib.m4 with
>> something else if they need it, or adjust to the new body, and thus
>> end up consistent with the rest of the toolchain.
>>
>> "git blame" shows that zlib.m4 was invented exactly to make
>> sure bfd/gdb use the same zlib switches and checks:
>>
>>  https://sourceware.org/ml/binutils/2009-10/msg00600.html
>>
> 
> These are changes I checked in.

Thank you.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 10:10   ` H.J. Lu
  2015-03-31 10:37     ` Pedro Alves
@ 2015-03-31 16:41     ` Mike Frysinger
  2015-03-31 16:56       ` H.J. Lu
  1 sibling, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2015-03-31 16:41 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]

On 31 Mar 2015 03:10, H.J. Lu wrote:
> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger wrote:
> > On 26 Mar 2015 08:57, H.J. Lu wrote:
> >> --- a/bfd/configure.ac
> >> +++ b/bfd/configure.ac
> >>
> >> -# Link in zlib if we can.  This allows us to read compressed debug sections.
> >> -# This is used only by compress.c.
> >> -AM_ZLIB
> >> +# Use the system's zlib library.
> >> +zlibdir=-L../zlib
> >> +zlibinc="-I\$(srcdir)/../zlib"
> >> +AC_ARG_WITH(system-zlib,
> >> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> >> +zlibdir=
> >> +zlibinc=
> >> +)
> >
> > this is wrong.  the 3rd arg is whether the option was specified, not that the
> > option was disabled.  you need to check $withval is equal to "no" (or not equal
> > to "yes").
> 
> That is what gcc/configure.ac has and it works for me.

then gcc/configure.ac is also broken.  whether "it works for me" is
irrelevant -- simply read the code and you'll see it's wrong.  if you
pass --without-system-zlib the code wrongly behaves as if you passed
--with-system-zlib.

i mention this because it is breaking my test builds.  not that that
really matters -- the code is clearly incorrect.
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 16:41     ` Mike Frysinger
@ 2015-03-31 16:56       ` H.J. Lu
  2015-03-31 17:01         ` Mike Frysinger
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 16:56 UTC (permalink / raw)
  To: Binutils, GDB

On Tue, Mar 31, 2015 at 9:41 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 31 Mar 2015 03:10, H.J. Lu wrote:
>> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger wrote:
>> > On 26 Mar 2015 08:57, H.J. Lu wrote:
>> >> --- a/bfd/configure.ac
>> >> +++ b/bfd/configure.ac
>> >>
>> >> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>> >> -# This is used only by compress.c.
>> >> -AM_ZLIB
>> >> +# Use the system's zlib library.
>> >> +zlibdir=-L../zlib
>> >> +zlibinc="-I\$(srcdir)/../zlib"
>> >> +AC_ARG_WITH(system-zlib,
>> >> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>> >> +zlibdir=
>> >> +zlibinc=
>> >> +)
>> >
>> > this is wrong.  the 3rd arg is whether the option was specified, not that the
>> > option was disabled.  you need to check $withval is equal to "no" (or not equal
>> > to "yes").
>>
>> That is what gcc/configure.ac has and it works for me.
>
> then gcc/configure.ac is also broken.  whether "it works for me" is
> irrelevant -- simply read the code and you'll see it's wrong.  if you
> pass --without-system-zlib the code wrongly behaves as if you passed
> --with-system-zlib.
>
> i mention this because it is breaking my test builds.  not that that
> really matters -- the code is clearly incorrect.

We should fix zlib.m4 and use it in gcc/configure.ac.

FWIW, I tested with -with-system-zlib and without --with-system-zlib.

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 16:56       ` H.J. Lu
@ 2015-03-31 17:01         ` Mike Frysinger
  2015-03-31 17:04           ` H.J. Lu
  0 siblings, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2015-03-31 17:01 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, GDB

[-- Attachment #1: Type: text/plain, Size: 1808 bytes --]

On 31 Mar 2015 09:56, H.J. Lu wrote:
> On Tue, Mar 31, 2015 at 9:41 AM, Mike Frysinger wrote:
> > On 31 Mar 2015 03:10, H.J. Lu wrote:
> >> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger wrote:
> >> > On 26 Mar 2015 08:57, H.J. Lu wrote:
> >> >> --- a/bfd/configure.ac
> >> >> +++ b/bfd/configure.ac
> >> >>
> >> >> -# Link in zlib if we can.  This allows us to read compressed debug sections.
> >> >> -# This is used only by compress.c.
> >> >> -AM_ZLIB
> >> >> +# Use the system's zlib library.
> >> >> +zlibdir=-L../zlib
> >> >> +zlibinc="-I\$(srcdir)/../zlib"
> >> >> +AC_ARG_WITH(system-zlib,
> >> >> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
> >> >> +zlibdir=
> >> >> +zlibinc=
> >> >> +)
> >> >
> >> > this is wrong.  the 3rd arg is whether the option was specified, not that the
> >> > option was disabled.  you need to check $withval is equal to "no" (or not equal
> >> > to "yes").
> >>
> >> That is what gcc/configure.ac has and it works for me.
> >
> > then gcc/configure.ac is also broken.  whether "it works for me" is
> > irrelevant -- simply read the code and you'll see it's wrong.  if you
> > pass --without-system-zlib the code wrongly behaves as if you passed
> > --with-system-zlib.
> >
> > i mention this because it is breaking my test builds.  not that that
> > really matters -- the code is clearly incorrect.
> 
> We should fix zlib.m4 and use it in gcc/configure.ac.

sure; i await your patches ;).  i'm not trying to point fingers here for
pointing's sake -- binutils & gdb were working before and now they're broken,
and they broke due to the zlib patches you merged.  so i think it's reasonable
to expect you to drive further fixes (probably across gcc) even though the bug 
has existed in gcc for sometime.
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 17:01         ` Mike Frysinger
@ 2015-03-31 17:04           ` H.J. Lu
  0 siblings, 0 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 17:04 UTC (permalink / raw)
  To: Binutils, GDB

On Tue, Mar 31, 2015 at 10:01 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 31 Mar 2015 09:56, H.J. Lu wrote:
>> On Tue, Mar 31, 2015 at 9:41 AM, Mike Frysinger wrote:
>> > On 31 Mar 2015 03:10, H.J. Lu wrote:
>> >> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger wrote:
>> >> > On 26 Mar 2015 08:57, H.J. Lu wrote:
>> >> >> --- a/bfd/configure.ac
>> >> >> +++ b/bfd/configure.ac
>> >> >>
>> >> >> -# Link in zlib if we can.  This allows us to read compressed debug sections.
>> >> >> -# This is used only by compress.c.
>> >> >> -AM_ZLIB
>> >> >> +# Use the system's zlib library.
>> >> >> +zlibdir=-L../zlib
>> >> >> +zlibinc="-I\$(srcdir)/../zlib"
>> >> >> +AC_ARG_WITH(system-zlib,
>> >> >> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>> >> >> +zlibdir=
>> >> >> +zlibinc=
>> >> >> +)
>> >> >
>> >> > this is wrong.  the 3rd arg is whether the option was specified, not that the
>> >> > option was disabled.  you need to check $withval is equal to "no" (or not equal
>> >> > to "yes").
>> >>
>> >> That is what gcc/configure.ac has and it works for me.
>> >
>> > then gcc/configure.ac is also broken.  whether "it works for me" is
>> > irrelevant -- simply read the code and you'll see it's wrong.  if you
>> > pass --without-system-zlib the code wrongly behaves as if you passed
>> > --with-system-zlib.
>> >
>> > i mention this because it is breaking my test builds.  not that that
>> > really matters -- the code is clearly incorrect.
>>
>> We should fix zlib.m4 and use it in gcc/configure.ac.
>
> sure; i await your patches ;).  i'm not trying to point fingers here for
> pointing's sake -- binutils & gdb were working before and now they're broken,
> and they broke due to the zlib patches you merged.  so i think it's reasonable
> to expect you to drive further fixes (probably across gcc) even though the bug
> has existed in gcc for sometime.

Sure.  I have put it in my queue.

Sorry for the inconvenience.


-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-30 19:37                   ` Antoine Tremblay
@ 2015-03-31 17:13                     ` Antoine Tremblay
  2015-03-31 17:16                       ` H.J. Lu
  0 siblings, 1 reply; 38+ messages in thread
From: Antoine Tremblay @ 2015-03-31 17:13 UTC (permalink / raw)
  To: gdb-patches, hjl.tools

>Also doing ./configure in binutils/zlib I get :
>
> config.status: creating Makefile
> config.status: executing default-1 commands
> ./config.status: line 1190: ./../../config-ml.in: No such file or directory
>
> So configure does not exit cleanly...ideas?
>
>

I did a bit more research on this issue and I get this if I build gdb 
from it's source directory

in binutils-gdb
./configure
make

make fails with : while in zlib directory

configure: creating ./config.status
config.status: creating Makefile
config.status: executing default-1 commands
./config.status: line 1190: ./../../config-ml.in: No such file or directory

However if I build out of tree in like binutils-gdb/build for example I 
do not get this issue.

Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?

Subject: [PATCH 09/76] A zlib to tarball

I see this snippet there

-    ./configure --target=i386-pc-linux-gnu
+    ./configure --target=i386-pc-linux-gnu \
+       --with-target-subdir=. \
+       --disable-multilib

With these options I get around the configure problem only to fail in 
gas with :
make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
/bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall 
-Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g 
-O2  -static-libstdc++ -static-libgcc  -o as-new app.o as.o 
atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o 
ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o 
frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o 
messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o 
write.o tc-i386.o obj-elf.o atof-ieee.o  ../opcodes/libopcodes.la 
../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes 
-Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o 
as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o 
dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o 
flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o 
listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o 
stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o 
../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a 
-L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
/usr/bin/ld: cannot find -lz


This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e

Did you try to compile directly in the src tree ?



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 17:13                     ` Antoine Tremblay
@ 2015-03-31 17:16                       ` H.J. Lu
  2015-03-31 17:18                         ` Antoine Tremblay
  0 siblings, 1 reply; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 17:16 UTC (permalink / raw)
  To: Antoine Tremblay; +Cc: GDB

On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
<antoine.tremblay@ericsson.com> wrote:
>> Also doing ./configure in binutils/zlib I get :
>>
>> config.status: creating Makefile
>> config.status: executing default-1 commands
>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>> directory
>>
>> So configure does not exit cleanly...ideas?
>>
>>
>
> I did a bit more research on this issue and I get this if I build gdb from
> it's source directory
>
> in binutils-gdb
> ./configure
> make
>
> make fails with : while in zlib directory
>
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: executing default-1 commands
> ./config.status: line 1190: ./../../config-ml.in: No such file or directory
>
> However if I build out of tree in like binutils-gdb/build for example I do
> not get this issue.
>
> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>
> Subject: [PATCH 09/76] A zlib to tarball
>
> I see this snippet there
>
> -    ./configure --target=i386-pc-linux-gnu
> +    ./configure --target=i386-pc-linux-gnu \
> +       --with-target-subdir=. \
> +       --disable-multilib
>
> With these options I get around the configure problem only to fail in gas
> with :
> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes
> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2  -static-libstdc++
> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o cond.o
> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o
> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o
> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
> /usr/bin/ld: cannot find -lz
>
>
> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>
> Did you try to compile directly in the src tree ?
>

Yes, I did.  You need to add --disable-multilib,  and maybe
--with-target-subdir=.

-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 17:16                       ` H.J. Lu
@ 2015-03-31 17:18                         ` Antoine Tremblay
  2015-03-31 18:55                           ` H.J. Lu
  2015-03-31 20:16                           ` H.J. Lu
  0 siblings, 2 replies; 38+ messages in thread
From: Antoine Tremblay @ 2015-03-31 17:18 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB



On 03/31/2015 01:16 PM, H.J. Lu wrote:
> On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
> <antoine.tremblay@ericsson.com> wrote:
>>> Also doing ./configure in binutils/zlib I get :
>>>
>>> config.status: creating Makefile
>>> config.status: executing default-1 commands
>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>> directory
>>>
>>> So configure does not exit cleanly...ideas?
>>>
>>>
>>
>> I did a bit more research on this issue and I get this if I build gdb from
>> it's source directory
>>
>> in binutils-gdb
>> ./configure
>> make
>>
>> make fails with : while in zlib directory
>>
>> configure: creating ./config.status
>> config.status: creating Makefile
>> config.status: executing default-1 commands
>> ./config.status: line 1190: ./../../config-ml.in: No such file or directory
>>
>> However if I build out of tree in like binutils-gdb/build for example I do
>> not get this issue.
>>
>> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>>
>> Subject: [PATCH 09/76] A zlib to tarball
>>
>> I see this snippet there
>>
>> -    ./configure --target=i386-pc-linux-gnu
>> +    ./configure --target=i386-pc-linux-gnu \
>> +       --with-target-subdir=. \
>> +       --disable-multilib
>>
>> With these options I get around the configure problem only to fail in gas
>> with :
>> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
>> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes
>> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2  -static-libstdc++
>> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o cond.o
>> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
>> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
>> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
>> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
>> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
>> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
>> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o
>> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o
>> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
>> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
>> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
>> /usr/bin/ld: cannot find -lz
>>
>>
>> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>>
>> Did you try to compile directly in the src tree ?
>>
>
> Yes, I did.  You need to add --disable-multilib,  and maybe
> --with-target-subdir=.
>

As I said if I add  --disable-multilib, -with-target-subdir=.

I get into the gas missing zlib error above ?

Also I don't think it's a good idea that gdb would require options to 
compile in it's source tree ?

Is there a good reason for this ?


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 17:18                         ` Antoine Tremblay
@ 2015-03-31 18:55                           ` H.J. Lu
  2015-03-31 20:16                           ` H.J. Lu
  1 sibling, 0 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 18:55 UTC (permalink / raw)
  To: Antoine Tremblay, Binutils; +Cc: GDB

[-- Attachment #1: Type: text/plain, Size: 3581 bytes --]

On Tue, Mar 31, 2015 at 10:18 AM, Antoine Tremblay
<antoine.tremblay@ericsson.com> wrote:
>
>
> On 03/31/2015 01:16 PM, H.J. Lu wrote:
>>
>> On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
>> <antoine.tremblay@ericsson.com> wrote:
>>>>
>>>> Also doing ./configure in binutils/zlib I get :
>>>>
>>>> config.status: creating Makefile
>>>> config.status: executing default-1 commands
>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>> directory
>>>>
>>>> So configure does not exit cleanly...ideas?
>>>>
>>>>
>>>
>>> I did a bit more research on this issue and I get this if I build gdb
>>> from
>>> it's source directory
>>>
>>> in binutils-gdb
>>> ./configure
>>> make
>>>
>>> make fails with : while in zlib directory
>>>
>>> configure: creating ./config.status
>>> config.status: creating Makefile
>>> config.status: executing default-1 commands
>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>> directory
>>>
>>> However if I build out of tree in like binutils-gdb/build for example I
>>> do
>>> not get this issue.
>>>
>>> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>>>
>>> Subject: [PATCH 09/76] A zlib to tarball
>>>
>>> I see this snippet there
>>>
>>> -    ./configure --target=i386-pc-linux-gnu
>>> +    ./configure --target=i386-pc-linux-gnu \
>>> +       --with-target-subdir=. \
>>> +       --disable-multilib
>>>
>>> With these options I get around the configure problem only to fail in gas
>>> with :
>>> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
>>> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall
>>> -Wstrict-prototypes
>>> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2
>>> -static-libstdc++
>>> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o
>>> cond.o
>>> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
>>> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
>>> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
>>> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
>>> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
>>> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
>>> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>> flonum-konst.o
>>> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o
>>> literal.o
>>> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
>>> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
>>> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
>>> /usr/bin/ld: cannot find -lz
>>>
>>>
>>> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>>>
>>> Did you try to compile directly in the src tree ?
>>>
>>
>> Yes, I did.  You need to add --disable-multilib,  and maybe
>> --with-target-subdir=.
>>
>
> As I said if I add  --disable-multilib, -with-target-subdir=.
>
> I get into the gas missing zlib error above ?
>
> Also I don't think it's a good idea that gdb would require options to
> compile in it's source tree ?
>
> Is there a good reason for this ?
>

config/multi.m4 doesn't support building a library for host.
These 3 patches fix it.  I am testing config/multi.m4 in GCC.
If it passes GCC multilib build, I will check them into
binutils-gdb and submit them to GCC.



-- 
H.J.

[-- Attachment #2: 0001-Add-multilib-support-code-only-for-target.patch --]
[-- Type: text/x-patch, Size: 1216 bytes --]

From 536b7827f475462828a6c7d33944f2e1d1fb2336 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 11:34:01 -0700
Subject: [PATCH 1/3] Add multilib support code only for target

	* multi.m4 (AC_OUTPUT_COMMANDS): Don't add multilib support code
	if ${multi_basedir}/config-ml.in doesn't exist.
---
 config/multi.m4 | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/config/multi.m4 b/config/multi.m4
index 5b62ecc..53993c3 100644
--- a/config/multi.m4
+++ b/config/multi.m4
@@ -46,12 +46,15 @@ fi
 
 AC_OUTPUT_COMMANDS([
 # Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" ]m4_default([$1],Makefile)[ "*)
-   ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
-   ;;
-esac],
+# Makefile.  If ${multi_basedir}/config-ml.in doesn't exist, we aren't
+# building for target and we don't add multilib support code.
+if test -f ${multi_basedir}/config-ml.in; then
+  case " $CONFIG_FILES " in
+   *" ]m4_default([$1],Makefile)[ "*)
+     ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
+     ;;
+  esac
+fi],
 		   [
 srcdir="$srcdir"
 host="$host"
-- 
1.9.3


[-- Attachment #3: 0002-Regerate-configure-in-zlib.patch --]
[-- Type: text/x-patch, Size: 1268 bytes --]

From 758ccd879f8d8680be26c3e654f54319f3f6a6c3 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 11:35:30 -0700
Subject: [PATCH 2/3] Regerate configure in zlib

	* configure: Regenerated.
---
 zlib/configure | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/zlib/configure b/zlib/configure
index 1a9d854..e739ddd 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -12644,12 +12644,15 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
   case $ac_file$ac_mode in
     "default-1":C)
 # Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" Makefile "*)
-   ac_file=Makefile . ${multi_basedir}/config-ml.in
-   ;;
-esac ;;
+# Makefile.  If ${multi_basedir}/config-ml.in doesn't exist, we aren't
+# building for target, we don't add multilib support code.
+if test -f ${multi_basedir}/config-ml.in; then
+  case " $CONFIG_FILES " in
+   *" Makefile "*)
+     ac_file=Makefile . ${multi_basedir}/config-ml.in
+     ;;
+  esac
+fi ;;
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
   # Autoconf 2.62 quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
-- 
1.9.3


[-- Attachment #4: 0003-Remove-with-target-subdir-.-disable-multilib.patch --]
[-- Type: text/x-patch, Size: 939 bytes --]

From 988209efe245075f3f492e00193a9c2622f0b16e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 11:36:17 -0700
Subject: [PATCH 3/3] Remove --with-target-subdir=. --disable-multilib

zlib/configure is updated to properly handle in-tree build for host.

	* src-release.sh: Don't configure with  --with-target-subdir=.
	--disable-multilib.
---
 src-release.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src-release.sh b/src-release.sh
index 8229e15..9b985f0 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -83,9 +83,7 @@ do_proto_toplev()
 	<Makefile.in >tmp
     mv -f tmp Makefile.in
     #
-    ./configure --target=i386-pc-linux-gnu \
-	--with-target-subdir=. \
-	--disable-multilib
+    ./configure --target=i386-pc-linux-gnu
     $MAKE configure-host configure-target \
 	ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
 	CC_FOR_TARGET="$CC" CXX_FOR_TARGET="$CXX"
-- 
1.9.3


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 17:18                         ` Antoine Tremblay
  2015-03-31 18:55                           ` H.J. Lu
@ 2015-03-31 20:16                           ` H.J. Lu
  2015-04-01 12:18                             ` Antoine Tremblay
  2015-04-02  3:22                             ` Bin.Cheng
  1 sibling, 2 replies; 38+ messages in thread
From: H.J. Lu @ 2015-03-31 20:16 UTC (permalink / raw)
  To: Antoine Tremblay; +Cc: GDB

On Tue, Mar 31, 2015 at 10:18 AM, Antoine Tremblay
<antoine.tremblay@ericsson.com> wrote:
>
>
> On 03/31/2015 01:16 PM, H.J. Lu wrote:
>>
>> On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
>> <antoine.tremblay@ericsson.com> wrote:
>>>>
>>>> Also doing ./configure in binutils/zlib I get :
>>>>
>>>> config.status: creating Makefile
>>>> config.status: executing default-1 commands
>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>> directory
>>>>
>>>> So configure does not exit cleanly...ideas?
>>>>
>>>>
>>>
>>> I did a bit more research on this issue and I get this if I build gdb
>>> from
>>> it's source directory
>>>
>>> in binutils-gdb
>>> ./configure
>>> make
>>>
>>> make fails with : while in zlib directory
>>>
>>> configure: creating ./config.status
>>> config.status: creating Makefile
>>> config.status: executing default-1 commands
>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>> directory
>>>
>>> However if I build out of tree in like binutils-gdb/build for example I
>>> do
>>> not get this issue.
>>>
>>> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>>>
>>> Subject: [PATCH 09/76] A zlib to tarball
>>>
>>> I see this snippet there
>>>
>>> -    ./configure --target=i386-pc-linux-gnu
>>> +    ./configure --target=i386-pc-linux-gnu \
>>> +       --with-target-subdir=. \
>>> +       --disable-multilib
>>>
>>> With these options I get around the configure problem only to fail in gas
>>> with :
>>> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
>>> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall
>>> -Wstrict-prototypes
>>> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2
>>> -static-libstdc++
>>> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o
>>> cond.o
>>> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
>>> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
>>> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
>>> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
>>> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
>>> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
>>> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>> flonum-konst.o
>>> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o
>>> literal.o
>>> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
>>> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
>>> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
>>> /usr/bin/ld: cannot find -lz
>>>
>>>
>>> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>>>
>>> Did you try to compile directly in the src tree ?
>>>
>>
>> Yes, I did.  You need to add --disable-multilib,  and maybe
>> --with-target-subdir=.
>>
>
> As I said if I add  --disable-multilib, -with-target-subdir=.
>
> I get into the gas missing zlib error above ?
>
> Also I don't think it's a good idea that gdb would require options to
> compile in it's source tree ?
>
> Is there a good reason for this ?
>
>

It should be fixed now.


-- 
H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 20:16                           ` H.J. Lu
@ 2015-04-01 12:18                             ` Antoine Tremblay
  2015-04-02  3:22                             ` Bin.Cheng
  1 sibling, 0 replies; 38+ messages in thread
From: Antoine Tremblay @ 2015-04-01 12:18 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB



On 03/31/2015 04:16 PM, H.J. Lu wrote:
> On Tue, Mar 31, 2015 at 10:18 AM, Antoine Tremblay
> <antoine.tremblay@ericsson.com> wrote:
>>
>>
>> On 03/31/2015 01:16 PM, H.J. Lu wrote:
>>>
>>> On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
>>> <antoine.tremblay@ericsson.com> wrote:
>>>>>
>>>>> Also doing ./configure in binutils/zlib I get :
>>>>>
>>>>> config.status: creating Makefile
>>>>> config.status: executing default-1 commands
>>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>>> directory
>>>>>
>>>>> So configure does not exit cleanly...ideas?
>>>>>
>>>>>
>>>>
>>>> I did a bit more research on this issue and I get this if I build gdb
>>>> from
>>>> it's source directory
>>>>
>>>> in binutils-gdb
>>>> ./configure
>>>> make
>>>>
>>>> make fails with : while in zlib directory
>>>>
>>>> configure: creating ./config.status
>>>> config.status: creating Makefile
>>>> config.status: executing default-1 commands
>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>> directory
>>>>
>>>> However if I build out of tree in like binutils-gdb/build for example I
>>>> do
>>>> not get this issue.
>>>>
>>>> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>>>>
>>>> Subject: [PATCH 09/76] A zlib to tarball
>>>>
>>>> I see this snippet there
>>>>
>>>> -    ./configure --target=i386-pc-linux-gnu
>>>> +    ./configure --target=i386-pc-linux-gnu \
>>>> +       --with-target-subdir=. \
>>>> +       --disable-multilib
>>>>
>>>> With these options I get around the configure problem only to fail in gas
>>>> with :
>>>> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
>>>> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall
>>>> -Wstrict-prototypes
>>>> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2
>>>> -static-libstdc++
>>>> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o
>>>> cond.o
>>>> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>>> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
>>>> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
>>>> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>>> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
>>>> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
>>>> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
>>>> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
>>>> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>>> flonum-konst.o
>>>> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o
>>>> literal.o
>>>> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
>>>> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>>> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
>>>> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
>>>> /usr/bin/ld: cannot find -lz
>>>>
>>>>
>>>> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>>>>
>>>> Did you try to compile directly in the src tree ?
>>>>
>>>
>>> Yes, I did.  You need to add --disable-multilib,  and maybe
>>> --with-target-subdir=.
>>>
>>
>> As I said if I add  --disable-multilib, -with-target-subdir=.
>>
>> I get into the gas missing zlib error above ?
>>
>> Also I don't think it's a good idea that gdb would require options to
>> compile in it's source tree ?
>>
>> Is there a good reason for this ?
>>
>>
>
> It should be fixed now.
>

It is indeed , thanks :)

Antoine

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-03-31 20:16                           ` H.J. Lu
  2015-04-01 12:18                             ` Antoine Tremblay
@ 2015-04-02  3:22                             ` Bin.Cheng
  2015-04-02  3:53                               ` Bin.Cheng
  1 sibling, 1 reply; 38+ messages in thread
From: Bin.Cheng @ 2015-04-02  3:22 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Antoine Tremblay, GDB

On Wed, Apr 1, 2015 at 4:16 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 10:18 AM, Antoine Tremblay
> <antoine.tremblay@ericsson.com> wrote:
>>
>>
>> On 03/31/2015 01:16 PM, H.J. Lu wrote:
>>>
>>> On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
>>> <antoine.tremblay@ericsson.com> wrote:
>>>>>
>>>>> Also doing ./configure in binutils/zlib I get :
>>>>>
>>>>> config.status: creating Makefile
>>>>> config.status: executing default-1 commands
>>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>>> directory
>>>>>
>>>>> So configure does not exit cleanly...ideas?
>>>>>
>>>>>
>>>>
>>>> I did a bit more research on this issue and I get this if I build gdb
>>>> from
>>>> it's source directory
>>>>
>>>> in binutils-gdb
>>>> ./configure
>>>> make
>>>>
>>>> make fails with : while in zlib directory
>>>>
>>>> configure: creating ./config.status
>>>> config.status: creating Makefile
>>>> config.status: executing default-1 commands
>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>> directory
>>>>
>>>> However if I build out of tree in like binutils-gdb/build for example I
>>>> do
>>>> not get this issue.
>>>>
>>>> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>>>>
>>>> Subject: [PATCH 09/76] A zlib to tarball
>>>>
>>>> I see this snippet there
>>>>
>>>> -    ./configure --target=i386-pc-linux-gnu
>>>> +    ./configure --target=i386-pc-linux-gnu \
>>>> +       --with-target-subdir=. \
>>>> +       --disable-multilib
>>>>
>>>> With these options I get around the configure problem only to fail in gas
>>>> with :
>>>> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
>>>> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall
>>>> -Wstrict-prototypes
>>>> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2
>>>> -static-libstdc++
>>>> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o
>>>> cond.o
>>>> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>>> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
>>>> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
>>>> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>>> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
>>>> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
>>>> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
>>>> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
>>>> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>>> flonum-konst.o
>>>> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o
>>>> literal.o
>>>> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
>>>> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>>> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
>>>> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
>>>> /usr/bin/ld: cannot find -lz
>>>>
>>>>
>>>> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>>>>
>>>> Did you try to compile directly in the src tree ?
>>>>
>>>
>>> Yes, I did.  You need to add --disable-multilib,  and maybe
>>> --with-target-subdir=.
>>>
>>
>> As I said if I add  --disable-multilib, -with-target-subdir=.
>>
>> I get into the gas missing zlib error above ?
>>
>> Also I don't think it's a good idea that gdb would require options to
>> compile in it's source tree ?
>>
>> Is there a good reason for this ?
>>
>>
>
> It should be fixed now.
>
Is it possible that GDB cross build hasn't been fixed yet?  If I cross
build GDB for arm-none-linux-gnueabi(hf) or aarch64-none-linux-gnu
with below configuration:

../binutils-gdb/configure --enable-64-bit-bfd
--enable-targets=arm-none-eabi,arm-none-linux-gnueabihf,armeb-none-eabi,armeb-none-linux-gnueabihf
--target=arm-none-linux-gnueabihf --disable-doc --disable-gdbtk
--disable-nls --disable-tui --without-python --without-x ...

Yes zlib is built in build directory, and -lz is added on link command
line of as/gdb/sim, but option "-L/home/.../obj/binutils/zlib" is only
added for binutils program, not GDB/SIM.  It seems to me gdb/sim still
use the system z library, rather than the built one.  The readelf -dl
gives below information:
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]


We also do cross build with "build != host == target".  In this
scenario, neither "-lz" and "-L..." option is't added in link command
line for gdb/sim.  And I got below error message:

../bfd/libbfd.a(compress.o): In function `decompress_contents':
/home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:46:
undefined reference to `inflateInit_'
/home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:56:
undefined reference to `inflateReset'
/home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:53:
undefined reference to `inflate'
/home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:58:
undefined reference to `inflateEnd'
../bfd/libbfd.a(compress.o): In function `bfd_compress_section_contents':
/home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:79:
undefined reference to `compressBound'
/home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:85:
undefined reference to `compress'
collect2: error: ld returned 1 exit status


Thanks,
bin
>
> --
> H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/8] Add --with-system-zlib in bfd
  2015-04-02  3:22                             ` Bin.Cheng
@ 2015-04-02  3:53                               ` Bin.Cheng
  0 siblings, 0 replies; 38+ messages in thread
From: Bin.Cheng @ 2015-04-02  3:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Antoine Tremblay, GDB

On Thu, Apr 2, 2015 at 11:22 AM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Wed, Apr 1, 2015 at 4:16 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Tue, Mar 31, 2015 at 10:18 AM, Antoine Tremblay
>> <antoine.tremblay@ericsson.com> wrote:
>>>
>>>
>>> On 03/31/2015 01:16 PM, H.J. Lu wrote:
>>>>
>>>> On Tue, Mar 31, 2015 at 10:12 AM, Antoine Tremblay
>>>> <antoine.tremblay@ericsson.com> wrote:
>>>>>>
>>>>>> Also doing ./configure in binutils/zlib I get :
>>>>>>
>>>>>> config.status: creating Makefile
>>>>>> config.status: executing default-1 commands
>>>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>>>> directory
>>>>>>
>>>>>> So configure does not exit cleanly...ideas?
>>>>>>
>>>>>>
>>>>>
>>>>> I did a bit more research on this issue and I get this if I build gdb
>>>>> from
>>>>> it's source directory
>>>>>
>>>>> in binutils-gdb
>>>>> ./configure
>>>>> make
>>>>>
>>>>> make fails with : while in zlib directory
>>>>>
>>>>> configure: creating ./config.status
>>>>> config.status: creating Makefile
>>>>> config.status: executing default-1 commands
>>>>> ./config.status: line 1190: ./../../config-ml.in: No such file or
>>>>> directory
>>>>>
>>>>> However if I build out of tree in like binutils-gdb/build for example I
>>>>> do
>>>>> not get this issue.
>>>>>
>>>>> Could this be related to 92c695a14f6a5a24b177e89624c13d7dbcbf9e1f ?
>>>>>
>>>>> Subject: [PATCH 09/76] A zlib to tarball
>>>>>
>>>>> I see this snippet there
>>>>>
>>>>> -    ./configure --target=i386-pc-linux-gnu
>>>>> +    ./configure --target=i386-pc-linux-gnu \
>>>>> +       --with-target-subdir=. \
>>>>> +       --disable-multilib
>>>>>
>>>>> With these options I get around the configure problem only to fail in gas
>>>>> with :
>>>>> make[4]: Entering directory `/home/x/src/binutils-gdb/gas'
>>>>> /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall
>>>>> -Wstrict-prototypes
>>>>> -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2
>>>>> -static-libstdc++
>>>>> -static-libgcc  -o as-new app.o as.o atof-generic.o compress-debug.o
>>>>> cond.o
>>>>> depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>>>> flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o
>>>>> listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o
>>>>> stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>>>> ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
>>>>> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
>>>>> -Wshadow -Werror -I./../zlib -g -O2 -static-libstdc++ -static-libgcc -o
>>>>> as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o
>>>>> dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o
>>>>> flonum-konst.o
>>>>> flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o
>>>>> literal.o
>>>>> macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o
>>>>> symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o
>>>>> ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a
>>>>> -L/home/x/src/binutils-gdb/zlib -lz ../libiberty/libiberty.a -ldl
>>>>> /usr/bin/ld: cannot find -lz
>>>>>
>>>>>
>>>>> This is with head as :  711a72d3d6f8cd3c3f408e718ff19aa4bfd2144e
>>>>>
>>>>> Did you try to compile directly in the src tree ?
>>>>>
>>>>
>>>> Yes, I did.  You need to add --disable-multilib,  and maybe
>>>> --with-target-subdir=.
>>>>
>>>
>>> As I said if I add  --disable-multilib, -with-target-subdir=.
>>>
>>> I get into the gas missing zlib error above ?
>>>
>>> Also I don't think it's a good idea that gdb would require options to
>>> compile in it's source tree ?
>>>
>>> Is there a good reason for this ?
>>>
>>>
>>
>> It should be fixed now.
>>
> Is it possible that GDB cross build hasn't been fixed yet?  If I cross
> build GDB for arm-none-linux-gnueabi(hf) or aarch64-none-linux-gnu
> with below configuration:
>
> ../binutils-gdb/configure --enable-64-bit-bfd
> --enable-targets=arm-none-eabi,arm-none-linux-gnueabihf,armeb-none-eabi,armeb-none-linux-gnueabihf
> --target=arm-none-linux-gnueabihf --disable-doc --disable-gdbtk
> --disable-nls --disable-tui --without-python --without-x ...
>
> Yes zlib is built in build directory, and -lz is added on link command
> line of as/gdb/sim, but option "-L/home/.../obj/binutils/zlib" is only
> added for binutils program, not GDB/SIM.  It seems to me gdb/sim still
> use the system z library, rather than the built one.  The readelf -dl
> gives below information:
>  0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
>  0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]
>  0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
>  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>
>
> We also do cross build with "build != host == target".  In this
> scenario, neither "-lz" and "-L..." option is't added in link command
> line for gdb/sim.  And I got below error message:
>
> ../bfd/libbfd.a(compress.o): In function `decompress_contents':
> /home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:46:
> undefined reference to `inflateInit_'
> /home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:56:
> undefined reference to `inflateReset'
> /home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:53:
> undefined reference to `inflate'
> /home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:58:
> undefined reference to `inflateEnd'
> ../bfd/libbfd.a(compress.o): In function `bfd_compress_section_contents':
> /home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:79:
> undefined reference to `compressBound'
> /home/binche01/work/systematic_testing/2015/workspace/build/bfd/../../binutils-gdb.old/bfd/compress.c:85:
> undefined reference to `compress'
> collect2: error: ld returned 1 exit status
>
Sorry my bad.  My snapshot is just two commits behind the fix.  So yes
it is fixed.

Thanks,
bin
>
> Thanks,
> bin
>>
>> --
>> H.J.

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2015-04-02  3:53 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 15:57 [PATCH 1/8] Add --with-system-zlib in bfd H.J. Lu
2015-03-29 14:10 ` H.J. Lu
2015-03-30 15:52   ` Steve Ellcey
2015-03-30 16:32     ` H.J. Lu
2015-03-30 16:45       ` Luis Machado
2015-03-30 16:51         ` H.J. Lu
2015-03-30 17:13           ` Steve Ellcey
2015-03-30 17:21             ` H.J. Lu
2015-03-30 17:36               ` Steve Ellcey
2015-03-30 19:33                 ` Antoine Tremblay
2015-03-30 19:37                   ` Antoine Tremblay
2015-03-31 17:13                     ` Antoine Tremblay
2015-03-31 17:16                       ` H.J. Lu
2015-03-31 17:18                         ` Antoine Tremblay
2015-03-31 18:55                           ` H.J. Lu
2015-03-31 20:16                           ` H.J. Lu
2015-04-01 12:18                             ` Antoine Tremblay
2015-04-02  3:22                             ` Bin.Cheng
2015-04-02  3:53                               ` Bin.Cheng
2015-03-30 20:19                   ` H.J. Lu
2015-03-31 12:08                     ` Antoine Tremblay
2015-03-30 18:18           ` Luis Machado
2015-03-30 17:20       ` H.J. Lu
2015-03-31  6:13 ` Mike Frysinger
2015-03-31 10:10   ` H.J. Lu
2015-03-31 10:37     ` Pedro Alves
2015-03-31 10:46       ` H.J. Lu
2015-03-31 10:53         ` Pedro Alves
2015-03-31 11:33           ` H.J. Lu
2015-03-31 11:46             ` Pedro Alves
2015-03-31 12:01               ` H.J. Lu
2015-03-31 12:15                 ` Pedro Alves
2015-03-31 13:43                   ` H.J. Lu
2015-03-31 13:46                     ` Pedro Alves
2015-03-31 16:41     ` Mike Frysinger
2015-03-31 16:56       ` H.J. Lu
2015-03-31 17:01         ` Mike Frysinger
2015-03-31 17:04           ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).