Compiling GCC or Clang for thumb drive on OSX

Posted by user105524 on Programmers See other posts from Programmers or by user105524
Published on 2013-10-21T01:04:48Z Indexed on 2013/10/21 4:08 UTC
Read the original article Hit count: 264

Filed under:
|

I have a mac book that I don't have admin rights to which I would like to be able to use either GCC or clang. Since I lack admin right I can't install binutils or a compiler to /usr directory. My plan is to install both of these (using an old macbook that I do have admin rights for) to a flash drive and then run the compiler off of there. How would one go building gcc or clang so that it could run just off of a thumb drive? I've tried both but haven't had any success. I've tried doing it defining as many of the directories as possible through configure, but haven't been able to successfully build. My current configure script for gcc-4.8.1 is (where USB20D is the thumb drive):

../gcc-4.8.1/configure --prefix=/Volumes/USB20FD/usr \
--with-local-prefix=/Volumes/USB20FD/usr/local \
--with-native-system-header-dir=/Volumes/USB20FD/usr/include \
--with-as=/Volumes/USB20FD/usr/bin/as \
--enable-languages=c,c++,fortran\
--with-ld=/Volumes/USB20FD/usr/bin/ld \                                                                                                                                                                     
--with-build-time-tools=/Volumes/USB20FD/usr/bin \                                                                                                                                                          
 AR=/Volumes/USB20FD/usr/bin/ar \                                                                                                                                                                            
 AS=/Volumes/USB20FD/usr/bin/as \                                                                                                                                                                            
 RANLIB=/Volumes/USB20FD/usr/bin/ranlib \                                                                                                                                                                    
 LD=/Volumes/USB20FD/usr/bin/ld \                                                                                                                                                                            
 NM=/Volumes/USB20FD/usr/bin/nm \                                                                                                                                                                            
 LIPO=/Volumes/USB20FD/usr/bin/lipo \                                                                                                                                                                        
 AR_FOR_TARGET=/Volumes/USB20FD/usr/bin/ar \                                                                                                                                                                 
 AS_FOR_TARGET=/Volumes/USB20FD/usr/bin/as \                                                                                                                                                                 
 RANLIB_FOR_TARGET=/Volumes/USB20FD/usr/bin/ranlib \                                                                                                                                                         
 LD_FOR_TARGET=/Volumes/USB20FD/usr/bin/ld \                                                                                                                                                                 
 NM_FOR_TARGET=/Volumes/USB20FD/usr/bin/nm \                                                                                                                                                                 
 LIPO_FOR_TARGET=/Volumes/USB20FD/usr/bin/lipo                                                                                                                                                               
 CFLAGS=" -nodefaultlibs -nostdlib -B/Volumes/USB20FD/bin -isystem/Volumes/USB20FD/usr/include  -static-libgcc -v  -L/Volumes/USB20FD/usr/lib  " \                                        
 LDFLAGS=" -Z -lc  -nodefaultlibs -nostdlib   -L/Volumes/USB20FD/usr/lib -lgcc -syslibroot  /Volumes/USB20FD/usr/lib/crt1.10.6.o  "   

Any obvious ideas of which of these options need to be turned on to install the appropriate files on the thumb drive during installation? What other magic occurs during xcode installation which isn't occurring here?

Thanks for any suggestions

© Programmers or respective owner

Related posts about gcc

Related posts about clang