Bug 18667 - cannot compile bfd: targmatch.h:313: error: `arm' undeclared here on sparc-sun-solaris2.9
Summary: cannot compile bfd: targmatch.h:313: error: `arm' undeclared here on sparc-su...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: 2.26
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-14 09:19 UTC by Marcin Cieślak
Modified: 2015-08-18 07:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Cieślak 2015-07-14 09:19:51 UTC
Error log:

mv -f .deps/syms.Tpo .deps/syms.Plo
/bin/bash ./libtool --tag=CC   --mode=compile /usr/local/bin/gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include  -DHAVE_sparc_elf32_sol2_vec -DHAVE_sparc_elf64_sol2_vec -DHAVE_sparc_aout_sunos_be_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec  -DBINDIR='"/home/admini/saper/sparcv7/bin"' -I/home/admini/saper/include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -MT targets.lo -MD -MP -MF .deps/targets.Tpo -c -o targets.lo -DDEFAULT_VECTOR=sparc_elf32_sol2_vec -DSELECT_VECS='&sparc_elf32_sol2_vec,&sparc_elf64_sol2_vec,&sparc_aout_sunos_be_vec,&elf64_le_vec,&elf64_be_vec,&elf32_le_vec,&elf32_be_vec,&plugin_vec' -DSELECT_ARCHITECTURES='&bfd_sparc_arch,&bfd_plugin_arch' ./targets.c
libtool: compile:  /usr/local/bin/gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_sparc_elf32_sol2_vec -DHAVE_sparc_elf64_sol2_vec -DHAVE_sparc_aout_sunos_be_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -DBINDIR=\"/home/admini/saper/sparcv7/bin\" -I/home/admini/saper/include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -MT targets.lo -MD -MP -MF .deps/targets.Tpo -c -DDEFAULT_VECTOR=sparc_elf32_sol2_vec "-DSELECT_VECS=&sparc_elf32_sol2_vec,&sparc_elf64_sol2_vec,&sparc_aout_sunos_be_vec,&elf64_le_vec,&elf64_be_vec,&elf32_le_vec,&elf32_be_vec,&plugin_vec" "-DSELECT_ARCHITECTURES=&bfd_sparc_arch,&bfd_plugin_arch" ./targets.c -o targets.o
In file included from targets.c:1509:
targmatch.h:313: error: `arm' undeclared here (not in a function)
targmatch.h:313: error: `vxworks' undeclared here (not in a function)
targmatch.h:313: error: `arm' undeclared here (not in a function)
targmatch.h:313: error: `windiss' undeclared here (not in a function)
targmatch.h:313: error: initializer element is not constant
targmatch.h:313: error: (near initialization for `bfd_target_match[0]')
targmatch.h:313: error: parse error before ')' token
targmatch.h:1341: warning: missing braces around initializer
targmatch.h:1341: warning: (near initialization for `bfd_target_match[1]')
targmatch.h:1341: warning: missing initializer
targmatch.h:1341: warning: (near initialization for `bfd_target_match[1].vector')
targmatch.h:1341: error: initializer element is not constant
targmatch.h:1341: error: (near initialization for `bfd_target_match[1]')
targmatch.h:1341: error: parse error before '*' token
bfd.h: In function `bfd_set_section_userdata':
bfd.h:1608: warning: unused parameter `abfd'
bfd.h: In function `bfd_set_section_vma':
bfd.h:1615: warning: unused parameter `abfd'
bfd.h: In function `bfd_set_section_alignment':
bfd.h:1623: warning: unused parameter `abfd'
make[4]: *** [targets.lo] Error 1
make[4]: Leaving directory `/home/admini/saper/src/bi/binutils-2.25/bfd'


This is because targmatch.h gets mutilated by Solaris sed:

#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec)

{ "arm-*-elf", NULL }, arm*-*-freeb{ "d*", NULL },{ "arm*-*-linux-*", NULL },{ "arm*-*
-conix*", NULL },
{ "arm*-*-uclinux*", NULL }, arm-*-kfreeb{ "d*-gnu", NULL },
{ "arm*-*-eabi*",
&arm_elf32_le_vec },
#endif



  arm*-*-vxworks | arm*-*-windiss)
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_vxworks_le_vec)

&arm_elf32_vxworks_le_vec },
#endif

The solution is to use GNU sed (modify Makefile.am/.in/Makefile to use $(SED))
Comment 1 Sourceware Commits 2015-08-18 07:25:18 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fe875424a05df7c4055cd9382ab76f65e952c4dd

commit fe875424a05df7c4055cd9382ab76f65e952c4dd
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 18 16:44:48 2015 +0930

    Use $SED in bfd Makefile
    
    	PR 18667
    	* Makefile.am: Use $(SED) in place of sed throughout.
    	* Makefile.in: Regenerate.
Comment 2 Alan Modra 2015-08-18 07:27:40 UTC
Fixed