Gcc41 version 4.1.2 - How to Download and Install on Mac OS X
Saturday the 7th of November, 2009

    version 4.1.2

      View the most recent changes for the gcc41 port at: gcc41.darwinports.com/diff
      Scroll down toward the bottom of the page to get installation instructions for gcc41.
      The raw portfile for gcc41 4.1.2 is located here:
      http://gcc41.darwinports.com/dports/lang/gcc41/Portfile
      Find related portfiles with the unique DarwinPorts.com search feature.
      Check for any related Fink projects here: pdb.finkproject.org/pdb/package.php/gcc41


      The gcc41 Portfile 57658 2009-09-14 16:45:14Z jmr macports.org $

      PortSystem 1.0

      Name: gcc41
      Version: 4.1.2
      Revision: 4
      Platform: darwin
      Category: lang
      Maintainers: mww
      license GPLv2
      Description: The GNU compiler collection
      Long Description: The GNU compiler collection, including front ends for C, C++, Objective-C, Objective-C++, Java and Fortran95.

      Homepage: http://gcc.gnu.org/
      Master Sites: ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/ ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ gnu:/gcc/gcc-${version}

      set dcore gcc-core-${version}.tar.bz2
      set dfort gcc-fortran-${version}.tar.bz2
      set dcxx gcc-g++-${version}.tar.bz2
      set djava gcc-java-${version}.tar.bz2
      set dobjc gcc-objc-${version}.tar.bz2
      distfiles ${dcore} ${dfort} ${dcxx} ${djava} ${dobjc}

      Checksums: ${dcore} sha1 d6875295f6df1bec4a6f4ab8f0da54bfb8d97306 ${dfort} sha1 827ca3cba74ca50b2129fa707354af2ee1123d5d ${dcxx} sha1 e29c6e151050f8b5ac5d680b99483df522606143 ${djava} sha1 e83838428b83a6aa76ee6d8b3db1cbd4fdc383bc ${dobjc} sha1 ea97dab0f7096d267eba17d53a861d15b519868a

      # Handle Texinfo 4.1x.
      Patch Files: patch-configure-texinfo.diff

      # gmp and mpfr are not universal
      universal_variant no

      use_bzip2 yes

      depends_lib port:gmp port:mpfr port:libiconv

      set major 4.1

      worksrcdir build

      pre-patch {
      file mkdir ${worksrcpath}
      }
      patch.dir ${workpath}/gcc-${version}

      # the generated compiler doesn't accept -arch
      if {[info exists build_arch] && ${os.platform} == "darwin"} {
      configure.cc_archflags
      configure.cxx_archflags
      configure.objc_archflags
      configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
      }

      configure.cmd ../gcc-${version}/configure
      configure.args --enable-languages=c,c++,objc,obj-c++,fortran,java --libdir=${prefix}/lib/${name} --includedir=${prefix}/include/${name} --infodir=${prefix}/share/info --mandir=${prefix}/share/man --with-local-prefix=${prefix} --with-system-zlib --disable-multilib --disable-nls --program-suffix=-mp-${major} --with-gxx-include-dir=${prefix}/include/${name}/c++/ --with-gmp=${prefix} --with-mpfr=${prefix}

      use_parallel_build yes
      build.target profiledbootstrap

      post-destroot {
      file delete -force ${destroot}${prefix}/share/man/man7
      file delete -force ${destroot}${prefix}/share/info
      foreach b { c++ cpp fastjar g++ gcc gccbug gcj gcjh gcov gfortran gjnih grepjar } {
      system "cd ${destroot}${prefix}/bin && ln -s ${b}-mp-4.1 ${b}-dp-4.1"
      }
      # install/copy ffitarget.h only if we have it
      if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
      file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
      }

      xinstall -m 755 -d ${destroot}${prefix}/etc/select/gcc
      xinstall -m 444 ${filespath}/mp-gcc41 ${destroot}${prefix}/etc/select/gcc/
      }

      platform darwin 9 {
      patchfiles-append patch-make-exports.pl-leopard.diff
      # Workaround for libiconv on Mac OS X 10.5 Leopard: force configure
      # to look for the system's library, not the MacPort's one.
      configure.args-append --with-libiconv-prefix=/usr
      }

      platform darwin i386 {
      patchfiles-append patch-darwin.h.diff
      }

      Variant: odcctools {
      depends_lib-append bin:odas:odcctools
      patch {
      reinplace "s|/usr/bin/libtool|${prefix}/bin/odlibtool|g" ${workpath}/gcc-${version}/gcc/config/darwin.h
      }
      configure.args-append --with-as=${prefix}/bin/odas --with-ld=${prefix}/bin/odld --with-ar=${prefix}/bin/odar
      }

      livecheck.type regex
      livecheck.url http://gcc.gnu.org/gcc-4.1/
      livecheck.regex GCC (4\\.1\\.\[0-9\])


    If you haven't already installed Darwin Ports, you can find easy instructions for doing so at the main Darwin Ports page.

    Once Darwin Ports has been installed, in a terminal window and while online, type the following and hit return:


      %  cd /opt/local/bin/portslocation/dports/gcc41
      % sudo port install gcc41
      Password:
    You will then be prompted for your root password, which you should enter. You may have to wait for a few minutes while the software is retrieved from the network and installed for you. Y ou should see something that looks similar to:

      ---> Fetching gcc41
      ---> Verifying checksum for gcc41
      ---> Extracting gcc41
      ---> Configuring gcc41
      ---> Building gcc41 with target all
      ---> Staging gcc41 into destroot
      ---> Installing gcc41
    - Make sure that you do not close the terminal window while Darwin Ports is working. Once the software has been installed, you can find further information about using gcc41 with these commands:
      %  man gcc41
      % apropos gcc41
      % which gcc41
      % locate gcc41

     Where to find more information:

    Darwin Ports



    Lightbox this page.