Discussion:
[petsc-users] Error when compiling petsc on windows
Bruno Ramon Batista Fernande
2015-09-29 05:54:02 UTC
Permalink
Dear petsc users,

I have been trying to use use PETSC on my project on windows. I have
followed all steps and compiled petsc on windows using cygwin and cmake.
Then I included it on my visual studio project with all other dependencies.
After fixing several errors I got stuck with this one:

Error 1 error LNK2019: unresolved external symbol __imp_GetUserNameA
referenced in function PetscGetUserName libpetsc.lib(fuser.o)

Anyone has any Idea of which library I should include to solve such
problem?

I am using windows 8 machine with visual studio 2013 and Intel fortran
2013, MS MPI, metis, parmetis, and mkl. All libraries are compiled to x64
and the platform on the VS project was set to x64. I have also activated
the use of common windows libraries on the VS project to solve other
problems. This is the configure I used:

./configure --with-cc='win32fe cl' --with-fc='win32fe ifort'
--prefix=/cygdrive/c/Installed/petsc-opt/ --PETSC_ARCH=windows-intel-opt
--with-parmetis=1
--with-parmetis-include=/cygdrive/c/Installed/Parmetis/include_all/
--with-parmetis-lib=\[/cygdrive/c/Installed/Parmetis/lib/parmetis.lib\]
--with-metis=1
--with-metis-include=/cygdrive/c/Installed/Parmetis/include_all/
--with-metis-lib=\[/cygdrive/c/Installed/Parmetis/lib/metis.lib\]
--with-mpi-include=[/cygdrive/c/Installed/MPI/Include/,/cygdrive/c/Installed/MPI/Include/x64/]
--with-mpi-lib=[/cygdrive/c/Installed/MPI/Lib/x64/msmpi.lib,/cygdrive/c/Installed/MPI/Lib/x64/msmpifec.lib]
--with-blas-lapack-lib=[/cygdrive/c/Installed/mkl/lib/intel64/mkl_intel_lp64.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_core.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_sequential.lib]
--with-scalapack-include=/cygdrive/c/Installed/mkl/include
--with-scalapack-lib=[/cygdrive/c/Installed/mkl/lib/intel64/mkl_scalapack_lp64.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_blacs_msmpi_lp64.lib]
--with-fortran-interfaces=1 --with-debugging=0

regards,
Satish Balay
2015-09-29 17:21:26 UTC
Permalink
If you compile an example using a makefile - you should see something like:
***@ps3 ~/petsc.clone/src/ksp/ksp/examples/tutorials
$ make ex2
/home/sbalay/petsc.clone/bin/win32fe/win32fe cl -o ex2.o -c -MT -Z7 -I/home/sbalay/petsc.clone/include -I/home/sbalay/petsc.clone/arch-mswin/include -I/cygdrive/c/Program\ Files/MPICH2/include `pwd`/ex2.c
ex2.c
/home/sbalay/petsc.clone/bin/win32fe/win32fe cl -MT -Z7 -o ex2 ex2.o -L/home/sbalay/petsc.clone/arch-mswin/lib -lpetsc /cygdrive/c/Program\ Files/Intel/MKL/ia32/lib/mkl_c_dll.lib /cygdrive/c/Program\ Files/MPICH2/lib/fmpich2.lib /cygdrive/c/Program\ Files/MPICH2/lib/fmpich2g.lib /cygdrive/c/Program\ Files/MPICH2/lib/fmpich2s.lib /cygdrive/c/Program\ Files/MPICH2/lib/mpi.lib Gdi32.lib User32.lib Advapi32.lib Kernel32.lib Ws2_32.lib
/usr/bin/rm -f ex2.o

<<<<<<<<

From this list - there are some comiler libraries 'Gdi32.lib User32.lib Advapi32.lib Kernel32.lib Ws2_32.lib' listed
in the link linke.

One of them should provide __imp_GetUserNameA. [Perhaps you need to add them all to the link linke]

