[Trilinos-Users] Problem configuring C++ 11 on Visual Studio 12 (2013) and some mingw fixes in a patch

JR Cary cary at colorado.edu
Sun May 10 10:50:38 EDT 2015


Thanks.  That helps.

Now I am up to:

C:\winsame\cary\vorpalall-vs12\builds\trilinos-12.0.1\packages\kokkos\core\src\impl\Kokkos_AllocationTracker.cpp(126) 
: error C3861: 'atomic_fetch_sub': identifier not found

Is Kokkos unix-centric?  Did I invoke its build somehow incorrectly?

BTW, attached is a patch we used to get trilinos to build
with mingw at one point.  I have not tried a mingw build in a while,
however.

...John


On 5/9/15 6:25 PM, Bartlett, Roscoe A. wrote:
> Try adding
>
>   -DTrilinos_CXX11_FLAGS=" "
>
> (note the single space).
>
> We will add " " as one of the set of flags to try.
>
> -Ross
>
>
> ------------------------------------------------------------------------
> *From:* Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf 
> of JR Cary <cary at colorado.edu>
> *Sent:* Saturday, May 09, 2015 8:56:03 AM
> *To:* trilinos-users at trilinos.org
> *Subject:* [Trilinos-Users] Problem configuring C++ 11 on Visual 
> Studio 12 (2013)
> cmake fails at
>
> CMake Error at 
> cmake/tribits/core/package_arch/TribitsCXX11Support.cmake:148 (MESSAGE):^M
>   Error, a set of standard compiler flags cannot be found such that 
> this C++^M
>   compiler is able to compile basic C++11 features! Please select a C++^M
>   compiler (and compatible compilers for other languages) that supports^M
>   C++11.  Or, if this C++ compiler does support C++11 but a special 
> set of^M
>   compiler options is needed, then set these flags using^M
>   -DTrilinos_CXX11_FLAGS="<c++11-flags>".  Or, if C++11 support in this^M
>   project is not needed or desired, then set 
> -DTrilinos_ENABLE_CXX11=OFF.^M
> Call Stack (most recent call first):^
>
> But afaik, VS-12 needs no special flags.  So the logic in
> TribitsCXX11Support.cmake of
>
>       IF ("${${PROJECT_NAME}_CXX11_FLAGS}" STREQUAL "")
>       MESSAGE(FATAL_ERROR
>
> will fail, as that variable should be empty for VS12.
>
> Thoughts?
>
> Thanks....John
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20150510/1eabbeb0/attachment.html>
-------------- next part --------------
diff -ruN trilinos-12.0.1/cmake/tribits/core/package_arch/TribitsCXX11Support.cmake trilinos-12.0.1-new/cmake/tribits/core/package_arch/TribitsCXX11Support.cmake
--- trilinos-12.0.1/cmake/tribits/core/package_arch/TribitsCXX11Support.cmake	2015-04-16 10:29:01.000000000 -0600
+++ trilinos-12.0.1-new/cmake/tribits/core/package_arch/TribitsCXX11Support.cmake	2015-05-10 07:30:10.319452800 -0600
@@ -72,6 +72,7 @@
        "-std=c++0x"    # Older gcc
        "-std=gnu++11"  # gcc
        "/Qstd=c++11"   # intel windows
+       " "             # vs12
        )
 
      ##
diff -ruN trilinos-12.0.1/packages/ifpack/src/supportgraph/Ifpack_SupportGraph.h trilinos-12.0.1-new/packages/ifpack/src/supportgraph/Ifpack_SupportGraph.h
--- trilinos-12.0.1/packages/ifpack/src/supportgraph/Ifpack_SupportGraph.h	2015-04-16 10:29:05.000000000 -0600
+++ trilinos-12.0.1-new/packages/ifpack/src/supportgraph/Ifpack_SupportGraph.h	2015-05-10 07:29:09.635346200 -0600
@@ -465,7 +465,12 @@
               if (Randomize_)
               {
                 // Add small random pertubation. 
+#ifdef _WIN32
+// See http://stackoverflow.com/questions/11065861/drand48-on-windows
+                weights[k] *= (1.0 + 1e-8 * (double)rand()/RAND_MAX);
+#else
                 weights[k] *= (1.0 + 1e-8 * drand48());
+#endif
               }
 
 	      k++;
