yambo-code / yambo

This is the official GPL repository of the yambo code
http://www.yambo-code.eu/
GNU General Public License v2.0
98 stars 38 forks source link

configuring prefix for "make" not working? #21

Closed ltalirz closed 5 years ago

ltalirz commented 5 years ago

This is using yambo 4.3.2

I'm trying to use the --prefix flag of the configure script to configure installation in a different folder than where the object files are built but I'm running into issues:

./configure --prefix=/usr/local
$ make yambo
cp: '/home/max/codes/yambo-4.3.2/lib/archive/Makefile' and 'lib/archive/Makefile' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/archive/Makefile.loc' and 'lib/archive/Makefile.loc' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/archive/fftw-3.3.6-pl1.tar.gz' and 'lib/archive/fftw-3.3.6-pl1.tar.gz' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/archive/iotk-y1.2.2.tar.gz' and 'lib/archive/iotk-y1.2.2.tar.gz' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/archive/keep-extlibs-stamp' and 'lib/archive/keep-extlibs-stamp' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/archive/libxc-2.2.3.tar.gz' and 'lib/archive/libxc-2.2.3.tar.gz' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/archive/package.list' and 'lib/archive/package.list' are the same file
cp: '/home/max/codes/yambo-4.3.2/config/missing' and 'config/missing' are the same file
cp: '/home/max/codes/yambo-4.3.2/lib/iotk/Makefile.loc' and 'lib/iotk/Makefile.loc' are the same file
/bin/sh: 2: test: /home/max/codes/yambo-4.3.2/lib/iotk/make_iotk.inc: unexpected operator

>>>[Making iotk]<<<
make[1]: Entering directory '/home/max/codes/yambo-4.3.2/lib/iotk'
if test -d iotk ; then ( cd iotk;  \
    if test -e /usr/local/lib/iotk/make.sys ; then rm /usr/local/lib/iotk/make.sys ; fi ; \
        if test -e /usr/local/lib/iotk/make_iotk.inc ; then \
           cp /usr/local/lib/iotk/make_iotk.inc /usr/local/lib/iotk/make.sys ; \
        fi ; \
        if test -e /home/max/codes/yambo-4.3.2/lib/iotk/iotk_specials.h ; then \
           cp /home/max/codes/yambo-4.3.2/lib/iotk/iotk_specials.h /usr/local/lib/iotk/iotk/include ; \
        fi ) ; \
fi
cp: cannot create regular file '/usr/local/lib/iotk/iotk/include': No such file or directory
Makefile:34: recipe for target 'configure-stamp' failed
make[1]: *** [configure-stamp] Error 1
make[1]: Leaving directory '/home/max/codes/yambo-4.3.2/lib/iotk'
Makefile:151: recipe for target 'ext-libs' failed
make: *** [ext-libs] Error 2

There are actually two issues I encountered:

./configure --help
`configure' configures Yambo 4.3.2 r.134 (based on r.15658 h.afdb12c8c) to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

[...]

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/home/max/codes/yambo-4.3.2]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/home/max/codes/yambo-4.3.2/bin', `/home/max/codes/yambo-4.3.2/lib' etc.  You can specify
an installation prefix other than `/home/max/codes/yambo-4.3.2' using `--prefix',
for instance `--prefix=$HOME'.

[...]
$ make install
make: *** No rule to make target 'install'.  Stop.

So, my questions would be:

sangallidavide commented 5 years ago

Indeed it is an open issue. It is also marked among the issues in the devel repo. https://github.com/yambo-code/yambo-devel/issues/33 (not accessible to everyone)

As an alternative if you have the source code say in "PATH_SRC" and you want to have it compiled in "PATH_PREFIX":

I also suggest to run the configure with the option --with-extlibs-path="PATH_YLIBS" where "PATH_YLIBS" can be any destination you like. yambo will install all the auto-compiled libraries in "PATH_YLIBS" After cleaning the source, the libraries will remain in "PATH_YLIBS" and re-running the configure with the same extlibs-path, the existing libs will be detected

ltalirz commented 5 years ago

thanks @sangallidavide , I'll give this a try

ltalirz commented 5 years ago

@sangallidavide I've followed your instructions as suggested and I still run into some issues - e.g.

/tmp $ mkdir yambo; cd yambo
/tmp/yambo $ ./configure --with-extlibs-path=/tmp/yambo
/tmp/yambo $ make yambo
...
chmod u+x /tmp/yambo2/gfortran/mpifort/lib/*xc*.a
chmod: cannot access '/tmp/yambo2/gfortran/mpifort/lib/*xc*.a': No such file or directory
Makefile:51: recipe for target '/tmp/yambo2/gfortran/mpifort/lib/libxc.a' failed
...

I then had to copy the libxc2.2.3 folder over (cp -r ~/codes/yambo-4.3.2/lib/libxc/libxc-2.2.3/ lib/libxc/), make yambo, then copy the built library at the right place (cp lib/libxc/libxc-2.2.3/src/.libs/libxc.a gfortran/mpifort/lib/) and make yambo again.

Most importantly, however, this produces lots of files in the "prefix" directory that I don't think would usually go there (a usual "prefix" being, e.g., /usr/local):

/tmp/yambo$ ls 
bin         config.status  include     Makefile  ypp
config      driver         interfaces  sbin
config.log  gfortran       lib         src

So, in order not to overcomplicate things, I think it's easier for the moment if I build yambo in the source directory and then copy only the files that are needed for running yambo to the prefix directory. Could you please let me know which files I would need to copy besides the binaries - if any (e.g. dynamically loaded libraries, ...)?

sangallidavide commented 5 years ago

You write /tmp/yambo $ ./configure --with-extlibs-path=/tmp/yambo but I do not see the configure inside /tmp/yambo. Also from the error message it seems you run something like /tmp/yambo $ ~/codes/yambo-4.3.2/configure --with-extlibs-path=/tmp/yambo2 and that the configure does not have permission to create the folder /tmp/yambo2 Is it so ?

Otherwise I do not understand where the 2 is coming from. I tried to reproduce the error and I was not able. Can you attach your config/report file ?

Also the --with-extlibs-path is meant to be different from the path where you install yambo. I'd use something like "/tmp/yambo-libs" Otherwise the default is to have the libs inside /tmp/yambo

In any case, yes, it does not put just what usually goes under prefix, but much more. Basically everything besides the original source. Instead, you just need to copy the binaries. Nothing else.

D.

ltalirz commented 5 years ago

You write /tmp/yambo $ ./configure --with-extlibs-path=/tmp/yambo but I do not see the configure inside /tmp/yambo.

Sorry, I mixed some (incorrectly) hand-written things together with actual error messages from different tries, this also explains the other inconsistencies you mention.

Also the --with-extlibs-path is meant to be different from the path where you install yambo. I'd use something like "/tmp/yambo-libs"

I see, thanks.

In any case, yes, it does not put just what usually goes under prefix, but much more. Basically everything besides the original source. Instead, you just need to copy the binaries. Nothing else.

Ok, cool, this is by far the easiest solution for the time being. Happy to test make; make install once it's available