Quite some time ago, I have posted a script that attempts to install Molden. This has become a very popular post but when I read the script again recently, I felt a strong obligation to post a much cleaner way to do things. The following instructions should work for any Debian based GNU/Linux distribution. This includes Ubuntu, but – while in the past, I have been using Ubuntu myself – I cannot recommend it any longer because it does a poor job in respecting your freedom. If you like Ubuntu‘s look & feel but value your freedom, you might want to give Trisquel a try. Anyway, this is about getting Molden to work.
First you will need to install a number of dependencies. I prefer gfortran but you may pick another Fortran compiler as well.
$ sudo apt-get install build-essential gfortran libX11-6 libX11-dev libgl1-mesa-dev libgl1-mesa-glx libglu1-mesa-dev libxmu-dev makedepend xutils-dev mesa-common-dev
Now download and extract the lastest Molden tarball.
$ wget ftp://ftp.cmbi.ru.nl/pub/molgraph/molden/molden5.0.tar.gz $ tar -xf molden5.0.tar.gz $ cd molden5.0
In the makefile
, one of the first lines assigns the variable FC
the name of the Fortran compiler to use. If using gfortran, it should read
FC = gfortran
If you have a 64bit operating system, comment / uncomment the following lines like this further down in the makefile
#LIBS = -L/usr/X11R6/lib -lX11 -lm LIBS = -L/usr/X11R6/lib64 -lX11 -lm
or vice versa for 32bit systems (which should be the default anyway).
Now build Molden. I get some ugly compiler warnings here, but they don’t seem to affect the usability of the product.
$ make
There is no install
target so you’ll have to manually
$ sudo install -t /usr/local/bin -m 755 molden gmolden
This should have been all. The build directory can now be removed.
23 Comments
Thanks a lot.
To get “makedepend”, I had to install “xutils-dev” dependency
thanks, updated post
To compile MOLDEN 5.07 on UBUNTU 12.04 LTS (updated on Feb 5, 2014), I had to install “libgl1-mesa-dri” instead of “libgl1-mesa-glx” dependency
Thank You, I have been changing OS ( from MInt, to Mageia, to Debian) for this.
hey many thanks!! works like a charm.
Thanks man! very helpful!
Thank you! It worked without problem on my fresh Ubuntu 12.04 LTS installation.
thanks its working perfectly on ubuntu 14.04
It seems that libx11-6 is a dependency for libx11-dev, so there is no need to install both explicity. Besides, libgl1-mesa-dev has both libx11-dev and libgl1-mesa-glx as dependencies. And libglu1-mesa-dev has libgl1-mesa-dev as dependendy.
So, in order to install molden on Ubuntu, I had to install gfortran, libglu1-mesa-dev and xutils-dev (because of makedepend). Be aware that I’ve used aptitude.
I didn’t change anything in the makefile for the current version (5.2.2, ftp://ftp.cmbi.ru.nl/pub/molgraph/molden/molden5.2.2.tar.gz). And since I’ve installed it on /opt/molden/5.2.2, I did:
sudo install -t /opt/molden/5.2.2 -m 755 molden gmolden ambfor/ambfor surf/surf
And that was it.
Thank you very much. It helped.
Thank you
Thank you very much for the post! However Im having a problem with the last step- it says
cannot stat ‘gmolden’: No such file or directory
I can load molden, but I would really need the improvements in gmolden. Do you know how I could fix it?
Thank you very much
I’m sorry, I’m not using the Ubuntu (or even Debian) environment myself any more so I cannot try reproducing your problem. Did you get any errors during the build process? Try `make gmolden` and carefully look at the output it produces to see at what point it fails. Maybe this can hint you into the right direction. You can also run `make -n gmolden` to only have it print what it *would* do without actually doing anything.
I did get some errors during the building, but I did not pay much attention (my fault) because I read that you also got them but did not compromise the functions of the program.
When doing ‘make gmolden’ after a bunch of lines I get this
collect2: error: ld returned 1 exit status
makefile:262: recipe for target ‘gmolden’ failed
make: *** [gmolden] Error 1
I don’t really know what that means.
I’ve noticed that in the makefile it says this:
# Linux version
#
# Make sure the Xwindow include files are installed in an rpm package
# called libX11-devel-*
# For gmolden you also need the OpenGL include files contained in the
# rpm packages mesa-libGL-devel* and mesa-libGLU-devel-*
Would it be a matter of installing these libraries? If so, how can I get them and where should I locate them?
Thank you very much!!
I got some (many) compiler *warnings*, not *errors*. It seems in fact that you are missing a GUI library that gmolden wants to link with. There should be an earlier error message that gives more details about the missing symbols which might help you locate the missing library. (Search the web for the symbols it mentions.) Also see the comments of other people above about these libraries. You can search for packages in Ubuntu via the graphical package manager or online at http://packages.ubuntu.com/ . After you have installed the packages providing the libraries, try building again. As long as the packages don’t conflict which each other (your package manager will tell you this), there is no harm done by installing more packages than actually needed for the build (except for unnecessary usage of disk space, of course) so you may install them liberally in case of doubt.
Thank you again! With respect to the error that I posted before
makefile:262: recipe for target ‘gmolden’ failed
If I look at the makefile, in line 262 it says
gmolden: $(OBJS) mpdum.o xwingl.o
$(LDR) -o gmolden $(OBJS) mpdum.o xwingl.o $(LIBSG)
Does that give any hint?
I am trying to download the libraries but I am not sure how to do it. I found this website with the libraries
https://www.rpmfind.net/linux/rpm2html/search.php?query=mesa-libGL-devel
but I have never done it before. Is there any relatively easy way out of this or with each problem that I face I will be more lost? 🙂
Thank you very much
Look for the line in the `Makefile` that sets the `LIBSG` variable. It should contain linker flags of the kind `-lfoo -lbar …`. Then check for each listed library (in this case: libfoo and libbar) what package provides them, using the search function of your package manager and install the respective packages. There should be no need to download and install any packages manually.
Hi again. Thanks for the indications. It turns out that my machine is missing the Nvidia drivers, that is why I was getting constantly strange messages. Ill try to install it and proceed how you suggested.
Thanks
thank you so much so helpfull !!!!
I made a .sh file that installs molden 5.7 almost automatically (it asks for the user password in the beginning and a “y” near of the end), but it does not change anything inside of the makefile, just update everything needed and compile it, it worked in my ubuntu 16. If there is anyone interested, i can post the code here if is possible and allowed.
Awesome blog! Do you have any helpful hints for aspiring writers?
I’m planning to start my own site soon but I’m a little lost on everything.
Would you propose starting with a free platform like WordPress or go for a paid option? There are so
many choices out there that I’m completely confused ..
Any tips? Thank you!
Great post however , I was wanting to know if you could write a litte more on this subject?
I’d be very grateful if you could elaborate a little
bit more. Kudos!
while running make command I am getting this error
rdchx.f:3634:21:
call gettop(qat,iconn,iuncon,ityp)
1
Warning: Rank mismatch in argument ‘qat’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
rdchx.f:5972:29:
call flth(jat,icnn2,ibnds2,iconn)
1
Error: Actual argument contains too few elements for dummy argument ‘icnn’ (10/11) at (1)
rdchx.f:5977:39:
call flth(kat,icnn2,ibnds2,iconn)
1
Error: Actual argument contains too few elements for dummy argument ‘icnn’ (10/11) at (1)
rdchx.f:6004:29:
call flth(jat,icnn2,ibnds2,iconn)
1
Error: Actual argument contains too few elements for dummy argument ‘icnn’ (10/11) at (1)
rdchx.f:6019:33:
call flth(icnn(i),icnn2,ibnds2,iconn)
1
Error: Actual argument contains too few elements for dummy argument ‘icnn’ (10/11) at (1)
rdchx.f:6050:38:
call flth(jat,icnn2,ibnds2,iconn)
1
Error: Actual argument contains too few elements for dummy argument ‘icnn’ (10/11) at (1)
rdchx.f:6065:35:
call flth(jat,icnn2,inb,iconn)
1
Error: Actual argument contains too few elements for dummy argument ‘icnn’ (10/11) at (1)
make: *** [: rdchx.o] Error 1
please suggest
One Trackback
[…] on this blog, but the script provided below is very ugly. Please follow the instructions given in this update […]