[petsc-users] Calling convention from windows VC++ and IFC

Alexander Grayver agrayver at gfz-potsdam.de
Fri Mar 4 04:27:38 CST 2011


I did that.

Today I reconfigured everything from scratch with the following line:

./config/configure.py --with-cc='win32fe cl' --with-fc='win32fe ifort'  
--with-cxx='win32fe cl' --with-windows-graphics=0 
--download-f-blas-lapack=1 --with-precision=double 
--with-scalar-type=complex --with-clanguage=cxx 
--with-mpi-include="/cygdrive/d/Dev/HPC_2008_SDK/Include" 
--with-mpi-lib=["/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpi.lib","/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib"] 
--useThreads=0

Note I canceled out win32draw subsystem.
I also added one line to this file /petsc-3.1-p7/src/sys/utils/fuser.c:
#undef PETSC_HAVE_GET_USER_NAME

After configuration and compilation I tried FORTRAN example ex5f (make 
test) and my linker crashed!

Running test examples to verify correct installation
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 1 
MPI process
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 2 
MPI processes
--------------Error detected during compile or link!-----------------------
See http://www.mcs.anl.gov/petsc/petsc-2/documentation/troubleshooting.html
/cygdrive/d/dev/petsc-3.1-p7/bin/win32fe/win32fe ifort -c  -MT -Z7 -fpp  
-I/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/include 
-I/cygdrive/d/dev/petsc-3.1-p7/include 
-I/cygdrive/d/Dev/HPC_2008_SDK/Include   
-I/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/include 
-I/cygdrive/d/Dev/HPC_2008_SDK/Include    -o ex5f.o ex5f.F
/cygdrive/d/dev/petsc-3.1-p7/bin/win32fe/win32fe ifort -MT -Z7 -fpp  -o 
ex5f ex5f.o -L/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib 
-L/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib -lpetsc  
-L/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib -lflapack -lfblas 
/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpi.lib 
/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib Gdi32.lib User32.lib 
Advapi32.lib Kernel32.lib Ws2_32.lib

LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage

Then I deleted option "-Z7" from linker and... at last it works!

