Win32 builds seemingly fail
redruin1 opened this issue · 2 comments
Steps:
- Pull most recent commit d3cb734 (Though this also seems to be an issue present before any of my PRs)
- Delete the current
Buildfolder (if present) mkdir Build&&cd Buildcmake ../Projects -A Win32 -DAUX_DATA="path/to/overgrowth/install"
Compilation succeeds, but produces a runtime exception seemingly when loading some image data:
From what I can see the only place that calls this function is ImGui_ImplSdlGL3_CreateFontsTexture:
void ImGui_ImplSdlGL3_CreateFontsTexture() {
// Build texture atlas
ImGuiIO& io = ImGui::GetIO();
unsigned char* pixels;
int width, height;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
// ...
}So, ImGui::GetIO() seems to return an invalid reference, but only on Win32 builds. I'll try building a 32-bit target on Ubuntu and see if the same issue exists, and I'll add a comment in a bit when I get to switching OS's. I'll attach the log file as well, though it doesn't seem very descriptive:
Of course, let me know if I'm simply just doing this wrong.
Okay, building a 32-bit binary on a 64 bit processor on Linux is far more in-depth than I originally envisioned; If anyone knows how to do it properly, please share as I'd love to test if I've accidentally caused any regression errors with my recent PRs.
For now I'll probably focus on this Windows bug as I believe I have a slightly better chance at solving this one.
After some discussion with @autious, it's been revealed that (while Overgrowth did support 32-bit builds in the past) 32-bit builds have been phased out since memory requirements on certain levels exceed 3.5 GB, as well as that it's much easier to maintain only one 64-bit configuration. Since this isn't really part of Overgrowths current design, calling it an issue is incorrect, so I'll mark it as closed.
However, if there is anyone willing to get a 32-bit version built, it should still technically be possible, so I'll post my findings.
On Windows, you can specify a -A Win32 argument to CMake, which sets the architecture to 'Win32'. If you open Visual Studio, it should say Win32 instead of x64 in the configuration manager. This build compiles, but fails because of the issue described above. I've also tried specifying -DFORCE32=ON in addition to -A Win32 at the same time, but I was unable to recognize a difference.
On Linux, you can set Overgrowth to compile with the -m32 flag if you specify the cmake argument -DFORCE32=ON (make sure to delete your CMakeCache.txt or start a clean build folder in order for it to take effect!) You'll also probably need to install gcc-multilib and g++-multilib to allow compiling against a different architecture than x86_64.
You also (presumably) need 32-bit versions of each library dependency; so, if you need gtk2.0-dev, you'd have to also install gtk2.0-dev:i386. This would have to be done for all dependencies of Overgrowth.
On 64-bit machines, you might have to add the i386 architecture to your package manager so that it can find the 32-bit versions:
# Ubuntu, because that's what I was using
sudo dpkg --add-architecture i386
sudo apt-get update
Once you do that, you should be able to perform the same step as in COMPILING.md, but with :i386 appended to every requirement.
sudo apt install mesa-common-dev:i386 libsdl2-dev:i386 ...
Some libraries seem not to have a 32-bit converse, and packages like build-essential and cmake don't need to be re-installed as 32-bit, since they're tools, not dependencies. After all this, simply type make and Overgrowth should compile. (I was having issues compiling on Ubuntu, but I think they were related to packages being installed in the incorrect location, not because of an issue with methodology. Correct me if I'm wrong, though.)
