Git Product home page Git Product logo

Comments (4)

mmasenlle avatar mmasenlle commented on June 12, 2024 1

For the stdext problem with MinGW-W64 this change in Array.h allows compilation
-#ifdef _WIN32
+#ifdef _MSC_VER
Array.txt

from aws-sdk-cpp.

DannyMoss avatar DannyMoss commented on June 12, 2024 1

To anyone interested in compiling with MinGW-W64: (7.2.0_seh):

  1. in "Environment.cpp" don't use std::getenv (deprecated) - rather use instead GetEnvironmentVariable If you still like to use std::getenv handle returned null pointer, ie:
Aws::String result;
       char* value = std::getenv(variableName);
       if(value!=NULL) result = value;
  1. you can use Curl 7.57.0-win64 (ie. this prebuild package)
  2. use rather openssl 1.1.0 not 1.0.2 (Curl package don't have all required dll's) ie: this prebuild package

from aws-sdk-cpp.

TomWerner avatar TomWerner commented on June 12, 2024

I'm also seeing the same error. I added add_definitions(-std=c++11) to my CMakeLists.txt, and ran
aws-sdk-cpp>cmake . -G "MinGW Makefiles" -DBUILD_ONLY="aws-cpp-sdk-s3"
Following that I did
aws-sdk-cpp>mingw32-make install
and got

aws-sdk-cpp\aws-cpp-sdk-core\source\external\tinyxml2\tinyxml2.cpp:1639:15: error: definition of static data member 'Aws::External::tinyxml2::XMLDocument::_errorNames' of dllimport'd class
   const char* XMLDocument::_errorNames[XML_ERROR_COUNT] = {
               ^
aws-cpp-sdk-core\CMakeFiles\aws-cpp-sdk-core.dir\build.make:187: recipe for target 'aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/tinyxml2/tinyxml2.cpp.obj' failed
mingw32-make[2]: *** [aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/tinyxml2/tinyxml2.cpp.obj] Error 1
CMakeFiles\Makefile2:84: recipe for target 'aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/all' failed
mingw32-make[1]: *** [aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

I am using gcc (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 5.2.0 on Windows 10, 64 bit.
I am able to successfully compile the sdk using visual studio 2015 but ran into issues with stdext when trying to integrate with mingw compiled code

from aws-sdk-cpp.

mmasenlle avatar mmasenlle commented on June 12, 2024

More things that I did to compile with MinGW-W64:

  1. Force libcurl
  2. When compiling aws-cpp-sdk-core
    2.1. Don't use -Werror and add flag -Wa,-mbig-obj in CXX_FLAGS.
    2.2. This changes:
diff --git a/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp b/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp
index c6864c7..111d08a 100644
--- a/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp
+++ b/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp
@@ -18,6 +18,9 @@
 #if ENABLE_CURL_CLIENT
 #include <aws/core/http/curl/CurlHttpClient.h>
 #include <signal.h>
+#ifndef SIGPIPE
+#define SIGPIPE 13
+#endif

 #elif ENABLE_WINDOWS_CLIENT
 #include <aws/core/client/ClientConfiguration.h>
diff --git a/aws-cpp-sdk-core/source/platform/windows/Environment.cpp b/aws-cpp-sdk-core/source/platform/windows/Environment.cpp
index fd8d58f..e690def 100644
--- a/aws-cpp-sdk-core/source/platform/windows/Environment.cpp
+++ b/aws-cpp-sdk-core/source/platform/windows/Environment.cpp
@@ -29,6 +29,7 @@ that would need to be manually freed in all the client functions, just copy it i
 */
 Aws::String GetEnv(const char *variableName)
 {
+#ifdef _MSC_VER
     char* variableValue = nullptr;
     std::size_t valueSize = 0;
     auto queryResult = _dupenv_s(&variableValue, &valueSize, variableName);
@@ -39,7 +40,9 @@ Aws::String GetEnv(const char *variableName)
         result.assign(variableValue, valueSize - 1);  // don't copy the c-string terminator byte
         free(variableValue);
     }
-
+#else
+       Aws::String result = std::getenv(variableName);
+#endif
     return result;
 }

diff --git a/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp b/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
index c4a4850..6b15e1f 100644
--- a/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
+++ b/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
@@ -279,6 +279,8 @@ Aws::String CreateTempFilePath()
 {
 #ifdef _MSC_VER
 #pragma warning(disable: 4996) // _CRT_SECURE_NO_WARNINGS
+#else
+       #define L_tmpnam_s 4095 // FIXME: Put the correct value
 #endif
     char s_tempName[L_tmpnam_s+1];
  1. When compiling other modules add -O1 and -Wa,-mbig-obj to CXX_FLAGS to avoid overflows generation obj files.

from aws-sdk-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.