Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 May 1998 10:17:07 +1000 (EST)
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        bug-gnu-utils@prep.ai.mit.edu
Cc:        freebsd-ports@FreeBSD.ORG
Subject:   Circular dependency in libiberty
Message-ID:  <199805010017.KAA12929@gsms01.alcatel.com.au>

next in thread | raw e-mail | index | archive | help
Environment FreeBSD 2.2.5, binutils 2.9 and gdb 4.17

When building libiberty as part of either binutils 2.9 or gdb 4.17 with
a FreeBSD 2.x host, gnu make (3.76.1) successfully builds libiberty.a,
but reports a circular dependency.  Running gnu make in the libiberty
directory after the library is successfully built gives:
pc0640% gmake
gmake[1]: Entering directory `/usr/users/jeremyp/src/binutils/libiberty'
gmake[1]: Circular vasprintf.o <- config.h dependency dropped.
gmake[1]: Leaving directory `/usr/users/jeremyp/src/binutils/libiberty'
pc0640% 

The standard FreeBSD 2.2.5 make is unable to handle the circular
dependency and exits without building the library.

This problem does not exist on a Sun Solaris 2.x host and appears
to be related to the `EXTRA_OFILES=vasprintf.o' line in the
Makefile - it appears that the dependency handling for EXTRA_OFILES
is incorrect.

Relevant configuration files from binutils are:

-------  binutils/config.status:  --------------------------------
#!/bin/sh
# This file was generated automatically by configure.  Do not edit.
# This directory was configured as follows:
/mnt/src/binutils-2.9/configure --host=i386-unknown-freebsd2.2.5 --target=m68k-unknown-coff --with-mmap --with-gnu-as --with-gnu-ld --enable-targets=i386-unknown-freebsd2.2.5,m68k-unknown-coff --disable-shared --norecursion 
# 
-------  binutils/config.cache:  --------------------------------
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs.  It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already.  You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'}
bfd_cv_decl_needed_getenv=${bfd_cv_decl_needed_getenv='no'}
ac_cv_lib_fl_yywrap=${ac_cv_lib_fl_yywrap='yes'}
gas_cv_decl_needed_malloc=${gas_cv_decl_needed_malloc='no'}
ac_cv_header_varargs_h=${ac_cv_header_varargs_h='yes'}
bfd_cv_decl_needed_strstr=${bfd_cv_decl_needed_strstr='no'}
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
bfd_cv_decl_needed_free=${bfd_cv_decl_needed_free='no'}
ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'}
am_cv_mingw32=${am_cv_mingw32='no'}
bu_cv_decl_time_t_time_h=${bu_cv_decl_time_t_time_h='yes'}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_header_stdarg_h=${ac_cv_header_stdarg_h='yes'}
ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
ac_cv_func_mprotect=${ac_cv_func_mprotect='yes'}
ac_cv_func_mmap_fixed_mapped=${ac_cv_func_mmap_fixed_mapped='yes'}
ac_cv_prog_gnu_ld=${ac_cv_prog_gnu_ld='no'}
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'}
ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'}
bfd_cv_decl_needed_realloc=${bfd_cv_decl_needed_realloc='no'}
ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h='yes'}
ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
ac_cv_func_fcntl=${ac_cv_func_fcntl='yes'}
ac_cv_path_LD=${ac_cv_path_LD='/usr/bin/ld'}
ac_cv_prog_CC=${ac_cv_prog_CC='gcc'}
am_cv_exeext=${am_cv_exeext='no'}
ac_cv_prog_lex_root=${ac_cv_prog_lex_root='lex.yy'}
ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'}
ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'}
ac_cv_header_alloca_h=${ac_cv_header_alloca_h='no'}
ac_cv_func_alloca_works=${ac_cv_func_alloca_works='yes'}
bfd_cv_decl_needed_sbrk=${bfd_cv_decl_needed_sbrk='no'}
ac_cv_func_unlink=${ac_cv_func_unlink='yes'}
gas_cv_decl_needed_strstr=${gas_cv_decl_needed_strstr='no'}
bu_cv_decl_time_t_types_h=${bu_cv_decl_time_t_types_h='yes'}
ac_cv_header_sys_types_h=${ac_cv_header_sys_types_h='yes'}
gas_cv_decl_needed_free=${gas_cv_decl_needed_free='no'}
ac_cv_header_time=${ac_cv_header_time='yes'}
ac_cv_header_strings_h=${ac_cv_header_strings_h='yes'}
bu_cv_header_utime_h=${bu_cv_header_utime_h='yes'}
ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
bfd_cv_decl_needed_malloc=${bfd_cv_decl_needed_malloc='no'}
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
ac_cv_c_inline=${ac_cv_c_inline='inline'}
ac_cv_header_time_h=${ac_cv_header_time_h='yes'}
ac_cv_path_NM=${ac_cv_path_NM='/usr/bin/nm -p'}
ac_cv_func_utimes=${ac_cv_func_utimes='yes'}
ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
gas_cv_assert_ok=${gas_cv_assert_ok='yes'}
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'}
ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'}
ac_cv_header_sys_file_h=${ac_cv_header_sys_file_h='yes'}
ac_cv_header_errno_h=${ac_cv_header_errno_h='yes'}
ac_cv_prog_AR=${ac_cv_prog_AR='ar'}
ac_cv_func_madvise=${ac_cv_func_madvise='yes'}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_func_sbrk=${ac_cv_func_sbrk='yes'}
ac_cv_func_getpagesize=${ac_cv_func_getpagesize='yes'}
ac_cv_prog_lex_yytext_pointer=${ac_cv_prog_lex_yytext_pointer='yes'}
ac_cv_func_setitimer=${ac_cv_func_setitimer='yes'}
ac_cv_header_stddef_h=${ac_cv_header_stddef_h='yes'}
bfd_cv_decl_needed_fprintf=${bfd_cv_decl_needed_fprintf='no'}
gas_cv_decl_needed_errno=${gas_cv_decl_needed_errno='no'}
am_cv_cygwin32=${am_cv_cygwin32='no'}
ac_cv_prog_LEX=${ac_cv_prog_LEX='flex'}
gas_cv_decl_needed_sbrk=${gas_cv_decl_needed_sbrk='no'}
ac_cv_func_fdopen=${ac_cv_func_fdopen='yes'}
-------  binutils/libiberty/config.status: ----------
#!/bin/sh
# This file was generated automatically by configure.  Do not edit.
# This directory was configured as follows:
/mnt/src/binutils-2.9/configure --host=i386-unknown-freebsd2.2.5 --target=m68k-unknown-coff --srcdir=/mnt/src/binutils-2.9/libiberty --with-mmap --with-gnu-as --with-gnu-ld --with-gnu-as --with-gnu-ld --enable-targets=i386-unknown-freebsd2.2.5,m68k-unknown-coff --disable-shared --cache-file=../config.cache --norecursion 
# using "xhost-mkfrag"
--------  binutils/libiberty/Makefile: ---------
# This file was generated automatically by configure.  Do not edit.
VPATH = /mnt/src/binutils-2.9/libiberty
links = alloca-conf.h
host_alias = i386-unknown-freebsd2.2.5
host_cpu = i386
host_vendor = unknown
host_os = freebsd2.2.5
host_canonical = i386-unknown-freebsd2.2.5
target_alias = m68k-unknown-coff
target_cpu = m68k
target_vendor = unknown
target_os = coff
target_canonical = m68k-unknown-coff
build_alias = i386-unknown-freebsd2.2.5
build_cpu = i386
build_vendor = unknown
build_os = freebsd2.2.5
build_canonical = i386-unknown-freebsd2.2.5
host_makefile_frag = xhost-mkfrag
gxx_include_dir = ${prefix}/include/g++
#
# Makefile
#   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation
#
# This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# Libiberty is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with libiberty; see the file COPYING.LIB.  If not,
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

# This file was written, and is maintained by K. Richard Pixley
# <rich@cygnus.com>.

#
# Makefile for libiberty directory
#

srcdir = /mnt/src/binutils-2.9/libiberty

prefix = /usr/local

exec_prefix = $(prefix)
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib

datadir = ${prefix}/share

mandir = ${prefix}/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
man9dir = $(mandir)/man9
infodir = ${prefix}/info
includedir = ${prefix}/include

SHELL = /bin/sh

# Multilib support variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true

INSTALL = $(SHELL) $(srcdir)/../install-sh -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

AR = ar
AR_FLAGS = rc

ERRORS_CC = $(CC)
CC = gcc
CFLAGS = -g -O2
LIBCFLAGS = $(CFLAGS)
MAKEINFO = makeinfo
RANLIB = ranlib

PICFLAG =

MAKEOVERRIDES =

TARGETLIB = libiberty.a

CONFIG_H = lconfig.h
NEEDED_LIST = lneeded-list

# HOST_OFILES contains the list of objects that should be in the
# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
# A configuration may override this with a fixed list a object files
# names (hard to maintain), or some other way to generate a list.
HOST_OFILES=`cat needed-list`

# Extra targets that the top-level target depends on.
# Specifically, what needs to be made before HOST_OFILES can be used.
# Can be empty if HOST_OFILES is just a list of file names.
DO_ALSO = needed-list

# A configuration can specify extra .o files that should be included,
# even if they are in libc. (Perhaps the libc version is buggy.)
EXTRA_OFILES = 

# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
	"AR=$(AR)" \
	"AR_FLAGS=$(AR_FLAGS)" \
	"CC=$(CC)" \
	"CFLAGS=$(CFLAGS)" \
	"LIBCFLAGS=$(LIBCFLAGS)" \
	"EXTRA_OFILES=$(EXTRA_OFILES)" \
	"HDEFINES=$(HDEFINES)" \
	"INSTALL=$(INSTALL)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
	"LDFLAGS=$(LDFLAGS)" \
	"LOADLIBES=$(LOADLIBES)" \
	"PICFLAG=$(PICFLAG)" \
	"RANLIB=$(RANLIB)" \
	"SHELL=$(SHELL)"

all: stamp-picdir $(TARGETLIB) required-list
	@if [ "$(RULE1)" != "not-used" ]; then \
	  $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
	else true; \
	fi

.PHONY: check installcheck
check installcheck:


#### Host, target, and site specific Makefile fragments come in here.
# Warning: this fragment is automatically generated
# Following fragment copied from /mnt/src/binutils-2.9/libiberty/config/mh-fbsd21
EXTRA_OFILES=vasprintf.o
###

INCDIR=$(srcdir)/$(MULTISRCTOP)../include

COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
.c.o:
	test -z "$(PICFLAG)" || \
	  $(COMPILE.c) $(PICFLAG) $< -o pic/$@
	$(COMPILE.c) $<

# The default target just invokes make recursively.
# However, the automatic configuration (in config/mh_default).
# first causes it to figure out the objects missing in libc.
info install-info clean-info dvi:

# Include files that are in this directory.
HFILES =

# NOTE: If you add new files to the library, add them to this list
# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c bzero.c \
	 choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c fnmatch.c \
	 getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
         floatformat.c hex.c index.c insque.c \
	 memchr.c memcmp.c memcpy.c memmove.c memset.c objalloc.c \
         obstack.c pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \
	 strcasecmp.c strncasecmp.c \
         strchr.c strdup.c strerror.c strrchr.c strsignal.c \
         strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
	 vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
	 xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
# These are always included in the library.
REQUIRED_OFILES = argv.o basename.o choose-temp.o concat.o cplus-dem.o \
  fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \
  floatformat.o objalloc.o obstack.o pexecute.o spaces.o strerror.o \
  strsignal.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o

# Do we want/need any config overrides?
#	 

STAGESTUFF = $(TARGETLIB) *.o

INSTALL_DEST = libdir
install: install_to_$(INSTALL_DEST)

install_to_libdir: all
	$(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n
	( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
	mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install

install_to_tooldir: all
	$(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n
	( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
	mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install

# The default configuration adds to libiberty all those functions that are
# missing in libc.  More precisely, it includes whatever $(CC) fails to find.
# Then a sed+awk combination translates the ld error messages into
# a list of .o files.

stamp-needed: stamp-picdir $(NEEDED_LIST)
	cp $(NEEDED_LIST) needed-tmp
	$(SHELL) $(srcdir)/$(MULTISRCTOP)../move-if-change needed-tmp needed-list
	touch stamp-needed

needed-list: stamp-needed ; @true

lneeded-list: $(EXTRA_OFILES) needed.awk errors
	rm -f lneeded-list
	f=""; \
	for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
	  case " $$f " in \
	    *" $$i "*) ;; \
	    *) f="$$f $$i" ;; \
	  esac ; \
	done ; \
	case $$f in \
	    *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \
	esac ; \
	echo $$f >>lneeded-list

# Generate an awk script that looks for functions in functions.def

needed.awk: $(srcdir)/functions.def Makefile
	echo "# !Automatically generated from $(srcdir)/functions.def"\
	  "- DO NOT EDIT!" >needed.awk
	grep '^DEF(' < $(srcdir)/functions.def \
	    | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
	    >>needed.awk

stamp-config: $(CONFIG_H)
	cp $(CONFIG_H) config.tmp
	$(SHELL) $(srcdir)/$(MULTISRCTOP)../move-if-change config.tmp config.h
	touch stamp-config

config.h: stamp-config ; @true

lconfig.h: needed2.awk errors
	echo "/* !Automatically generated from $(srcdir)/functions.def"\
	  "- DO NOT EDIT! */" >lconfig.h
	awk -f needed2.awk <errors >>lconfig.h

# Generate an awk script that looks for variables in functions.def

needed2.awk: $(srcdir)/functions.def Makefile
	echo "# !Automatically generated from $(srcdir)/functions.def"\
	  "- DO NOT EDIT!" >needed2.awk
	grep '^DEFVAR(' < $(srcdir)/functions.def \
	 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk
	grep '^DEFFUNC(' < $(srcdir)/functions.def \
	 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk

dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
	$(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null

errors: dummy.o $(EXTRA_OFILES)
	-($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true

# required-list is used when building a shared bfd/opcodes/libiberty library.
required-list: Makefile
	echo $(REQUIRED_OFILES) > required-list

$(HOST_OFILES) $(REQUIRED_OFILES) : config.h

RULE1 = $(TARGETLIB)
$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
	@$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
		"HOST_OFILES=$(HOST_OFILES)"

# Rule invoked by recursive make in $(RULE1).
RULE2 = not-used
$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
	rm -rf $(TARGETLIB)
	$(AR) $(AR_FLAGS) $(TARGETLIB) \
	  $(REQUIRED_OFILES) $(HOST_OFILES)
	$(RANLIB) $(TARGETLIB)

stamp-picdir:
	if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
	  mkdir pic; \
	else true; fi
	touch stamp-picdir

.always.:
# Do nothing.

.PHONY: all etags tags ls clean stage1 stage2 .always.

etags tags: TAGS

TAGS: $(CFILES) $(HFILES)
	etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`

