This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix newlib install failure in install-data-local target


Hi,

When building and installing newlib targeting arm-none-eabi I am getting
the following failure when doing:

make install-target-newlib install-target-libgloss
...
if [ -z "" ]; then \                                                                                                                                                                                                                         
          /bin/bash /work/local-checkouts/binutils-fsf/newlib/../mkinstalldirs /work/builds/install/arm-none-eabi/include; \                                                                                                                 
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/include/*.h; do \                                                                                                                                                          
           /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/`basename $i`; \                                                                                                                                         
          done; \                                                                                                                                                                                                                            
          /usr/bin/install -c -m 644 newlib.h /work/builds/install/arm-none-eabi/include/newlib.h; \                                                                                                                                         
          /bin/bash /work/local-checkouts/binutils-fsf/newlib/../mkinstalldirs /work/builds/install/arm-none-eabi/include/machine; \                                                                                                         
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/include/machine/*.h; do \                                                                                                                                                  
           /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/machine/`basename $i`; \                                                                                                                                 
          done; \                                                                                                                                                                                                                            
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/machine/arm/machine/*.h; do \                                                                                                                                              
            if [ -f $i ]; then \                                                                                                                                                                                                             
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/machine/`basename $i`; \                                                                                                                               
            else true; fi ; \                                                                                                                                                                                                                
          done; \                                                                                                                                                                                                                            
          /bin/bash /work/local-checkouts/binutils-fsf/newlib/../mkinstalldirs /work/builds/install/arm-none-eabi/include/rpc; \                                                                                                             
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/include/rpc/*.h; do \                                                                                                                                                      
           /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/rpc/`basename $i`; \                                                                                                                                     
          done; \                                                                                                                                                                                                                            
          /bin/bash /work/local-checkouts/binutils-fsf/newlib/../mkinstalldirs /work/builds/install/arm-none-eabi/include/sys; \                                                                                                             
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/include/sys/*.h; do \                                                                                                                                                      
           /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/sys/`basename $i`; \                                                                                                                                     
          done; \                                                                                                                                                                                                                            
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/machine/arm/sys/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/sys/`basename $i`; \
            else true; fi ; \
          done ; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/machine/arm/include/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/`basename $i`; \
            else true; fi ; \
          done ; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/sys/arm/sys/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/sys/`basename $i`; \
            else true; fi ; \
          done ; \
          /bin/bash /work/local-checkouts/binutils-fsf/newlib/../mkinstalldirs /work/builds/install/arm-none-eabi/include/bits; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/sys/arm/bits/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/bits/`basename $i`; \
            else true; fi ; \
          done ; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/sys/arm/machine/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/machine/`basename $i`; \
            else true; fi ; \
          done ; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/sys/arm/include/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/`basename $i`; \
            else true; fi ; \
          done ; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/sys/arm/include/*; do \
            if [ -d $i ]; then \
                for j in $i/*.h; do \
                    /usr/bin/install -c -m 644 $j /work/builds/install/arm-none-eabi/include/`basename $i`/`basename $j`; \
                done ; \
            else true; fi ; \
          done ; \
          for i in /work/local-checkouts/binutils-fsf/newlib/libc/sys/arm/machine/arm/include/*.h; do \
            if [ -f $i ]; then \
             /usr/bin/install -c -m 644 $i /work/builds/install/arm-none-eabi/include/machine/`basename $i`; \
            else true; fi ; \
          done ; \
          for i in rpc/types.h rpc/xdr.h; do \
            if [ -f /work/builds/install/arm-none-eabi/include/$i]; then \
                -rm /work/builds/install/arm-none-eabi/include/$i; \
            else true; fi ; \
          done ; \
        else true; fi

/bin/bash: line 67: [: missing `]'

The failure is in the final if clause that tests to see if rpc/types.h
and rpc/xdr.h have been installed, and then removes them.  I believe
there should be whitespace before the ] in the test condition, and no
'-' before the rm command.

The attached patch fixes these.  I have tested this by building newlib
for arm-none-eabi.

The code I am modifying was initially added by the patch discussed here:
http://sourceware.org/ml/newlib/2011/msg00017.html

Thanks,

Matt

-- 
Matthew Gretton-Dann
Principal Engineer - PDSW Tools
ARM Ltd
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index dca6260..41de26f 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -331,8 +331,8 @@ endif
 	    else true; fi ; \
 	  done ; \
 	  for i in $(NO_INCLUDE_LIST); do \
-	    if [ -f $(DESTDIR)$(tooldir)/include/$$i]; then \
-		-rm $(DESTDIR)$(tooldir)/include/$$i; \
+	    if [ -f $(DESTDIR)$(tooldir)/include/$$i ]; then \
+		rm $(DESTDIR)$(tooldir)/include/$$i; \
 	    else true; fi ; \
 	  done ; \
 	else true; fi
diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index 3d5d312..9b013e6 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -1038,8 +1038,8 @@ install-data-local:	install-toollibLIBRARIES
 	    else true; fi ; \
 	  done ; \
 	  for i in $(NO_INCLUDE_LIST); do \
-	    if [ -f $(DESTDIR)$(tooldir)/include/$$i]; then \
-		-rm $(DESTDIR)$(tooldir)/include/$$i; \
+	    if [ -f $(DESTDIR)$(tooldir)/include/$$i ]; then \
+		rm $(DESTDIR)$(tooldir)/include/$$i; \
 	    else true; fi ; \
 	  done ; \
 	else true; fi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]