BLAS/LAPACK seem good now (don't know what happened:) ).
I would suggest that the problem is that my windows is x64 and PETSc 
supply 32-bit libraries for win32draw subsystem and GetUserNameA 
function.  Probably this issue should be taken into account by build system.

Great thanks for patience and help to all and especially to Sr. Satish 
Balay. You do great job.

On 03.03.2011 19:53, Alexander Grayver wrote:
> Thanks Satish,
>
> I've tried that. Still doesn't work. The same error. Probably changes 
> were not applied properly.
> I built PETSc without any -Gz and sent logs to petsc-maint at mcs.anl.gov
> Errors now are the same as in the first message of the thread.
>
> Alexander
>
> On 03.03.2011 18:01, Satish Balay wrote:
>> You can try adding the following to
>> /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/include/petscconf.h
>> and rebuild the libraries [witout rerunning configure] and
>> see if the fortran examples work.
>>
>> #ifndef PETSC_STDCALL
>> #define PETSC_STDCALL __stdcall
>> #endif
>>
>> Ideally configure should set this if -Gz was specified to CC aswell -
>> but changing CFLAGS is tricky on windows, and there is no equivalent
>> of CXX_CXXFLAGS - so the alternative would be COPTFLAGS.
>>
>> However you could try the default build [witout any -Gz] - and send
>> all the logs to petsc-maint - and we can try figuring out the issue.
>>
>> Satish
>>
>> On Thu, 3 Mar 2011, Alexander Grayver wrote:
>>
>>> Really! Thanks Satish. Errors apparently are different when I use 
>>> stdcall
>>> convention for compiling instead of default one. But the question is 
>>> how to
>>> combine these interfaces now?
>>>
>>> On 03.03.2011 16:48, Satish Balay wrote:
>>>> Oh - I see that with --CXX_CXXFLAGS=-Gz - you get different errors 
>>>> - not
>>>> blaslapack errors.
>>>>
>>>>>>>> libpetsc.lib(fuser.o) : error LNK2019: unresolved external symbol
>>>>>>>> __imp_GetUserNameA referenced in function "int __cdecl
>>>>>>>> PetscGetUserName(char *
>>>>>>>> const,unsigned__int64)" (?PetscGetUserName@@YAHQEAD_K at Z)
>>>> This is due to compiling C interface with -Gz - so now fortran
>>>> interface is unable to link with the c interface.
>>>>
>>>> Satish
>>>>
>>>> On Thu, 3 Mar 2011, Satish Balay wrote:
>>>>
>>>>> Currently I don't have access to ifort to try.
>>>>>
>>>>> For one - its strange that c/c++ examples work - but not fortran - 
>>>>> esp
>>>>> because all blas calls are from the same c/c++ PETSc code.
>>>>>
>>>>> One thing you can try:
>>>>>
>>>>> cd src/ksp/ksp/examples/tutorials
>>>>> make ex2
>>>>> make ex2f
>>>>>
>>>>> [if ex2 works and ex2f fails - edit makefile - and change target 
>>>>> ex2f:
>>>>> from using FLINKER to CLINKER and see if it makes a difference]
>>>>>
>>>>> Satish
>>>>>
>>>>> On Thu, 3 Mar 2011, Alexander Grayver wrote:
>>>>>
>>>>>> Actually, I've added this flag after sending first message to 
>>>>>> mailing
>>>>>> list
>>>>>> (sorry for inconveniences) because I though it could help, 
>>>>>> unfortunately
>>>>>> it
>>>>>> didn't.
>>>>>>
>>>>>> The problem probably could be reproduced compiling petsc using
>>>>>> --with-clanguage=cxx and VC++ and then trying to run FORTRAN 
>>>>>> examples.
>>>>>>
>>>>>> On 03.03.2011 16:26, Satish Balay wrote:
>>>>>>> perhaps you can remove '--CXX_CXXFLAGS=-Gz' and retry.
>>>>>>>
>>>>>>> Satish
>>>>>>>
>>>>>>> On Thu, 3 Mar 2011, Alexander Grayver wrote:
>>>>>>>
>>>>>>>> I've sent them, thanks!
>>>>>>>>
>>>>>>>> I also must note that this is a problem for fortran examples only!
>>>>>>>> Because
>>>>>>>> when I've done "make  test" after building the situation was:
>>>>>>>>
>>>>>>>> mt at agrayver /cygdrive/d/dev/petsc-3.1-p7
>>>>>>>> $ make PETSC_DIR=/cygdrive/d/dev/petsc-3.1-p7
>>>>>>>> PETSC_ARCH=cygwin-cxx-debug
>>>>>>>> test
>>>>>>>> Running test examples to verify correct installation
>>>>>>>> C/C++ example src/snes/examples/tutorials/ex19 run successfully 
>>>>>>>> with
>>>>>>>> 1 MPI
>>>>>>>> process
>>>>>>>> C/C++ example src/snes/examples/tutorials/ex19 run successfully 
>>>>>>>> with
>>>>>>>> 2 MPI
>>>>>>>> processes
>>>>>>>> --------------Error detected during compile or
>>>>>>>> link!-----------------------
>>>>>>>> See
>>>>>>>> http://www.mcs.anl.gov/petsc/petsc-2/documentation/troubleshooting.html 
>>>>>>>>
>>>>>>>> /cygdrive/d/dev/petsc-3.1-p7/bin/win32fe/win32fe ifort -c  -MT -Z7
>>>>>>>> -fpp
>>>>>>>> -I/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/include
>>>>>>>> -I/cygdrive/d/dev/petsc-3.1-p7/include
>>>>>>>> -I/cygdrive/d/Dev/HPC_2008_SDK/Include
>>>>>>>> -I/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/include
>>>>>>>> -I/cygdrive/d/Dev/HPC_2008_SDK/Include    -o ex5f.o ex5f.F
>>>>>>>>
>>>>>>>> /cygdrive/d/dev/petsc-3.1-p7/bin/win32fe/win32fe ifort -MT -Z7 
>>>>>>>> -fpp
>>>>>>>> -o
>>>>>>>> ex5f
>>>>>>>> ex5f.o -L/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib
>>>>>>>> -L/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib -lpetsc
>>>>>>>> -L/cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib -lflapack
>>>>>>>> -lfblas
>>>>>>>> /cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpi.lib
>>>>>>>> /cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib Gdi32.lib
>>>>>>>> User32.lib
>>>>>>>> Advapi32.lib Kernel32.lib Ws2_32.lib
>>>>>>>>
>>>>>>>> libpetsc.lib(fuser.o) : error LNK2019: unresolved external symbol
>>>>>>>> __imp_GetUserNameA referenced in function "int __cdecl
>>>>>>>> PetscGetUserName(char *
>>>>>>>> const,unsigned__int64)" (?PetscGetUserName@@YAHQEAD_K at Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_ReleaseDC referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct_p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_BitBlt referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct _p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_ExtFloodFill referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct _p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_SelectObject referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct _p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_CreateCompatibleBitmap referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct _p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_CreateCompatibleDC referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct _p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_GetDC referenced in function "int __cdecl
>>>>>>>> PetscDrawSetDoubleBuffer_Win32(struct _p_PetscDraw *)"
>>>>>>>> (?PetscDrawSetDoubleBuffer_Win32@@YAHPEAU_p_PetscDraw@@@Z)
>>>>>>>> libpetsc.lib(win32draw.o) : error LNK2019: unresolved external
>>>>>>>> symbol
>>>>>>>> __imp_UpdateWindow referenced in function "int __cdecl
>>>>>>>> PetscDrawRectangle_Win32(struct _p_PetscDraw
>>>>>>>> *,double,double,double,double,int,int,int,int)"
>>>>>>>> (?PetscDrawRectangle_Win32@@YAHPEAU_p_PetscDraw@@NNNNHHHH at Z)
>>>>>>>>
>>>>>>>> On 03.03.2011 14:49, Satish Balay wrote:
>>>>>>>>> can you send the corresponding configure.log and make.log to
>>>>>>>>> petsc-maint at mcs.anl.gov?
>>>>>>>>>
>>>>>>>>> Satish
>>>>>>>>>
>>>>>>>>> On Thu, 3 Mar 2011, Alexander Grayver wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> I built PETSc-3.1 using VC++ 2008 and IFC 10.1 with the
>>>>>>>>>> following
>>>>>>>>>> configuration line:
>>>>>>>>>>
>>>>>>>>>> ./config/configure.py --with-cc='win32fe cl' --with-fc='win32fe
>>>>>>>>>> ifort'
>>>>>>>>>> --with-cxx='win32fe cl'  --download-f-blas-lapack=1
>>>>>>>>>> --with-precision=double
>>>>>>>>>> --with-scalar-type=complex --with-clanguage=cxx
>>>>>>>>>> --with-mpi-include="/cygdrive/d/Dev/HPC_2008_SDK/Include"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --with-mpi-lib=["/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpi.lib","/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib"] 
>>>>>>>>>>
>>>>>>>>>> --useThreads=0 --with-shared=0
>>>>>>>>>>
>>>>>>>>>> Note there is C++ as main language.
>>>>>>>>>>
>>>>>>>>>> Now, when I'm trying to build examples I always get similar
>>>>>>>>>> errors:
>>>>>>>>>>
>>>>>>>>>> Error    2     error LNK2019: unresolved external symbol ZGESVD
>>>>>>>>>> referenced
>>>>>>>>>> in
>>>>>>>>>> function "int __cdecl
>>>>>>>>>> KSPComputeExtremeSingularValues_GMRES(struct
>>>>>>>>>> _p_KSP
>>>>>>>>>> *,double *,double *)"
>>>>>>>>>> (?KSPComputeExtremeSingularValues_GMRES@@YAHPEAU_p_KSP@@PEAN1 at Z)
>>>>>>>>>> libpetsc.lib
>>>>>>>>>> Error    3     error LNK2019: unresolved external symbol ZGEEV
>>>>>>>>>> referenced
>>>>>>>>>> in
>>>>>>>>>> function "int __cdecl KSPComputeEigenvalues_GMRES(struct _p_KSP
>>>>>>>>>> *,int,double
>>>>>>>>>> *,double *,int *)"
>>>>>>>>>> (?KSPComputeEigenvalues_GMRES@@YAHPEAU_p_KSP@@HPEAN1PEAH at Z)
>>>>>>>>>> libpetsc.lib
>>>>>>>>>> Error    4     error LNK2001: unresolved external symbol ZGEEV
>>>>>>>>>> libpetsc.lib
>>>>>>>>>> Error    5     error LNK2019: unresolved external symbol DZNRM2
>>>>>>>>>> referenced
>>>>>>>>>> in
>>>>>>>>>> function "int __cdecl VecNorm_MPI(struct _p_Vec *,enum
>>>>>>>>>> NormType,double
>>>>>>>>>> *)"
>>>>>>>>>> (?VecNorm_MPI@@YAHPEAU_p_Vec@@W4NormType@@PEAN at Z)
>>>>>>>>>> libpetsc.lib
>>>>>>>>>> Error    6     error LNK2001: unresolved external symbol DZNRM2
>>>>>>>>>> libpetsc.lib
>>>>>>>>>> Error    7     error LNK2019: unresolved external symbol DZASUM
>>>>>>>>>> referenced
>>>>>>>>>> in
>>>>>>>>>> function "int __cdecl VecNorm_Seq(struct _p_Vec *,enum
>>>>>>>>>> NormType,double
>>>>>>>>>> *)"
>>>>>>>>>> (?VecNorm_Seq@@YAHPEAU_p_Vec@@W4NormType@@PEAN at Z)
>>>>>>>>>> libpetsc.lib
>>>>>>>>>> ...
>>>>>>>>>>
>>>>>>>>>> It look like calling conventions are in disagreement. Any ideas?
>>>>>>>>>> May
>>>>>>>>>> be I
>>>>>>>>>> should specify conventions myself in configuration line? If so,
>>>>>>>>>> how to
>>>>>>>>>> do
>>>>>>>>>> that?
>>>>>>>>>>
>>>
>



More information about the petsc-users mailing list