# The standalone demangler (c++filt) has been moved to binutils.
demangle:
	@echo "The standalone demangler, now named c++filt, is now"
	@echo "a part of binutils."
	@false

ls:
	@echo Makefile $(HFILES) $(CFILES)

# Need to deal with profiled libraries, too.

mostlyclean:
	rm -rf *.o pic core errs \#* *.E a.out
	rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
	rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
	@$(MULTICLEAN) multi-clean DO=mostlyclean
clean: mostlyclean
	rm -f *.a required-list tmpmulti.out
	@$(MULTICLEAN) multi-clean DO=clean
distclean: clean
	@$(MULTICLEAN) multi-clean DO=distclean
	rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS multilib.out
maintainer-clean realclean: distclean

force:

Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
	$(SHELL) ./config.status

argv.o: $(INCDIR)/libiberty.h
basename.o: $(INCDIR)/libiberty.h
concat.o: $(INCDIR)/libiberty.h
cplus-dem.o: $(INCDIR)/demangle.h
fdmatch.o: $(INCDIR)/libiberty.h
fnmatch.o: $(INCDIR)/fnmatch.h
getopt.o: $(INCDIR)/getopt.h
getopt1.o: $(INCDIR)/getopt.h
getruntime.o: $(INCDIR)/libiberty.h
hex.o: $(INCDIR)/libiberty.h
floatformat.o: $(INCDIR)/floatformat.h
objalloc.o: $(INCDIR)/objalloc.h
obstack.o: $(INCDIR)/obstack.h
pexecute.o: $(INCDIR)/libiberty.h
spaces.o: $(INCDIR)/libiberty.h
strerror.o: $(INCDIR)/libiberty.h
strsignal.o: $(INCDIR)/libiberty.h
xatexit.o: $(INCDIR)/libiberty.h
xexit.o: $(INCDIR)/libiberty.h
xmalloc.o: $(INCDIR)/libiberty.h
xstrdup.o: $(INCDIR)/libiberty.h
xstrerror.o: $(INCDIR)/libiberty.h
----------------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805010017.KAA12929>