Problem with Petsc Complex Configuration for Windows - c++

I m trying to build Petsc Complex Version on windows.(VS2019 and c++17)
the configuration is as bellow :
./configure --with-cc="win32fe cl" --with-cxx="win32fe cl" --with-fc=0 --download-f2cblaslapack --with-memalign=64 --with-mpi-include=/cygdrive/c/software/Mpich2/Include --with-mpi-lib=/cygdrive/c/software/Mpich2/lib/mpi.lib --with-mpi-mpiexec=/cygdrive/c/software/Mpich2/bin/mpiexec.exe CFLAGS="-MD -wd4996" CXXFLAGS="-MD -wd4996" COPTFLAGS="-O2" CXXOPTFLAGS="-O2" --with-debugging=0 --with-scalar-type=complex --with-clanguage=cxx
when I try to make the configuration an error appear :
CXX arch-mswin-cxx-opt/obj/vec/is/sf/impls/basic/sfpack.o
sfpack.c
C:\software\PETSC-~1.4\src\vec\is\sf\impls\basic\sfpack.c(977): error C2664: 'int MPI_Reduce_local(void *,void *,int,MPI_Datatype,MPI_Op)': cannot convert argument 1 from 'const char *' to 'void *'
C:\software\PETSC-~1.4\src\vec\is\sf\impls\basic\sfpack.c(977): note: Conversion loses qualifiers
C:\software\Mpich2\Include\mpi.h(887): note: see declaration of 'MPI_Reduce_local'
C:\software\PETSC-~1.4\src\vec\is\sf\impls\basic\sfpack.c(980): error C2664: 'int MPI_Reduce_local(void *,void *,int,MPI_Datatype,MPI_Op)': cannot convert argument 1 from 'const void *' to 'void *'
C:\software\PETSC-~1.4\src\vec\is\sf\impls\basic\sfpack.c(980): note: Conversion loses qualifiers
C:\software\Mpich2\Include\mpi.h(887): note: see declaration of 'MPI_Reduce_local'
C:\software\PETSC-~1.4\src\vec\is\sf\impls\basic\sfpack.c(1001): error C2664: 'int MPI_Reduce_local(void *,void *,int,MPI_Datatype,MPI_Op)': cannot convert argument 1 from 'const char *' to 'void *'
C:\software\PETSC-~1.4\src\vec\is\sf\impls\basic\sfpack.c(1001): note: Conversion loses qualifiers
C:\software\Mpich2\Include\mpi.h(887): note: see declaration of 'MPI_Reduce_local'
make[3]: *** [gmakefile:184: arch-mswin-cxx-opt/obj/vec/is/sf/impls/basic/sfpack.o] Error 2
make[2]: *** [/cygdrive/c/software/petsc-3.13.4/lib/petsc/conf/rules:50: libs] Error 2
**************************ERROR*************************************
Error during compile, check arch-mswin-cxx-opt/lib/petsc/conf/make.log
Send it and arch-mswin-cxx-opt/lib/petsc/conf/configure.log to petsc-maint#mcs.anl.gov
********************************************************************
For the Real Version there is no issue !!! please Any help

Related

opencv - cmake mingw32-make error [duplicate]

