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

Better build instructions on all platforms #398

Closed
justinfarrelldev opened this issue Feb 12, 2023 · 12 comments
Closed

Better build instructions on all platforms #398

justinfarrelldev opened this issue Feb 12, 2023 · 12 comments

Comments

@justinfarrelldev
Copy link

Checking out both #379 and #348, as well as my own issue #384, it seems apparent that very few people can actually build this repo. The makefile goes a long way as well as the Autogen and Configure files, but overall the documentation on how to build the games is sparse and ancient. This is leading to a lot of people being unable to contribute to the development of the Apolyton Edition who would otherwise be happy to - myself and several of the people on the Discord server have no idea how to build this edition, and there isn't even any releases to download. Can we please get revised instructions on how to build the Apolyton Edition of the game for multiple platforms (Windows and Linux at least) that are specific, clear and easy to follow? Specifically, I think the instructions should mention:

  • the specific compiler which was used to build the game
  • the specific OS used for the instructions
  • how to generate the required .deb files
  • the specific IDE and version used (if relevant)

Basically, just a from-scratch list of instructions that list everything done to get the Apolyton Edition working to a point where one can start contributing.

Thank you.

@myocytebd
Copy link

I think it should be not be a big problem to build the repo on linux.

  • The only building system problem that I ran into (and rather obvious) is that compiling & .cdb generator does not sync.
    So it is often necessary to build twice if .cdb is modified - 1st pass fails due to stale .cdb gen; 2nd pass succeeds because .cdb generator does not regen and thus free of race condition.
  • The source code quality is another story, and may leads to other building problems.

This is the flags I used to compile the repo on my local machine: Ubuntu 20.04 / gcc 9.4
Please notes:

  • Most ccflags are to suppress less significant and noisy warnings.
  • Some ccflags are necessary because of my local changes.
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

if [[ "$1" == "--d" ]] || [[ "$1" == "--debug" ]]; then
    export CFLAGS="$CFLAGS -Og"
    export CXXFLAGS="$CXXFLAGS -Og"
else
    export CFLAGS="$CFLAGS -O2"
    export CXXFLAGS="$CXXFLAGS -O2"
fi

export CFLAGS="$CFLAGS -g -fuse-ld=gold -Wno-unused-function"
export CXXFLAGS="$CXXFLAGS -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fuse-ld=gold -std=gnu++17" # -fno-exceptions # FIXME: enable -fno-exceptions

# Fatal
# gcc 9.4 may generate broken code if return statement is missing.
export CXXFLAGS="$CXXFLAGS -Werror=return-type"

# Pointless / Too noisy
export CXXFLAGS="$CXXFLAGS -Wno-maybe-uninitialized"
# Probably safe
export CXXFLAGS="$CXXFLAGS -Wno-write-strings -Wno-reorder -Wno-unused-function -Wno-endif-labels -Wno-multichar -Wno-char-subscripts -Wno-conversion-null -Wno-register"
# Probably safe, but may miss true errors
export CXXFLAGS="$CXXFLAGS -Wno-unused-but-set-variable -Wno-unused-value -Wno-switch -Wno-misleading-indentation -Wno-parentheses -Wno-vla -Wno-unknown-pragmas"
# Unsafe, but probably insignificant
export CXXFLAGS="$CXXFLAGS -Wno-format -Wno-format-overflow"
export CXXFLAGS="$CXXFLAGS -Wno-strict-aliasing"
# Unsafe
export CXXFLAGS="$CXXFLAGS -Wno-class-memaccess -Wno-sign-compare"
# Error
export CXXFLAGS="$CXXFLAGS -fpermissive -Wno-address-of-packed-member -Wno-deprecated-declarations"
# Critical Error
export CXXFLAGS="$CXXFLAGS -Wno-restrict"

export LIBS="-lunwind"
$SCRIPT_DIR/configure --enable-silent-rules

@myocytebd
Copy link

I feel that this repo is dead.
If you could find a group of people contributing to it, IMHO you had better fork it.
esp. because GitHub PR workflow is horrible that it can easily cost more effort to submit patches than writing patches.
Contributing non-trivial patches could be nightmare for non-commiters.

@justinfarrelldev
Copy link
Author

I feel that this repo is dead. If you could find a group of people contributing to it, IMHO you had better fork it. esp. because GitHub PR workflow is horrible that it can easily cost more effort to submit patches than writing patches. Contributing non-trivial patches could be nightmare for non-commiters.

Thank you for the detailed instructions! I will add a link to this on the Discord for people trying to build it.

Also, I have been trying to get this running from VS 2022 the past two days and have gotten fairly far. Build was successful, but went to run it and got this popup. I'll update this if I find anything to fix it.
image

@MartinGuehmann
Copy link
Collaborator

Also, I have been trying to get this running from VS 2022 the past two days and have gotten fairly far. Build was successful, but went to run it and got this popup. I'll update this if I find anything to fix it.

No, you did not run, at least that what I guess, since the message box is covering the interesting information about ctp2.exe. I guess the creation is is 12/26/2022 9:09 PM and its size is about 6 MB, which is the release version. The version you compiled this year should be well from this year and its size should be around 4 MB.

I guess you did not copy it over.

The released version of the executable is in ctp2_program/ctp, while the freshly compiled version is in ctp2_code/ctp. Depending on the configuration you chose, the file will be named differently. Configuration Debug generates CivCTP_dbg.exe, the heavy debug version with logging, assertions, and memory leaks checking. The last thing makes it slow.

