sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Error when building from source using mingw on windows 10

Open sbordeyne opened this issue 6 years ago • 1 comments

Full traceback :

mingw32-make -f Makefile.win32
g++ -DUNICODE -DUSE_SQLITE -DUSE_CRYPTOPP -DUSE_FREEIMAGE -DENABLE_SYNC=1 -D_WIN32=1 -g -Wall -I. -Iinclude -Iinclude/mega -Iinclude/mega/win32 -isystem ../zlib -isystem ../cryptopp -isystem ../sodium/src/libsodium/include -isystem ../db/build_windows -Idb  -isystem .. -isystem ../sqlite3 -isystem ../FreeImage/Dist   -c -o src/attrmap.o src/attrmap.cpp
In file included from include/mega/win32/megasys.h:83:0,
                 from include/mega/types.h:43,
                 from include/mega/utils.h:25,
                 from include/mega/attrmap.h:25,
                 from src/attrmap.cpp:22:
../winhttp.h:306:5: error: definition of 'BOOL WinHttpTimeToSystemTime' is marked 'dllimport'
     __in_z LPCWSTR pwszTime,        // NULL terminated string
     ^~~~~~
../winhttp.h:306:5: error: '__in_z' was not declared in this scope
../winhttp.h:307:22: error: expected primary-expression before '*' token
     __out SYSTEMTIME *pst           // output in GMT time
                      ^
../winhttp.h:307:23: error: 'pst' was not declared in this scope
     __out SYSTEMTIME *pst           // output in GMT time
                       ^~~
../winhttp.h:308:1: error: expression list treated as compound expression in initializer [-fpermissive]
 );
 ^
../winhttp.h:363:5: error: definition of 'void* WinHttpOpen' is marked 'dllimport'
     __in_z_opt LPCWSTR pszAgentW,
     ^~~~~~~~~~
../winhttp.h:363:5: error: '__in_z_opt' was not declared in this scope
../winhttp.h:364:16: error: expected primary-expression before 'dwAccessType'
     __in DWORD dwAccessType,
                ^~~~~~~~~~~~
../winhttp.h:365:5: error: '__in_z_opt' was not declared in this scope
     __in_z_opt LPCWSTR pszProxyW,
     ^~~~~~~~~~
../winhttp.h:366:5: error: '__in_z_opt' was not declared in this scope
     __in_z_opt LPCWSTR pszProxyBypassW,
     ^~~~~~~~~~
../winhttp.h:367:16: error: expected primary-expression before 'dwFlags'
     __in DWORD dwFlags
                ^~~~~~~
../winhttp.h:368:1: error: expression list treated as compound expression in initializer [-fpermissive]
 );
 ^
../winhttp.h:402:70: error: '__out_data_source' has not been declared
     __out_bcount_part(dwNumberOfBytesToRead, *lpdwNumberOfBytesRead) __out_data_source(NETWORK) LPVOID lpBuffer,
                                                                      ^~~~~~~~~~~~~~~~~
../winhttp.h:402:97: error: expected ',' or '...' before 'LPVOID'
     __out_bcount_part(dwNumberOfBytesToRead, *lpdwNumberOfBytesRead) __out_data_source(NETWORK) LPVOID lpBuffer,
                                                                                                 ^~~~~~
../winhttp.h:421:5: error: '__out_data_source' has not been declared
     __out_data_source(NETWORK) LPDWORD lpdwNumberOfBytesAvailable
     ^~~~~~~~~~~~~~~~~
../winhttp.h:421:32: error: expected ',' or '...' before 'LPDWORD'
     __out_data_source(NETWORK) LPDWORD lpdwNumberOfBytesAvailable
                                ^~~~~~~
../winhttp.h:425:10: error: expected constructor, destructor, or type conversion before '(' token
 __success(return != FALSE)
          ^
../winhttp.h:442:5: error: '__in_awcount' has not been declared
     __in_awcount((dwOption != WINHTTP_OPTION_USERNAME &&
     ^~~~~~~~~~~~
../winhttp.h:442:28: error: expected ')' before '!=' token
     __in_awcount((dwOption != WINHTTP_OPTION_USERNAME &&
                            ^~
../winhttp.h:442:28: error: expected ')' before '!=' token
../winhttp.h:442:28: error: expected ')' before '!=' token
../winhttp.h:442:28: error: expected initializer before '!=' token
../winhttp.h:468:5: error: '__in_z' has not been declared
     __in_z PCWSTR pwszHost,
     ^~~~~~
../winhttp.h:468:19: error: expected ',' or '...' before 'pwszHost'
     __in_z PCWSTR pwszHost,
                   ^~~~~~~~
In file included from include/mega/win32/megasys.h:83:0,
                 from include/mega/types.h:43,
                 from include/mega/utils.h:25,
                 from include/mega/attrmap.h:25,
                 from src/attrmap.cpp:22:
../winhttp.h:1094:10: error: expected constructor, destructor, or type conversion before '(' token
 __success(return != FALSE)
          ^
In file included from ../cryptopp/secblock.h:11:0,
                 from ../cryptopp/modes.h:10,
                 from include/mega/crypto/cryptopp.h:27,
                 from include/mega/types.h:55,
                 from include/mega/utils.h:25,
                 from include/mega/attrmap.h:25,
                 from src/attrmap.cpp:22:
../cryptopp/misc.h: In member function 'const T& CryptoPP::Singleton<T, F, instance>::Ref() const':
../cryptopp/misc.h:287:14: error: 'mutex' in namespace 'std' does not name a type
  static std::mutex s_mutex;
              ^~~~~
../cryptopp/misc.h:296:18: error: 'mutex' is not a member of 'std'
  std::lock_guard<std::mutex> lock(s_mutex);
                  ^~~
../cryptopp/misc.h:296:18: error: 'mutex' is not a member of 'std'
../cryptopp/misc.h:296:28: error: template argument 1 is invalid
  std::lock_guard<std::mutex> lock(s_mutex);
                            ^
../cryptopp/misc.h:296:35: error: 's_mutex' was not declared in this scope
  std::lock_guard<std::mutex> lock(s_mutex);
                                   ^~~~~~~
<builtin>: recipe for target 'src/attrmap.o' failed
mingw32-make: *** [src/attrmap.o] Error 1

OS Specs : Windows 10 professional, Version 1709 / Build 16299.192 (latest update) I downloaded the latest versions of the dependencies, (sqlite3, zlib, sodium, FreeImage and cryptopp), installed the Windows 10 SDK, and copied the winhttp.lib and winhttp.h files to the project directory, and the winhttp.dll file from the system. I used x86 versions of the libraries, I figured it helped with compatibility (and I do not intend to use more than 4 gigs of ram in my code).

I want to build the library with python bindings (python 3.6.2 x86). Below is my directory structure :

root/
    cryptopp/
    FreeImage/
    megasdk/
         bindings/
         contrib/
         doc/
         examples/
         include/
         m4/
         src/
         tests/
         third_party/
         Makefile.win32
    sqlite3/ (renamed to fit the path in Makefile.win32)
    swigwin-3.0.12/
    zlib (renamed the folder as well)
    sqlite3.def
    sqlite3.dll
    winhttp.dll
    winhttp.h
    winhttp.lib

I don't understand why mingw32-make -f Makefile.win32 won't build the library. I ran the command inside the megadk folder.

Please help me.

sbordeyne avatar Jan 26 '18 01:01 sbordeyne

Try This #1157

fubuki-is-cat avatar Aug 24 '18 02:08 fubuki-is-cat