Hey Tristan, Wesley, David & other ghdl folks! I've been trying to compile the newest ghdl for OS X (10.6.8) with a new gcc and run into the same problems. I patched ortho-lang.c and some Makefiles so I was able to build a ghdl1 and ghdl binaries that run, but do not work.
Here, I would like to share my experiences with you. Maybe it is helpful for building ghdl on Debian and we can team up to build it both on Debian and OS X with a current gcc toolchain. First, take a look at the mailing list archive: there were some previous attempts, on a yearly basis, in January 2010 and 2011. Switch to gcc 4.4.x tree, Lluís Batlle https://mail.gna.org/public/ghdl-discuss/2010-01/msg00020.html Moving GHDL to GCC 4.5.0, Kevin Steffensen https://mail.gna.org/public/ghdl-discuss/2011-01/msg00028.html What I did: First, I got a gcc with x86_64 and ADA support from http://sourceforge.net/projects/gnuada/files/ It is in GNAT_GCC Mac OS X / 4.6.0 Then I tried to compile gcc-4.6.0 with C, C++, Fortran and ADA support. I just did that to gain some confidence in the compiler I downloaded from gnuada. That all worked fine. I edited the patches from the mailing list so that a ghdl binary is compiled. There are still severe warnings so I don't expect the binary to run properly. See my random notes and patches in the attachment. It is still untested and my changes to ortho-lang.c are more or less (educated)-guesses as I have no experiences with programming front-/backends for gcc. At the moment I'm stuck with compiling the libraries because ghdl1 does not work. I get ghdl1: warning: command line option ‘--std=87’ is valid for vhdl but not for [enabled by default] Yes, there are two spaces between 'for' and '[enabled by default]'. That means that the complain_wrong_lang handler in opts-global.c is called and that write_lang does not set bad_lang. It's deliberately broken ... Wesley, do you have experience with programming GCC? Best wishes Dave
## Build GHDL on OS X x86_64-apple-darwin ## ====================================== ## Some random notes by Dave Webb ## 2012-01-10 ## GHDL Website ## http://ghdl.free.fr/site/pmwiki.php ## To compile GHDL a GCC compiler with ADA support is needed. ## Get gnat gcc 4.6.0 from gnuada at ## http://sourceforge.net/projects/gnuada/files/ ## It is in GNAT_GCC Mac OS X / 4.6.0 ## and called gcc-4.6.0-x86_64-apple-darwin-10.tar.bz2 mkdir ghdl-osx cd ghdl-osx DIR_GHDL_OSX=`pwd` mkdir downloads cd downloads ## Download gnuada ## http://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/4.6.0/gcc-4.6.0-x86_64-apple-darwin-10.tar.bz2/download wget -c http://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/4.6.0/gcc-4.6.0-x86_64-apple-darwin-10.tar.bz2 ## Download gcc 4.6.0 and libraries mpfr, mpc, gmp wget -c ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.6.0/gcc-core-4.6.0.tar.bz2 wget -c ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.6.0/gcc-fortran-4.6.0.tar.bz2 wget -c ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.6.0/gcc-g++-4.6.0.tar.bz2 wget -c ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.6.0/gcc-ada-4.6.0.tar.bz2 wget -c ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2 wget -c http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz wget -c http://www.mpfr.org/mpfr-current/mpfr-3.1.0.tar.bz2 ## get ghdl-0.29 release wget -c http://ghdl.free.fr/ghdl-0.29.tar.bz2 cd .. ## untar and prepare build mkdir untar cd untar tar xf ../downloads/gcc-core-4.6.0.tar.bz2 tar xf ../downloads/gcc-g++-4.6.0.tar.bz2 tar xf ../downloads/gcc-fortran-4.6.0.tar.bz2 tar xf ../downloads/gcc-ada-4.6.0.tar.bz2 tar xf ../downloads/mpfr-3.1.0.tar.bz2 tar xf ../downloads/mpc-0.9.tar.gz tar xf ../downloads/gmp-5.0.2.tar.bz2 tar xf ../downloads/ghdl-0.29.tar.bz2 tar xf ../downloads/gcc-4.6.0-x86_64-apple-darwin-10.tar.bz2 ## Move libraries mpfr, mpc and gmp in to the gcc directory. ## strip the version from the directory name so gcc will ## build the libraries on the fly. mv mpfr-* gcc-4.6.0/mpfr mv mpc-* gcc-4.6.0/mpc mv gmp-* gcc-4.6.0/gmp # do not move ghdl into the gcc tree yet cd .. ################################################################# ## First, to gain some confidence in the tools, ## try to compile gcc with Apple's gcc (C language only) ## Always build in a separate build directory. mkdir build cd build ../untar/gcc-4.6.0/configure --enable-languages=c --target=x86_64-apple-darwin --build=x86_64-apple-darwin --host=x86_64-apple-darwin time make -j16 ## This take about ten minutes and should not raise an error ## Now try more languages: ## Try to compile gcc (C, C++, Fortran) rm -rf * # in build ../untar/gcc-4.6.0/configure --enable-languages=c,c++,fortran --target=x86_64-apple-darwin --build=x86_64-apple-darwin --host=x86_64-apple-darwin time make -j16 ## Same with the gcc that has ADA from gnuada export PATH=$DIR_GHDL_OSX/untar/opt/gcc-4.6.0-x86_64/bin/:$PATH ## test if correct gcc is called, this should list ada gcc -v rm -rf * # in build ../untar/gcc-4.6.0/configure --enable-languages=c,c++,fortran --target=x86_64-apple-darwin --build=x86_64-apple-darwin --host=x86_64-apple-darwin time make -j16 ## now try to build ADA with ADA rm -rf * # in build ../untar/gcc-4.6.0/configure --enable-languages=c,c++,ada,fortran --target=x86_64-apple-darwin --build=x86_64-apple-darwin --host=x86_64-apple-darwin time make -j12 ## this all was to test the compiler to have same confidence in it. ## Now try to build ghdl with the downloaded compiler ## (maybe you can use the freshly compiled compiler) rm -rf * # in build ## go back to untar dir cd $DIR_GHDL_OSX/untar ## Now move ghdl VHDL extension into gcc cp -r ghdl-0.29/vhdl gcc-4.6.0/gcc/ ## apply patch for ## Makefile, Make-file.in and ortho-lang.c ## the patch is based on the untar directory patch -p0 < $DIR_GHDL_OSX/ghdl-0.29-osx.patch ## try to build rm -rf * # in build ## configure with disabled bootstrap ../untar/gcc-4.6.0/configure --enable-languages=c,c++,ada,fortran,vhdl --disable-bootstrap --target=x86_64-apple-darwin --build=x86_64-apple-darwin --host=x86_64-apple-darwin make -j12 ## create the patch ## RANLIB_FLAGS should not have -c cd $DIR_GHDL_OSX/untar diff -rup gcc-4.6.0/gcc/vhdl/Make-lang.in.orig gcc-4.6.0/gcc/vhdl/Make-lang.in diff -rup gcc-4.6.0/gcc/vhdl/ortho-lang.c.orig gcc-4.6.0/gcc/vhdl/ortho-lang.c diff -rup gcc-4.6.0/gcc/configure.orig gcc-4.6.0/gcc/configure ortho.c: replace functions: see gcc docu to understand how to change the functions: http://patchwork.ozlabs.org/patch/57555/ http://patchwork.ozlabs.org/patch/57906/ http://patchwork.ozlabs.org/patch/57911/ http://patchwork.ozlabs.org/patch/57962/ Test building a compiler: http://jeffreyearly.com/2011/01/21/fortran-compiled-mex-files-with-matlab-2010b-on-mac-os-x/ ghdl list discussions about new gcc: 2010-01-14, gcc 4.4.x http://www.mail-archive.com/[email protected]/msg00977.html 2011-01-26 http://www.mail-archive.com/[email protected]/msg01245.html 2011-04-17 http://www.mail-archive.com/[email protected]/msg01358.html 2012-01-07 http://www.mail-archive.com/[email protected]/msg01453.html
ghdl.patch
Description: Binary data
_______________________________________________ Ghdl-discuss mailing list [email protected] https://mail.gna.org/listinfo/ghdl-discuss
