improved MELT installation guide

34 views
Skip to first unread message

Basile Starynkevitch

unread,
Jul 27, 2015, 9:13:51 AM7/27/15
to gcc-...@googlegroups.com
Hello All
(and BCC to the person who asked me privately for help regarding MELT installation)

I just improved the MELT installation guide on http://gcc-melt.org/download.html#buildplugin_id

Your feedback is welcome.

(I'm soon leaving for summer holidays)

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Basile Starynkevitch

unread,
Jul 28, 2015, 10:29:43 AM7/28/15
to gcc-...@googlegroups.com
On 07/27/2015 15:13, Basile Starynkevitch wrote:

I just improved the MELT installation guide on http://gcc-melt.org/download.html#buildplugin_id


Here are some possible instructions to install MELT outside of the GCC tree, when you don't have root access, for a Linux system which has a recent GCC compiler (4.9 at least).

Be sure to read http://gcc-melt.org/download.html#buildplugin_id (I did upgrade that page a few hours ago)

First, be sure that GCC is correctly installed and that the plugin extras are correctly installed.

So run

  gcc -v

It should output several lines, on my system (Debian/Sid) I am getting (but YMMV)

Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.3-3' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.3 (Debian 4.9.3-3)


Notice the --enable-plugin in the output. If you don't have that, ask your system administrator for a better GCC.

Then, check that you have the plugin headers. So run

   ls -l $(gcc -print-file-name=plugin)/include/gcc-plugin.h

You should get some existing file, I am getting
-rw-r--r-- 1 root root 5122 Jul 24 06:11 /usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gcc-plugin.h

You might even look into that file with your editor or some pager.
If you don't get any gcc-plugin.h file, ask your system administrator to install GCC plugins headers. On Debian, that means that he/she runs: aptitude install gcc-4.9-plugin-dev
Ask also your sysadmin to install all the dependencies needed to build the compiler:
aptitude build-dep g++-4.9 gcc-4.9 and of course to be sure to have
the compilers themselves aptitude install g++-4.9 gcc-4.9

You need all of the following commands to be available
make gcc g++ autogen tr tar bunzip2 sed makeinfo texi2html texi2pdf wget realpath basename date ls rm bash gawk install astyle unifdef indent
so check each of these individually that you've got them. I suggest running each of them with --version or --help
If you don't have a command, ask your sysadmin to install it.

Then go into some temporary directory that you just have made, e.g.

   mkdir /tmp/my-melt-plugin-build-tree
   cd /tmp/my-melt-plugin-build-tree

Be sure that the directory is empty. Test with ls -als that it is indeed the case...

Then, download the MELT plugin source tree using the wget utility.

   wget http://gcc-melt.org/melt-1.2.0-plugin-for-gcc-4.9-or-5.tar.bz2

and untar the compressed archive. Test with ls and md5sum that you downloaded it correctly. With a recent enough GNU tar you just need to

    tar xvf melt-1.2.0-plugin-for-gcc-4.9-or-5.tar.bz2

This should create and fill a sub-directory named ./melt-1.2.0-plugin-for-gcc-4.9-or-5 so go there:
      cd melt-1.2.0-plugin-for-gcc-4.9-or-5
You should have many files in the current directory. Check with ls -l and you should have a README-MELT-PLUGIN file. Use your favorite editor (emacs, vim, gedit, kate, nano, ... or $EDITOR) or pager (less, more, most, $PAGER, $MORE) to read that README-MELT-PLUGIN file.


Now, learn about the script command, see e.g. http://www.computerhope.com/unix/uscript.htm and the tee command, see tee(1) e.g. http://man7.org/linux/man-pages/man1/tee.1.html . It might be useful to keep a log of all what you have typed, etc..

Now, get some drink and relax. Don't keep your eyes on your screen. You need some rest for 5 to 10 minutes.



Since you want to install MELT outside of GCC tree and without requiring root access you need to decide where it should go, i.e. where it will be installed. This should be a "permanent" directory outside of GCC tree and of course outside of your temporary MELT installation directory. So set a MY_MELT_FINAL_TREE shell variable to some sensible permanent path, e.g.

   MY_MELT_FINAL_TREE=$HOME/my-melt

then make that a directory and check that it is existing and empty

   mkdir -p $MY_MELT_FINAL_TREE
   ls -la $MY_MELT_FINAL_TREE
   echo $MY_MELT_FINAL_TREE

let us pretend that you are getting /home/lov/my-melt as the output of that last echo $MY_MELT_FINAL_TREE command; of course, in the rest of this text, replace /home/lov/my-melt with whatever is appropriately given as output from above.

For your safety, make a backup of the Makefile.

   cp -v Makefile Makefile.backup ;  ls -l Makefile.backup

Then, edit the Makefile with your favorite editor (e.g. emacs, vim, nano, gedit, $EDITOR, ...)

   $EDITOR Makefile

of course, replace $EDITOR by what editor you like the best.

Replace the line MELTGCC_PLUGIN_DIR:= $(shell $(MELTGCC) -print-file-name=plugin) (probably near line 147 of Makefile) with
MELTGCC_PLUGIN_DIR:=/home/lov/my-melt
of course you should replace /home/lov/my-melt by whatever is appropriate for your particular system and conventional choices

You probably should also replace the few following lines defining MELTGCC_DOC_INFO_DIR MELTGCC_DOC_HTML_DIR MELTGCC_DOC_PDF_DIR to fit your needs, something like MELTGCC_DOC_INFO_DIR:=/home/lov/my-melt/doc/info/ etc

Now is the serious moment of trying to build MELT. Type (assuming your shell is bash)

   make 2>&1 | tee making-melt.log

Look during a couple of minutes if the output is good.

Now, you have half an hour available for relaxing, drinking, or even a quick lunch.

After nearly thirty minutes, if all goes well, you should have many messages, ending with something similar to

++++++++++++++++++++++++++++++++++++++++++++++++++++++
*** MELT plugin "1.2.0" compilation completed at Tue Jul 28 16:20:26 2015 ***


If you had this, congratulations! You have successfully compiled MELT. Now you need to install it.

Since you have write access to the $MY_MELT_FINAL_TREE you could directly run (without taking into account the suggestion to use make install DESTDIR=/tmp/meltinstall-1.2.0 as the messages are telling you)

    make install

and you should notice that things are getting installed in /home/lov/my-melt/


To use such a MELT installed outside of the GCC tree, you'll need to give a full path for the MELT plugin, e.g.

    gcc -fplugin=/home/lov/my-melt/melt.so


(you obviously can't just use gcc -fplugin=melt.so or gcc -fplugin=melt ...)

Hope that this will help (in particular the person who emailed me privately for help)

Regards

munlove92

unread,
Jul 29, 2015, 1:44:00 AM7/29/15
to gcc-melt, bas...@starynkevitch.net
I am compiling MELT 1.1.3,
At this step: 
"Now is the serious moment of trying to build MELT. Type (assuming your shell is bash)

   make 2>&1 | tee making-melt.log"

I have the error as attached, even though I have followed the instruction and change the Makefile accordingly to output of `echo $MY_MELT_FINAL_TREE`

The following is part of the Makefile that I have edited: 

`## the existing GCC plugin directory
MELTGCC_PLUGIN_DIR:=/home/users/jonmun/my-melt

### distribution makers might want to override these....
## the directory where *.info doc files are installed
MELTGCC_DOC_INFO_DIR:=/home/users/jonmun/my-melt/doc/info/
## the directory where *.html doc files are installed
MELTGCC_DOC_HTML_DIR :=/home/users/jonmun/my-melt/doc/html/gcc/
## the directory where *.pdf doc files are installed
MELTGCC_DOC_PDF_DIR :=/home/users/jonmun/my-melt/doc/pdf/gcc/
`

May I know what is the problem with it?
making-melt.log

Basile Starynkevitch

unread,
Jul 29, 2015, 1:50:21 AM7/29/15
to munlove92, gcc-melt
Look into the Makefile, you could found the solution yourself...

You need to have the GCC plugin header files there and also gengtype & gtype.state. So you could make a symlink

   ln -sv $(gcc -print-file-name=plugin)/* $MY_MELT_FINAL_TREE

Hope that this will help...
Reply all
Reply to author
Forward
0 new messages