opencv installation using mingw32-make command in windows 10 platform, then likely end up in getting the below error.
Windows version : 10
OpenCv:3.2.0
Please suggest me in installing.
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In constructor 'testing::internal::Mutex::Mutex()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8829:45: error: cannot convert 'CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to '_RTL_CRITICAL_SECTION*' in initialization
critical_section_(new CRITICAL_SECTION) {
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8830:48: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In destructor 'testing::internal::Mutex::~Mutex()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8840:46: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'PCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void DeleteCriticalSection(PCRITICAL_SECTION)'
::DeleteCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Lock()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8848:43: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void EnterCriticalSection(LPCRITICAL_SECTION)'
::EnterCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Unlock()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8858:43: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void LeaveCriticalSection(LPCRITICAL_SECTION)'
::LeaveCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::ThreadSafeLazyInit()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8879:27: error: cannot convert 'CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to '_RTL_CRITICAL_SECTION*' in assignment
critical_section_ = new CRITICAL_SECTION;
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8880:54: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section_);
^
modules\ts\CMakeFiles\opencv_ts.dir\build.make:237: recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj' failed
mingw32-make[2]: *** [modules/ts/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj] Error 1
CMakeFiles\Makefile2:5379: recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/all' failed
mingw32-make[1]: *** [modules/ts/CMakeFiles/opencv_ts.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I also faced the same problem while trying to build OpenCV 3.2.0 using mingw32 on Windows10. I searched a bit to find a fix on Github for similar problem. It said the problem was:
MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two separate (equivalent) structs, instead of using typedef
So, you have to add another typedef GTEST_CRITICAL_SECTION for _CRITICAL_SECTION and _RTL_CRITICAL_SECTION and use this typedef for either case.
Here is what to do :
Edit "ts_gtest.h" which is inside "opencv\sources\modules\ts\include\opencv2\ts\"
Replace this line (probably line 723)
// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
struct _RTL_CRITICAL_SECTION;
with
#if GTEST_OS_WINDOWS_MINGW
// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
// separate (equivalent) structs, instead of using typedef
typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#else
// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION
typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#endif
Replace this line (probably on line 3060 before your edit - line number would have changed as you modified first part)
_RTL_CRITICAL_SECTION* critical_section_;
with
GTEST_CRITICAL_SECTION* critical_section_;
These two changes should fix your above error.
It was fixed by using TDM-gcc mingw compiler.

error C2664: 'pthread_create' : cannot convert parameter 3 from 'void *(__clrcall *)(void *)' to 'void *(__cdecl *)(void *)

I am trying to use a pthread library.
What is the cause of this error?
error C2664: 'pthread_create' : cannot convert parameter 3 from 'void *(__clrcall *)(void *)' to 'void *(__cdecl *)(void *)
Here's my code:
pthread_create(&thread1,NULL,sub_m,(void *)data);
void *sub_m(void* data)
make it void __cdecl sub_m(void *data). You are in managed code, so you need to get back into the proper calling convention.

Compiling SQLite with Visual Studio C++ 2013 Throws error for .c file

I have added sqlite3.c file into my project.
And #include. Here is the code:
#include <sqlite3.h>
using namespace std;
int main()
{
return 0;
}
I compile the program and it throws the following error:
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(15705): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(19741): error C2440: '=' : cannot convert from 'void *' to 'sqlite3_mutex *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(20665): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(20677): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(21142): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(21256): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(21411): error C2440: '=' : cannot convert from 'void *' to 'char *'
But there is no error that a header or file is not found. Everything is found and the errors are just outputted above
I have found the solution. I compiled the C code as C++, but changing it was not enough.
I write it for future visitors:
First, I had to change file's (ONLY FILE) property. Right-click on the file and select properties, under the C/C++, select Advanced and then select Compile As and set it to C (neither default nor C++).
Then, you should make sure that your .c file is compiled without clr. Well, to do that, under the same C/C++ set of menu, select "Common Langugae Runtime Support" and set it to No Support....
I'm using Visual Studio 17 and I would add to this, find the settings for "Precompiled Header" and set that to "Not Using Precompiled Headers".

Initializing auto variables in VC++ 2012

I am new to VC++ 2012. I have this code snippet.
auto it = query_map.find(U("callback"));
The problem is right under the dot there is a red line the error is
Error 1 error C2664: 'std::_Tree_iterator std::_Tree::find(const http::uri::encoded_string &)' : cannot convert parameter 1 from 'const wchar_t [9]' to 'const http::uri::encoded_string &' d:\maverick\projects\strikeforce\src\server\server\server.cpp 26
Can someone tell me a solution to this error?
Error 1 error C2664: 'std::_Tree_iterator std::_Tree::find(const http::uri::encoded_string &)'
This is a problem with the method find() from the class std::Tree
cannot convert parameter 1 from 'const wchar_t [9]' to 'const http::uri::encoded_string &'
The find() method must be used with a paremeter of type 'const http::uri::encoded_string &', but you passed a 'const wchar_t [9]'.
the method U() you have used returns an array of chars, but the find() method need another type of object.

Make Error Compiling Armadillo 4.300.8

I am trying to compile the newest version of the Armadillo Linear Algebra library (4.300.8) and am running into the following errors when running make after cmake . runs successfully.
Scanning dependencies of target armadillo
[100%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper.cpp.o
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘hid_t arma::arma_H5Dopen(hid_t, const char*, hid_t)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:890:43: error: too many arguments to function ‘hid_t H5Dopen1(hid_t, const char*)’
/usr/include/H5Dpublic.h:145:14: note: declared here
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘hid_t arma::arma_H5Dcreate(hid_t, const char*, hid_t, hid_t, hid_t, hid_t, hid_t)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:900:83: error: too many arguments to function ‘hid_t H5Dcreate1(hid_t, const char*, hid_t, hid_t, hid_t)’
/usr/include/H5Dpublic.h:143:14: note: declared here
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘herr_t arma::arma_H5Eset_auto(hid_t, H5E_auto1_t, void*)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:950:54: error: invalid conversion from ‘hid_t {aka int}’ to ‘H5E_auto1_t {aka int (*)(void*)}’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:950:54: error: invalid conversion from ‘H5E_auto1_t {aka int (*)(void*)}’ to ‘void*’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:950:54: error: too many arguments to function ‘herr_t H5Eset_auto1(H5E_auto1_t, void*)’
/usr/include/H5Epublic.h:216:15: note: declared here
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘herr_t arma::arma_H5Eget_auto(hid_t, herr_t (**)(void*), void**)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:955:54: error: invalid conversion from ‘hid_t {aka int}’ to ‘herr_t (**)(void*) {aka int (**)(void*)}’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:955:54: error: invalid conversion from ‘herr_t (**)(void*) {aka int (**)(void*)}’ to ‘void**’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:955:54: error: too many arguments to function ‘herr_t H5Eget_auto1(herr_t (**)(void*), void**)’
/usr/include/H5Epublic.h:212:15: note: declared here
make[2]: *** [CMakeFiles/armadillo.dir/src/wrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
I am using gcc version 4.7.3 and running Ubuntu 12.04.
Thanks!
It looks like the HDF5 library is causing problems. Uninstall the HDF5 library, and then reinstall Armadillo.
Another option is to update your system to Ubuntu 14.04. The previous Ubuntu LTS release (12.04) is ancient by open-source standards.