Satish
Post by Bruno Ramon Batista Fernande
Dear petsc users,
I have been trying to use use PETSC on my project on windows. I have
followed all steps and compiled petsc on windows using cygwin and cmake.
Then I included it on my visual studio project with all other dependencies.
Error 1 error LNK2019: unresolved external symbol __imp_GetUserNameA
referenced in function PetscGetUserName libpetsc.lib(fuser.o)
Anyone has any Idea of which library I should include to solve such
problem?
I am using windows 8 machine with visual studio 2013 and Intel fortran
2013, MS MPI, metis, parmetis, and mkl. All libraries are compiled to x64
and the platform on the VS project was set to x64. I have also activated
the use of common windows libraries on the VS project to solve other
./configure --with-cc='win32fe cl' --with-fc='win32fe ifort'
--prefix=/cygdrive/c/Installed/petsc-opt/ --PETSC_ARCH=windows-intel-opt
--with-parmetis=1
--with-parmetis-include=/cygdrive/c/Installed/Parmetis/include_all/
--with-parmetis-lib=\[/cygdrive/c/Installed/Parmetis/lib/parmetis.lib\]
--with-metis=1
--with-metis-include=/cygdrive/c/Installed/Parmetis/include_all/
--with-metis-lib=\[/cygdrive/c/Installed/Parmetis/lib/metis.lib\]
--with-mpi-include=[/cygdrive/c/Installed/MPI/Include/,/cygdrive/c/Installed/MPI/Include/x64/]
--with-mpi-lib=[/cygdrive/c/Installed/MPI/Lib/x64/msmpi.lib,/cygdrive/c/Installed/MPI/Lib/x64/msmpifec.lib]
--with-blas-lapack-lib=[/cygdrive/c/Installed/mkl/lib/intel64/mkl_intel_lp64.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_core.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_sequential.lib]
--with-scalapack-include=/cygdrive/c/Installed/mkl/include
--with-scalapack-lib=[/cygdrive/c/Installed/mkl/lib/intel64/mkl_scalapack_lp64.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_blacs_msmpi_lp64.lib]
--with-fortran-interfaces=1 --with-debugging=0
regards,
Bruno Ramon Batista Fernande
2015-09-29 20:30:34 UTC
Permalink
Hi Satish,

It worked with the mentioned libraries. Thank you very much.

Regards,

Bruno Fernandes
Post by Satish Balay
$ make ex2
/home/sbalay/petsc.clone/bin/win32fe/win32fe cl -o ex2.o -c -MT -Z7
-I/home/sbalay/petsc.clone/include
-I/home/sbalay/petsc.clone/arch-mswin/include -I/cygdrive/c/Program\
Files/MPICH2/include `pwd`/ex2.c
ex2.c
/home/sbalay/petsc.clone/bin/win32fe/win32fe cl -MT -Z7 -o ex2 ex2.o
-L/home/sbalay/petsc.clone/arch-mswin/lib -lpetsc /cygdrive/c/Program\
Files/Intel/MKL/ia32/lib/mkl_c_dll.lib /cygdrive/c/Program\
Files/MPICH2/lib/fmpich2.lib /cygdrive/c/Program\
Files/MPICH2/lib/fmpich2g.lib /cygdrive/c/Program\
Files/MPICH2/lib/fmpich2s.lib /cygdrive/c/Program\ Files/MPICH2/lib/mpi.lib
Gdi32.lib User32.lib Advapi32.lib Kernel32.lib Ws2_32.lib
/usr/bin/rm -f ex2.o
<<<<<<<<
From this list - there are some comiler libraries 'Gdi32.lib User32.lib
Advapi32.lib Kernel32.lib Ws2_32.lib' listed
in the link linke.
One of them should provide __imp_GetUserNameA. [Perhaps you need to add
them all to the link linke]
Satish
Post by Bruno Ramon Batista Fernande
Dear petsc users,
I have been trying to use use PETSC on my project on windows. I have
followed all steps and compiled petsc on windows using cygwin and cmake.
Then I included it on my visual studio project with all other
dependencies.
Post by Bruno Ramon Batista Fernande
Error 1 error LNK2019: unresolved external symbol __imp_GetUserNameA
referenced in function PetscGetUserName libpetsc.lib(fuser.o)
Anyone has any Idea of which library I should include to solve such
problem?
I am using windows 8 machine with visual studio 2013 and Intel fortran
2013, MS MPI, metis, parmetis, and mkl. All libraries are compiled to x64
and the platform on the VS project was set to x64. I have also activated
the use of common windows libraries on the VS project to solve other
./configure --with-cc='win32fe cl' --with-fc='win32fe ifort'
--prefix=/cygdrive/c/Installed/petsc-opt/ --PETSC_ARCH=windows-intel-opt
--with-parmetis=1
--with-parmetis-include=/cygdrive/c/Installed/Parmetis/include_all/
--with-parmetis-lib=\[/cygdrive/c/Installed/Parmetis/lib/parmetis.lib\]
--with-metis=1
--with-metis-include=/cygdrive/c/Installed/Parmetis/include_all/
--with-metis-lib=\[/cygdrive/c/Installed/Parmetis/lib/metis.lib\]
--with-mpi-include=[/cygdrive/c/Installed/MPI/Include/,/cygdrive/c/Installed/MPI/Include/x64/]
--with-mpi-lib=[/cygdrive/c/Installed/MPI/Lib/x64/msmpi.lib,/cygdrive/c/Installed/MPI/Lib/x64/msmpifec.lib]
--with-blas-lapack-lib=[/cygdrive/c/Installed/mkl/lib/intel64/mkl_intel_lp64.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_core.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_sequential.lib]
Post by Bruno Ramon Batista Fernande
--with-scalapack-include=/cygdrive/c/Installed/mkl/include
--with-scalapack-lib=[/cygdrive/c/Installed/mkl/lib/intel64/mkl_scalapack_lp64.lib,/cygdrive/c/Installed/mkl/lib/intel64/mkl_blacs_msmpi_lp64.lib]
Post by Bruno Ramon Batista Fernande
--with-fortran-interfaces=1 --with-debugging=0
regards,
Loading...