diff options
Diffstat (limited to 'doc/oldmds/BUILD.txt')
-rw-r--r-- | doc/oldmds/BUILD.txt | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/doc/oldmds/BUILD.txt b/doc/oldmds/BUILD.txt new file mode 100644 index 000000000..27029b757 --- /dev/null +++ b/doc/oldmds/BUILD.txt @@ -0,0 +1,140 @@ +Build GHDL (Long instructions) +****************************** + +GHDL supports many backend (code generator), so you first must choose +the backend you want to use. There are currently 3 supported backends: + +* gcc +* mcode (this is an internal code generator for x86_64 and i386) +* llvm (experimental) + +Here is a short comparaison: + +* gcc: ++ generated code is faster (particularly with -O or -O2) ++ generated code can be debugged (with -g) ++ the output is an executable ++ ported to many platforms (x86, x86_64, powerpc, sparc) +- analyze can takes time (particularly for big units) +- build is more complex + +* mcode ++ very easy to build +- but x86_64/i386 only ++ very quick analysis time ++ can analyze very big designs +- simulation is slower +- no executable created + +* llvm ++ same advantages of gcc (good generated code, debuggable) ++ easier to build than gcc + +As GHDL is written in Ada, you need to use the GNU Ada compiler (GNAT). +I recommend to use GNAT GPL from http://libre.adacore.com (free). +GHDL was tested with GNAT GPL 2014. Any later version should work. +The only other dependency is zlib (On ubuntu/debian, install zlib1g-dev). + +On UNIX and MinGW systems, you also need standard utilities like sh, +cmp or make. On MSYS2 packages msys/diffutils and msys/make must be +installed. + +In these instructions, the configure script is executed in the source +directory; but you can execute in a different directory too, like +this: +$ mkdir ghdl-objs +$ cd ghdl-objs +$ ../path/to/ghdl/configure ... + +Building with mcode backend +*************************** + +This is as simple as: +$ ./configure --prefix=PREFIX + where PREFIX is the directory for installation +$ make + This builds the ghdl_mcode executable, which can be used as is. +$ make install + To install within PREFIX + +Building with the gcc backend +***************************** + +You need to download and untar the sources of +gcc version 4.9.x, 5.x, 6.x or 7.x + +First configure ghdl, specify gcc source dir and prefix. +(replace /usr/local by your prefix directory): +$ ./configure --with-gcc=/path/to/gcc/source/dir --prefix=/usr/local + +Then invoke make to copy ghdl sources in the source dir: +$ make copy-sources + +There are some dependencies for building gcc (gmp, mpfr and mpc). If you have +not them installed on your system, you can either build them manually or use +the 'download_prerequisite' script provided in gcc source tree (recommended). + +$ cd /path/to/gcc/source/dir +$ ./contrib/download_prerequisites + +Then configure gcc. The list of --disable configure options could be +adjusted for your needs. GHDL don't require all these optional +libraries and disabling them speed-up the build. Note the prefix +directory must be the same as the one used to configure ghdl. +If you have manually built gmp/mpfr/mpc (without using the script +in contrib) and if you have installed them in a non-standard +directory, you may need to add --with-gmp=GMP_INSTALL_DIR. +If your system gcc was configured with --enable-default-pie (check if +that option appears in the output of gcc -v), you should also add it. + +$ mkdir gcc-objs; cd gcc-objs +$ ../gcc-4.9.3/configure --prefix=/usr/local --enable-languages=c,vhdl \ + --disable-bootstrap --disable-lto --disable-multilib \ + --disable-libssp --disable-libgomp --disable-libquadmath +$ make -j2 + +Install gcc: +$ make install +or if you don't want to install makeinfo: +$ make install MAKEINFO=true + +Build and install vhdl libraries: +$ cd /path/to/ghdl/source/dir +$ make ghdllib +$ make install + +Building with the llvm backend +****************************** + +You need to build and install llvm. The supported versions are 3.5 +till 5.x, but only debugging is only supported with llvm 3.5 +(Usually llvm also depends on libedit). + +First configure ghdl with '--with-llvm-config' +$ ./configure --with-llvm-config + +If llvm-config is not in your path, you can specify it: +$ ./configure --with-llvm-config=LLVM_INSTALL/bin/llvm-config + +If you want to have stack backtraces on errors (like assert failure or +index of out bounds), you need to configure and build libbacktrace from gcc +(you don't need to configure gcc), and add to configure: + --with-backtrace-lib=/path-to-gcc-build/libbacktrace/.libs/libbacktrace.a + +Then build with 'make' and install with 'make install'. + +Notes for developpers +********************* + +Developping with the gcc backend: +Once gcc (with ghdl) has been built once, it is possible to work on ghdl +sources tree without copying them in gcc tree. Commands are: +$ make ghdl1-gcc # To build the compiler +$ make ghdl_gcc # To build the driver +$ make libs.vhdl.local_gcc # To compile the vhdl libraries +$ make grt-all # To build the ghdl runtime + +In src/ortho/gcc, create a Makefile.conf file that sets the following +variables: +AGCC_GCCSRC_DIR=/path/to/gcc/sources +AGCC_GCCOBJ_DIR=/path/to/gcc/build |