Problem of " driver.c:99: multiple definition of `main' "

Having trouble compiling the Yambo source? Using an unusual architecture? Problems with the "configure" script? Problems in GPU architectures? This is the place to look.

Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan, Nicola Spallanzani

Forum rules
If you have trouble compiling Yambo, please make sure to list:
(1) the compiler (vendor and release: e.g. intel 10.1)
(2) the architecture (e.g. 64-bit IBM SP5)
(3) if the problems occur compiling in serial/in parallel
(4) the version of Yambo (revision number/major release version)
(5) the relevant compiler error message
Post Reply
User avatar
souledge
Posts: 4
Joined: Tue Mar 15, 2011 4:44 pm

Problem of " driver.c:99: multiple definition of `main' "

Post by souledge » Mon Oct 24, 2011 12:37 pm

Dear all
I am trying to compile Yambo-3.2.4-r.855. My configure was as:

Code: Select all

./configure --exec-prefix=/home/User/ProgramFiles/Yambo --prefix=/home/User/ProgramFiles/Yambo/LIBS --with-fftw=/usr/local/lib/libfftw3.a --with-mpi=/home/User/ProgramFiles/MPICH/lib/libmpich.a --with-libxc-lib=/home/User/ProgramFiles/LibXC/lib --with-libxc-include=/home/User/ProgramFiles/LibXC/include --with-p2y=4.0 --with-iotk=/home/User/ProgramFiles/Quantum-ESPRESSO/iotk FC=mpif90 LDFLAGS=-nofor_main
Then I obtained the configure result as:
#
# [VER] 3.2.4 r.855
#
# [SYS] linux@x86_64
# [SRC] /home/User/Download/yambo-3.2.4-r.855
# [BIN] /home/User/ProgramFiles/Yambo/LIBS/bin
# [FFT] FFTW Fast Fourier transform
#
# [ ] Double precision
# [X] Redundant compilation
# [X] MPI
# [X] PW (4.0) support
# [ ] ETSF I/O support
# [ ] SCALAPACK
# [X] LibXC
# [ ] NETCDF/HDF5/Large Files
# [XX ] Built-in BLAS/LAPACK/LOCAL
#
# [ CPP ] gcc -E -P
# [ C ] gcc -g -O2 -D_C_US -D_FORTRAN_US
# [MPICC] mpicc -g -O2 -D_C_US -D_FORTRAN_US
# [ F90 ] mpif90 -O
# [MPIF ] mpif90 -O
# [ F77 ] mpif90 -O
# [Cmain]
# [NoOpt] -O0
#
# [ MAKE ] make
# [EDITOR] vim
#
Finally, during compiling by make yambo, an error occurred:
make[1]: Entering directory `/home/User/Download/yambo-3.2.4-r.855/driver'
yambo_driver.F
driver.o: In function `main':
/home/User/Download/yambo-3.2.4-r.855/driver/driver.c:99: multiple definition of `main'
/home/User/intel/composer_xe_2011_sp1.6.233/compiler/lib/intel64/for_main.o:/export/users/nbtester/efi2linux_nightly/branch-12_1/20110812_000000/libdev/frtl/src/libfor/for_main.c:(.text+0x0): first defined here
/home/User/intel/composer_xe_2011_sp1.6.233/compiler/lib/intel64/for_main.o: In function `main':
/export/users/nbtester/efi2linux_nightly/branch-12_1/20110812_000000/libdev/frtl/src/libfor/for_main.c:(.text+0x38): undefined reference to `MAIN__'
make[1]: *** [yambo] Error 1
make[1]: Leaving directory `/home/User/Download/yambo-3.2.4-r.855/driver'
make: *** [yambo] Error 2
I have checked the post: viewtopic.php?f=1&t=313, but I found I have used the parameter LDFLAGS=-nofor_main.
How could I solve this problem?
Any suggestion will be welcome.
GAO Zhe
Ph.D Candidate
Ceramic Metal Composite Lab,
Materials Science and Engineering,
Seoul Nat'l Univ., Seoul, S.Korea

User avatar
claudio
Posts: 456
Joined: Tue Mar 31, 2009 11:33 pm
Location: Marseille
Contact:

Re: Problem of " driver.c:99: multiple definition of `main' "

Post by claudio » Mon Oct 24, 2011 2:21 pm

Dear GAO Zhe

if your mpif90 is in the your path try to configure yambo with the options:

./configure FC=ifort F77=ifort

cla
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com

User avatar
souledge
Posts: 4
Joined: Tue Mar 15, 2011 4:44 pm

Re: Problem of " driver.c:99: multiple definition of `main' "

Post by souledge » Mon Oct 24, 2011 5:36 pm

Thank you, Claudio, for your kindly and quickly reply.
I tried to set FC=ifort, it works well. However, I'm eager to know whether I can use MPI once I compiled Yambo with FC=ifort?
I am using MPICH2, which was compiled by ifort.
Furthermore question. After compile by "make all", there were only four files, a2y, p2y, yambo, and ??(I forgot the name, sorry), have been copied to ~/ProgramFiles/Yambo/bin, which I setted as --prefix=~/ProgramFiles/Yambo/LIBS --exec-prefix=~/ProgramFiles/Yambo. And there was no rule for "make install". May I delete the directory ~/Download/yambo-3.2.4-r.855 and just use the four files?
GAO Zhe
Ph.D Candidate
Ceramic Metal Composite Lab,
Materials Science and Engineering,
Seoul Nat'l Univ., Seoul, S.Korea

User avatar
claudio
Posts: 456
Joined: Tue Mar 31, 2009 11:33 pm
Location: Marseille
Contact:

Re: Problem of " driver.c:99: multiple definition of `main' "

Post by claudio » Mon Oct 24, 2011 5:46 pm

Dear GAO Zhe

>I tried to set FC=ifort, it works well. However, I'm eager to know whether I can use MPI once I compiled Yambo with FC=ifort?
>I am using MPICH2, which was compiled by ifort.

check after the configure if yambo found your MPI enviroment

# [ ] Double precision
# [X] Redundant compilation
# [X] MPI
# [X] PW (4.0) support
# [ ] ETSF I/O support
# [ ] SCALAPACK
# [ ] LibXC
# [X ] NETCDF/HDF5/Large Files
# [ X] Built-in BLAS/LAPACK/LOCAL

the MPI boxed has to be ticked

>Furthermore question. After compile by "make all", there were only four files, a2y, p2y, yambo, and ??(I forgot the name, sorry), have been copied to ~/ProgramFiles/Yambo/bin, which I setted as --prefix=~/ProgramFiles/Yambo/LIBS --exec-prefix=~/ProgramFiles/Yambo. And there was no rule for "make >install". May I delete the directory ~/Download/yambo-3.2.4-r.855 and just use the four files?

yes, you just need the executables: yambo, a2y, p2y, ypp

Cla
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com

Post Reply