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

Edit cmake instruction to compile x64 #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Wylie-Modro
Copy link

The previous command:

cmake " -DBUILD_ONLY="core;gamelift;cognito-identity" -DCMAKE_BUILD_TYPE="release" 

Defaults to building x86 (32bit) dlls and libs. These then do not link with the more commonly used 64bit target platform for the GameLiftClient and rest of their Unreal game. The error that the Visual Studio will throw is "library machine type 'x86' conflicts with target machine type 'x64' ".

I have edited the command to build for x64 by default with brief instructions on how to compile for x86 if desired.

The previous command:
```
cmake " -DBUILD_ONLY="core;gamelift;cognito-identity" -DCMAKE_BUILD_TYPE="release" 
```
Defaults to building x86 (32bit) dlls and libs. These then do not link with the more commonly used 64bit target platform for the GameLiftClient and rest of their Unreal game. The error that the Visual Studio will throw is "library machine type 'x86' conflicts with target machine type 'x64' ".

I have edited the command to build for x64 by default with brief instructions on how to compile for x86 if desired.
@chris-gong
Copy link
Contributor

Hmmm interesting. This could have actually been the reason I've been experiencing issues lately. I will try this out later to see if that is the case.

@chris-gong
Copy link
Contributor

When I tried executing your command, I couldn't include the "Win64" as it was not allowing me to execute the cmake command. However, specifying the version of Visual Studio worked. I am still not sure if it made a difference, but I will find out soon.

@chris-gong
Copy link
Contributor

chris-gong commented Oct 17, 2019

Actually. because of specifying the Visual Studio version, the msbuild command was able to succeed with no errors. Before it would fail some tests but still generate the dll/lib files. I will try to include this in my pr. I think this will make a difference.

Although, I'm not sure why considering I only have one version of Visual Studio installed. Any ideas on why this modified command makes the msbuild succeed all the tests?

@Wylie-Modro
Copy link
Author

Ah yeah cmake can be a pain, I had to re-clone the repo in order to include the "Win64" and compile x64. Otherwise it assumes you wanted to compile x86 like you did previously and throws errors, quite annoying.

I'm not sure why the VS version would have that effect, I happen to have VS 2017 and VS 2015 installed and see this for the cmake generators (cmake -help):

Generators

The following generators are available on this platform (* marks default):
  Visual Studio 16 2019        = Generates Visual Studio 2019 project files.
                                 Use -A option to specify architecture.
* Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

Ended up using Visual Studio 15 2017 Win64 for the actual generation.

@chris-gong
Copy link
Contributor

Oh wow interesting, thank you for posting the generators. Seems that for Visual Studio 2019, you need the -A tag to specify the architecture. @Wylie-Modro do you have any experience running cmake with the unreal linux toolchain? The reason I ask is because I have been having trouble cross-compiling the sdk for linux on Unreal. I have also been trying to compile the sdk in client mode only so that when packaging the game, none of the client libraries have to be included with the server build, so maybe I will just keep going with that solution and forget trying to get this sdk to work with linux.

@Wylie-Modro
Copy link
Author

No problem.

I have experience working on linux cli setting up servers and network connections but unfortunately not much experience with cross-compiling. I was planning to start compiling it for linux servers after I set up some of the other infrastructure and resolve the other issues I have posted about here.
Have been looking into the client mode only build a bit too, related to the WITH_GAMELIFT and WITH_GAMELIFTCLIENTSDK macros but the both seem to be false if I am running it with the editor (or on the command line though the editor)

@chris-gong
Copy link
Contributor

chris-gong commented Oct 20, 2019

So after some further research it seems that the proper way to specify target architecture is to actually use aws custom cmake flags, which can be found here. This is currently the command I use,

cmake -G "<Visual Studio VV YYYY>" -DTARGET_ARCH="<WINDOWS-or-LINUX>" -DBUILD_ONLY="core;gamelift;cognito-identity" -DCMAKE_BUILD_TYPE="release" -DBUILD_SHARED_LIBS=1 "<path-to-aws-sdk-folder>" 

For cross compilation, however, I would remove the -G "<Visual Studio VV YYYY>" parameter and run the command from the ubuntu bash shell available for windows.

@Wylie-Modro
Copy link
Author

Ah ok. Nice find!

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

Successfully merging this pull request may close these issues.

2 participants