Then the configuration Release generates ctp2r.exe, so obviously not the version that was actually released. I think it contains some minor stuff for debugging than the final version.

And that what you get with the configuration Final, that it's then ctp2.exe.

Of course, Visual Studio is an integrated development environment. That means you start the game within Visual Studio. You can just press F5, that should start also the debugger or CTRL+F5 that should start it without the debugger. You can check that in the Debug menu, right now I am on a Linux so I can't check it and that is already quite some unconscious routine for me.

If you want to use your save games, then copy the folder ctp2_program/ctp/save/ including its subfolders to ctp2_code/ctp/save/.

@justinfarrelldev
Copy link
Author

justinfarrelldev commented Feb 25, 2023

Also, I have been trying to get this running from VS 2022 the past two days and have gotten fairly far. Build was successful, but went to run it and got this popup. I'll update this if I find anything to fix it.

No, you did not run, at least that what I guess, since the message box is covering the interesting information about ctp2.exe. I guess the creation is is 12/26/2022 9:09 PM and its size is about 6 MB, which is the release version. The version you compiled this year should be well from this year and its size should be around 4 MB.

I guess you did not copy it over.

The released version of the executable is in ctp2_program/ctp, while the freshly compiled version is in ctp2_code/ctp. Depending on the configuration you chose, the file will be named differently. Configuration Debug generates CivCTP_dbg.exe, the heavy debug version with logging, assertions, and memory leaks checking. The last thing makes it slow.

Then the configuration Release generates ctp2r.exe, so obviously not the version that was actually released. I think it contains some minor stuff for debugging than the final version.

And that what you get with the configuration Final, that it's then ctp2.exe.

Of course, Visual Studio is an integrated development environment. That means you start the game within Visual Studio. You can just press F5, that should start also the debugger or CTRL+F5 that should start it without the debugger. You can check that in the Debug menu, right now I am on a Linux so I can't check it and that is already quite some unconscious routine for me.

If you want to use your save games, then copy the folder ctp2_program/ctp/save/ including its subfolders to ctp2_code/ctp/save/.

This makes more sense (I already know how to run the IDE of course, but had no idea the outfile was CivCTP_dbg.exe). I have been experimenting around with it and I believe I'm close to building it once more. I do have a few questions though:

  1. When I build any of the startup items, I notice they tend to go into a dot directory (notice the /./ in the path). Is this intended? I seem to be able to build just fine with them, it's just curious (my first inclination is that it's a cygwin thing).
    For example, building under Debug Browse | Win32,
dbgen.vcxproj -> C:\Users\justin.farrell\Documents\ctp2-apolyton\civctp2-try-2\ctp2_code\gs\dbgen\.\Debug\dbgen.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Also, another line gotten while building the sln:

6>  civctp.vcxproj -> C:\Users\justin.farrell\Documents\ctp2-apolyton\civctp2-try-2\ctp2_code\ctp\.\Debug\ctp2.exe
  1. I have gotten the build to succeed:
========== Build: 6 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
Build succeeded

When I do press F5 however, nothing happens. If I run CivCTP_dbg.exe manually, however, I end up running into this DLL error:

image

I am assuming this is due to me using VS 2022 to build it, since this seems to be a DLL generated with VC++ 6.0. I've been looking into getting this fixed a bit, just curious if you happen to know the correct settings to get this DLL out? I'm currently running under x86_Debug configuration, VS 2022 17.5.

Edit: I'm now installing VC++ 6.0 to see if it'll fix this.

Edit 2: Installing VC++ 6.0 didn't fix it, but I changed my config to x64-Debug and Debug|Win64 and managed to get no missing DLL popup and a loading spinner (but sadly it didn't actually run the game visually). Also no error as you can see.
image

Edit 3: Checked with Powershell and yeah, the program appears to have completed successfully but the game never opened ($? was True and after $Error.Clear() and re-running $Error[0] was empty).

@LynxAbraxas
Copy link
Contributor

I feel that this repo is dead.

@myocytebd What makes you feel that?

@rambo919
Copy link

A clear warning is needed in the instructions. "configure: error: unsafe absolute working directory name" is too vague, not everyone will realize that no spaces in the path is assumed.

@rambo919
Copy link

I feel that this repo is dead.

@myocytebd What makes you feel that?

Nothing to do with feelings just his bad way of stating it. Most files have no recent edits, lots of open issues, latest edits are a year old, lots of open issues directly related to people being unable to build.

@LynxAbraxas
Copy link
Contributor

I feel that this repo is dead.

@myocytebd What makes you feel that?

Nothing to do with feelings just his bad way of stating it. Most files have no recent edits, lots of open issues, latest edits are a year old, lots of open issues directly related to people being unable to build.

Contributions for improvement are very welcome!
Most of the long term contributors and maintainers have not so much time any more;-)

@MartinGuehmann
Copy link
Collaborator

I merged in the updated build instructions into the readme. So if you still have an issue please open a new one.

@LynxAbraxas
Copy link
Contributor

Please, also let us know if things work out for you now and what caused the problems.

@justinfarrelldev
Copy link
Author

Please, also let us know if things work out for you now and what caused the problems.

I will definitely try building it again in a few weeks when my new computer comes in. 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

5 participants