diff -ruN trilinos-12.0.1/packages/ml/src/MLAPI/MLAPI_Workspace.cpp trilinos-12.0.1-new/packages/ml/src/MLAPI/MLAPI_Workspace.cpp
--- trilinos-12.0.1/packages/ml/src/MLAPI/MLAPI_Workspace.cpp	2015-04-16 10:29:06.000000000 -0600
+++ trilinos-12.0.1-new/packages/ml/src/MLAPI/MLAPI_Workspace.cpp	2015-05-10 07:29:09.635346200 -0600
@@ -15,6 +15,8 @@
 #include "MLAPI_Workspace.h"
 #ifdef _MSC_VER
 #include "winprocess.h"
+#elif defined(__MINGW32__)
+#include "windows.h"
 #endif
 
 namespace MLAPI {
diff -ruN trilinos-12.0.1/packages/ml/src/Utils/ml_epetra_utils.cpp trilinos-12.0.1-new/packages/ml/src/Utils/ml_epetra_utils.cpp
--- trilinos-12.0.1/packages/ml/src/Utils/ml_epetra_utils.cpp	2015-04-16 10:29:06.000000000 -0600
+++ trilinos-12.0.1-new/packages/ml/src/Utils/ml_epetra_utils.cpp	2015-05-10 07:29:09.650946300 -0600
@@ -42,6 +42,8 @@
 #endif
 #ifdef _MSC_VER
 # include "winprocess.h"
+#elif defined(__MINGW32__)
+# include "windows.h"
 #endif
 
 #ifdef HAVE_ML_TEUCHOS
diff -ruN trilinos-12.0.1/packages/ml/src/Utils/ml_utils.c trilinos-12.0.1-new/packages/ml/src/Utils/ml_utils.c
--- trilinos-12.0.1/packages/ml/src/Utils/ml_utils.c	2015-04-16 10:29:06.000000000 -0600
+++ trilinos-12.0.1-new/packages/ml/src/Utils/ml_utils.c	2015-05-10 07:29:09.650946300 -0600
@@ -1957,13 +1957,15 @@
       if (i == mypid) {
 #if defined(TFLOP) || defined(JANUS_STLPORT) || defined(COUGAR)
         sprintf(buf, "Host: %s   PID: %d", "janus", getpid());
+#elif defined(__MINGW32__)
+        sprintf(buf, "Host: %s   PID: %d", "mingw", getpid());
 #else
         gethostname(hostname, sizeof(hostname));
         sprintf(buf, "Host: %s   PID: %d (mpi task %d)", hostname, getpid(),mypid);
 #endif
         printf("%s\n",buf);
         fflush(stdout);
-#ifdef ICL
+#if defined(ICL) || defined(__MINGW32__)
         Sleep(1);
 #else
         sleep(1);
diff -ruN trilinos-12.0.1/packages/teuchos/numerics/src/Teuchos_BLAS.cpp trilinos-12.0.1-new/packages/teuchos/numerics/src/Teuchos_BLAS.cpp
--- trilinos-12.0.1/packages/teuchos/numerics/src/Teuchos_BLAS.cpp	2015-04-16 10:29:15.000000000 -0600
+++ trilinos-12.0.1-new/packages/teuchos/numerics/src/Teuchos_BLAS.cpp	2015-05-10 07:29:09.697746300 -0600
@@ -111,7 +111,8 @@
 
 //Explicitly instantiating these templates for windows due to an issue with
 //resolving them when linking dlls.
-#ifdef _WIN32
+// #ifdef _WIN32
+#ifdef _MSC_VER
 #  ifdef HAVE_TEUCHOS_COMPLEX
      template BLAS<long int, std::complex<float> >;
      template BLAS<long int, std::complex<double> >;


More information about the Trilinos-Users mailing list