Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling under Windows with MinGW #11

Closed
nxrighthere opened this issue Apr 1, 2018 · 12 comments
Closed

Compiling under Windows with MinGW #11

nxrighthere opened this issue Apr 1, 2018 · 12 comments

Comments

@nxrighthere
Copy link
Contributor

nxrighthere commented Apr 1, 2018

Does someone have success? The compiler throws a lot of errors. I'm currently trying to fix them, but there are too many. The code itself in some places is questionable like here and here.

@tycho
Copy link
Contributor

tycho commented Apr 1, 2018

No, it doesn't build under MinGW/MSYS2 yet. I was working on this just before we pushed code publicly, but my changes aren't ready for consumption yet. I intend to work on it this week.

The majority of the issues are centered around macro misuse caused by bad assumptions, such as: _WIN32/WIN32 means we "must" be compiling on Visual Studio, and that __GNUC__ means we "must" be compiling on something non-Windows.

@nxrighthere
Copy link
Contributor Author

nxrighthere commented Apr 1, 2018

Yea, I see. I'm glad that you are working on it. Thank you for the quick response.

@AraHaan
Copy link

AraHaan commented Apr 1, 2018

well there are special macros for cygwin and mingw that also defines _WIN32 I thought. So maybe something like this would suffice
#if defined(_WIN32) && (defined(__GNUC__) /*|| optionally include clang windows build. */) && (__cygwin__ || __mingw__)

or something around those lines.

@tycho
Copy link
Contributor

tycho commented Apr 2, 2018

Probably fixed with 7db4632

But it also probably has bugs. Let me know if you find some!

@tycho tycho closed this as completed Apr 2, 2018
@nxrighthere
Copy link
Contributor Author

@tycho There is still no success:

GameNetworkingSockets\src\steamnetworkingsockets\certtool\steamnetworkingsockets_certtool.cpp: In function 'void PrintCertInfo(const CMsgSteamDatagramCertificateSigned&, std::__cxx11::string&, const char*)':
GameNetworkingSockets\src\steamnetworkingsockets\certtool\steamnetworkingsockets_certtool.cpp:204:45: error: expected ')' before 'PRIu64'
   V_sprintf_safe( szTemp, "%s\"key_id\": %" PRIu64 ",\n", pszJSONIndent, CalculatePublicKeyID( pubKey ) );
                                             ^~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\certtool\steamnetworkingsockets_certtool.cpp:215:48: error: expected ')' before 'PRIu64'
   V_sprintf_safe( szTemp, "%s\"ca_key_id\": %" PRIu64 "\n", pszJSONIndent, msgSigned.ca_key_id() );
                                                ^~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\certtool\steamnetworkingsockets_certtool.cpp:220:50: error: expected ')' before 'PRIu64'
   V_sprintf_safe( szTemp, "Public key ID. . : %" PRIu64 "\n", CalculatePublicKeyID( pubKey ) );
                                                  ^~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\certtool\steamnetworkingsockets_certtool.cpp:226:50: error: expected ')' before 'PRIu64'
   V_sprintf_safe( szTemp, "CA key ID. . . . : %" PRIu64 "\n", msgSigned.ca_key_id() );

Solved this with #define PRIu64 "I64u".

But the next one is more fun:

GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1318:53: error: function 'ISteamNetworkingSockets* SteamNetworkingSockets()' definition is marked dllimport
 STEAMDATAGRAMLIB_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets()
                                                     ^~~~~~~~~~~~~~~~~~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: In function 'ISteamNetworkingSockets* SteamNetworkingSockets()':
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1318:53: warning: 'ISteamNetworkingSockets* SteamNetworkingSockets()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: At global scope:
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1323:53: error: function 'ISteamNetworkingSockets* SteamNetworkingSocketsGameServer()' definition is marked dllimport
 STEAMDATAGRAMLIB_INTERFACE ISteamNetworkingSockets *SteamNetworkingSocketsGameServer()
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: In function 'ISteamNetworkingSockets* SteamNetworkingSocketsGameServer()':
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1323:53: warning: 'ISteamNetworkingSockets* SteamNetworkingSocketsGameServer()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: At global scope:
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1330:33: error: function 'bool GameNetworkingSockets_Init(char (&)[1024])' definition is marked dllimport
 STEAMDATAGRAMLIB_INTERFACE bool GameNetworkingSockets_Init( SteamDatagramErrMsg &errMsg )
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: In function 'bool GameNetworkingSockets_Init(char (&)[1024])':
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1330:33: warning: 'bool GameNetworkingSockets_Init(char (&)[1024])' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: At global scope:
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1342:33: error: function 'void GameNetworkingSockets_Kill()' definition is marked dllimport
 STEAMDATAGRAMLIB_INTERFACE void GameNetworkingSockets_Kill()
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp: In function 'void GameNetworkingSockets_Kill()':
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\csteamnetworkingsockets.cpp:1342:33: warning: 'void GameNetworkingSockets_Kill()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]

@tycho
Copy link
Contributor

tycho commented Apr 2, 2018

How are you building? Are you using MSYS2 or some other version of MinGW?

http://www.msys2.org/

@nxrighthere
Copy link
Contributor Author

nxrighthere commented Apr 2, 2018

Solved this one with #define STEAMDATAGRAMLIB_FOREXPORT.

Moving forward:

GameNetworkingSockets\src\steamnetworkingsockets\clientlib\steamnetworkingsockets_lowlevel.cpp:1685:33: error: function 'void SteamDatagram_SetDebugOutputFunction(int, FSteamDatagramDebugOutput)' definition is marked dllimport
 STEAMDATAGRAMLIB_INTERFACE void SteamDatagram_SetDebugOutputFunction( /* ESteamDatagramSpewType */ int eDetailLevel, FSteamDatagramDebugOutput pfnFunc )
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\steamnetworkingsockets_lowlevel.cpp: In function 'void SteamDatagram_SetDebugOutputFunction(int, FSteamDatagramDebugOutput)':
GameNetworkingSockets\src\steamnetworkingsockets\clientlib\steamnetworkingsockets_lowlevel.cpp:1685:33: warning: 'void SteamDatagram_SetDebugOutputFunction(int, FSteamDatagramDebugOutput)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]

@nxrighthere
Copy link
Contributor Author

nxrighthere commented Apr 2, 2018

@tycho I building it with Mingw-w64.

@tycho
Copy link
Contributor

tycho commented Apr 2, 2018

Try using MSYS2 instead.

Also STEAMDATAGRAMLIB_FOREXPORT is already defined in meson.build -- how are you building?

@nxrighthere
Copy link
Contributor Author

I just created CMakeLists since I'm not using Meson. Well, I'll try to build it with MSYS2 if I don't solve all these errors myself.

@tycho
Copy link
Contributor

tycho commented Apr 2, 2018

Or take a look at the meson.build changes and copy them over to your CMakeLists.txt

@nxrighthere
Copy link
Contributor Author

Yea, I missed some stuff there actually... Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants