Skip to content

Failed to build Windows exe via ./ubuntu64-ia32-pkgs.sh and ./ubuntu64-ia32-make.sh #6

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

Open
StoykoDimitrov opened this issue May 26, 2017 · 8 comments

Comments

@StoykoDimitrov
Copy link

StoykoDimitrov commented May 26, 2017

I have build the libs in Ubuntu. Then I have removed libs/lib/libSDL* and -lSDLmain from libs/lib/pkgconfig/sdl.pc as described in the README.md file. Now when I run ./ubuntu64-ia32-pkgs.sh I get the following error in the output:

osboxes@osboxes:~/forsaken/forsaken/libs$ ./ubuntu64-ia32-pkgs.sh 
[sudo] password for osboxes: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  lib32ncurses5 lib32z1

E: Unable to locate package ia32-libs-multiarch
E: Unable to locate package lib32mudflap0
E: Package 'ia32-libs' has no installation candidate
ln: failed to create symbolic link '/usr/lib/i386-linux-gnu/mesa/libGL.so': No such file or directory
ln: failed to create symbolic link '/usr/lib/i386-linux-gnu/libGLU.so': No such file or directory
ln: failed to create symbolic link '/usr/lib/i386-linux-gnu/libopenal.so': No such file or directory
ln: failed to create symbolic link '/usr/lib/i386-linux-gnu/libSDL.so': No such file or directory
You will need to remove libs/lib/libSDL* and -lSDLmain from sdl.pc
@chino
Copy link
Member

chino commented May 27, 2017

Did you try just using the pre-built mingw libs for windows?

https://github.com/ForsakenX/forsaken-libs-mingw32

@chino
Copy link
Member

chino commented May 27, 2017

Ubuntu was one of the hackiest back then to compile for. I'm sure it's all out dated now and needs to be tweaked. Today with the advent of containers it would be much easier to just build a container to do this in a more reproducible way.

@StoykoDimitrov
Copy link
Author

Yes, I did tried the pre-built mingw libs but then again there was no working script to compile the source code of the game on Windows (unless you build it via Visual Studio but the project dependencies for the Visual Studio project file are also wrong so building it this way needs tweaking as well) and that is why I tried to create the game executable via Ubuntu.

@chino
Copy link
Member

chino commented May 28, 2017

I haven't used Visual Studios in ages but it shouldn't be too far off if you're able to update them.

It has been a while now but I'm pretty sure you have to use the other pre-built mingw libs folder to target windows. The script in that repo should work on windows and linux to target mingw. I do not believe you should be using this repo to target windows...

See: https://github.com/ForsakenX/forsaken-libs-mingw32/blob/master/make.sh

Ubuntu and Visual Studios most likely just need some minor tweaks to get updated.

To test it out, I just downloaded, built, and ran all the libs and the game on OSX without issues.

@chino
Copy link
Member

chino commented May 31, 2017

Finally got around to trying to build it on osx using the pre-built mingw folder with the latest version mingw64 and winehq from homebrew.

Note, the pre-built folder must be named mingw (I added a warning for this now) and you must have any required dll files there as well (hence ln -sf mingw/bin/*dll .). Also now that mingw64 seems to be main stream I believe we have to hard code M32=1 into make.sh to force it to use 32bit mode because the pre-built libs are all 32bit (although we can now work towards 64bit mingw builds now too). I also ran into a small issue compiling which required me to comment out the _matherr function until I figure that out.

The game definitely compiles and runs using mingw now...

I haven't tried with the original mingw.org (32bit) version but it should work just same if I'm able to get this far with mingw64.

This is the patch to Forsaken that you might require as well:

diff --git a/math_error.c b/math_error.c
index f14cf05..b65b1f6 100644
--- a/math_error.c
+++ b/math_error.c
@@ -18,6 +18,8 @@ static char * MathErrStrings[] = {
        "Total Loss of significance",
        "Partial Loss of significance",
 };
+// TODO: on mingw64 `matherr` seems to be defined already causing an issue?
+#if defined(WIN32) && defined(_matherr)
 #ifdef WIN32
 int     __cdecl _matherr(struct _exception * except)
 #else
@@ -95,6 +97,7 @@ int matherr(struct exception * except)
        }
        return 0;
 }
+#endif

 int DebugMathErrors( void )
 {

Can you try to get to this point and see how it works out for you on Windows and/or a Linux VM?

@chino
Copy link
Member

chino commented May 31, 2017

Also the changes I made to the mingw-libs folder are in a branch while we iron this out:

https://github.com/ForsakenX/forsaken-libs-mingw32/compare/mingw64-updates?expand=1

@chino
Copy link
Member

chino commented May 31, 2017

I want to point out again so it's clear that you CAN compile ON WINDOWS using MINGW just fine. So please try that out and let me know how it goes.

@chino
Copy link
Member

chino commented Jun 7, 2017

Are you still planning to work on this?

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

2 participants