linux build patch (gcc 4.4.2)
linux build patch (gcc 4.4.2)
I compiled JGE/mtg on linux gentoo amd64 with gcc-4.4.2
I had to make changes, mostly to replace std::string::find() return types to std::string::size_type (instead of unsigned int). Also gcc doesn't seem to like "sprintf(buffer, "somestring") and requires sprintf(buffer, "%s", "somestring") instead. I added those.
Of note: I could only get 64bit for fmod 4.x fmod 3.x was available only as a32bit library, so I added '-m32' to all the linux specific portions of the makefiles. Probably building as 32bit would have alleviated the string::size_type issue, but regardless it should be fixed and in my experience 64bit clean code has always cleanly cross compiled to 32bit, but I've never had the same experience going from 32 to 64bit.
I uploaded the patch here:
http://pastebin.com/m79a41337
The game only crashes when I start. I don't know yet how to handle making a resource file or how to place it.
Also I can't get the latest svn psp toolchain to build JGE. Apparently vfree/vrelptr isn't available anymore in the toolchain? (can't say).
I had to make changes, mostly to replace std::string::find() return types to std::string::size_type (instead of unsigned int). Also gcc doesn't seem to like "sprintf(buffer, "somestring") and requires sprintf(buffer, "%s", "somestring") instead. I added those.
Of note: I could only get 64bit for fmod 4.x fmod 3.x was available only as a32bit library, so I added '-m32' to all the linux specific portions of the makefiles. Probably building as 32bit would have alleviated the string::size_type issue, but regardless it should be fixed and in my experience 64bit clean code has always cleanly cross compiled to 32bit, but I've never had the same experience going from 32 to 64bit.
I uploaded the patch here:
http://pastebin.com/m79a41337
The game only crashes when I start. I don't know yet how to handle making a resource file or how to place it.
Also I can't get the latest svn psp toolchain to build JGE. Apparently vfree/vrelptr isn't available anymore in the toolchain? (can't say).
Re: linux build patch (gcc 4.4.2)
Thanks.
I haven't compiled JGE/WTH in linux in a while. Our "Linux Expert" Jean is out for the weekend but I'll have him look at your patch. Also I don't have any 64bits OS so I an't test myself 64bits compilation
I haven't compiled JGE/WTH in linux in a while. Our "Linux Expert" Jean is out for the weekend but I'll have him look at your patch. Also I don't have any 64bits OS so I an't test myself 64bits compilation
-
- Posts: 14
- Joined: Wed Apr 29, 2009 3:25 am
- Location: Japan
Re: linux build patch (gcc 4.4.2)
Another patch for revisions 1423. I tried to compil on linux, didn’t work. I didn’t get what to do until I saw this post. I’m no good in C++ but that should do it. Note that I run the test suite and it told me that 1 test failed. I don’t know which one and don’t know how to know which one it is.
http://pastebin.com/m221cb5e0
http://pastebin.com/m221cb5e0
?20100
Re: linux build patch (gcc 4.4.2)
Can you go to projects/mtg/bin/Res/test and open the file results.html? That's the log of all test suite results. One test should have its results written in red text, that's the one that has failed. Usually (but not always) you can find it easier by searching the page for the word "expected".masaru20100 wrote:Note that I run the test suite and it told me that 1 test failed. I don’t know which one and don’t know how to know which one it is.
I'm very interested in knowing which test failed. I suspect it's either goblin_artillery.txt or angry_mob6.txt, if you could check that that would be great.
Re: linux build patch (gcc 4.4.2)
Gcc hates me...masaru20100 wrote:Another patch for revisions 1423. I tried to compil on linux, didn’t work. I didn’t get what to do until I saw this post. I’m no good in C++ but that should do it. Note that I run the test suite and it told me that 1 test failed. I don’t know which one and don’t know how to know which one it is.
http://pastebin.com/m221cb5e0
another (temporary) solution is to remove the -Werror flag in the makefile
-
- Posts: 14
- Joined: Wed Apr 29, 2009 3:25 am
- Location: Japan
Re: linux build patch (gcc 4.4.2)
In fact it seems it’s both, because both are in red:Psyringe wrote:…
I'm very interested in knowing which test failed. I suspect it's either goblin_artillery.txt or angry_mob6.txt, if you could check that that would be great.
angry_mob6.txt
==life problem for player 0. Expected 24, got 23==
ai/goblin_artillery.txt
==life problem for player 0. Expected 17, got 20==
==Card number not the same in player 1's graveyard==, expected 1, got 0
==Card ID not the same. Didn't find 4356
==Card number not the same in player 1's battlefield==, expected 0, got 1
?20100
Re: linux build patch (gcc 4.4.2)
Thanks, that's valuable information!masaru20100 wrote:In fact it seems it’s both, because both are in red
The "Goblin Artillery" test is only experimental at this stage, it may fail due to timing issues on different hardware (although I'm not sure that explains the error messages you got, but I'd need to investigate further to find that out).
"Angry Mob6" currently does have a problem (see issue 240 on the bugtracker). It's good to know that it doesn't only affect my machine (so far I wasn't sure about that).
Currently, for users / modders, I suggest to ignore these two tests for the time being. So if all other tests worked, then everything looks okay and you changes didn't break anything in the duel logic.
-
- Posts: 14
- Joined: Wed Apr 29, 2009 3:25 am
- Location: Japan
Re: linux build patch (gcc 4.4.2)
I’ve got a couple of issues with the version I build.
First, here is what I got when launching in Linux:
But the window is created without problem and I can play the game. Note that the game window has no title, that may be linked.
I also can’t change the player in the options screen. It may be linked with the fact I don’t see the theme selection. I also manage to install the PSP SDK. And to compile for PSP (even if I had to add vram.h in JGE)
The problem of theme view/select doesn’t happen on PSP.
But I’ve got another issue on the PSP, if I select save & go to menu from options, the PSP crash. I don’t even have a BLOD.
Another issue I’ve got, is that when winning the text “Congratulations! You earn %i credits 425” is displayed.
This is because I fixed this line to compile:
(Credits.cpp)
That was a bad fix.
g++ wants some "%s" when calling sprintf to prevent problem (crash maybe) if the called string has a %s in it (as in sprintf(buffer, something.c_str());)
Problem is, how to prevent that while doing the replacement for %i. How to prevent a problem if the string is badly translated (another %i added for example)?
I guess I’d know if I was better in C++
First, here is what I got when launching in Linux:
Code: Select all
WARNING: Application calling GLX 1.3 function "glXCreateWindow" when GLX 1.3 is not supported! This is an application bug!
I also can’t change the player in the options screen. It may be linked with the fact I don’t see the theme selection. I also manage to install the PSP SDK. And to compile for PSP (even if I had to add vram.h in JGE)
The problem of theme view/select doesn’t happen on PSP.
But I’ve got another issue on the PSP, if I select save & go to menu from options, the PSP crash. I don’t even have a BLOD.
Another issue I’ve got, is that when winning the text “Congratulations! You earn %i credits 425” is displayed.
This is because I fixed this line to compile:
(Credits.cpp)
Code: Select all
- sprintf (buffer, _("Congratulations! You earn %i credits").c_str(), value);
+ sprintf (buffer, "%s %i", _("Congratulations! You earn %i credits").c_str(), value);
g++ wants some "%s" when calling sprintf to prevent problem (crash maybe) if the called string has a %s in it (as in sprintf(buffer, something.c_str());)
Problem is, how to prevent that while doing the replacement for %i. How to prevent a problem if the string is badly translated (another %i added for example)?
I guess I’d know if I was better in C++
?20100
Re: linux build patch (gcc 4.4.2)
As far as I can tell, this is just because you don't have GLX1.3. Ideally, the program would indeed test its presence before relying on it - I was not aware glXCreateWindow was GLX1.3 exclusive, because I never used a machine where GLX1.3 was not present, and by the way, I think 1.4 is fairly common already.masaru20100 wrote:First, here is what I got when launching in Linux:Code: Select all
WARNING: Application calling GLX 1.3 function "glXCreateWindow" when GLX 1.3 is not supported! This is an application bug!
This is probably a bug in the game, we'll try to have a look.I also can’t change the player in the options screen. It may be linked with the fact I don’t see the theme selection.
Yes indeed, that is not going to work.This is because I fixed this line to compile:
(Credits.cpp)Code: Select all
- sprintf (buffer, _("Congratulations! You earn %i credits").c_str(), value); + sprintf (buffer, "%s %i", _("Congratulations! You earn %i credits").c_str(), value);
Now, I just tried to compile wagic with gcc 4.4.2 and I did not have any problem with sprintfs. I don't have access to a 64-bits architecture but I doubt this is related. So, can you please explain what gcc complains about with sprintfs ? Since the problem does not happen on my dev environments and you don't tell the error, it's hard to guess what's happening on your side.
-
- Posts: 14
- Joined: Wed Apr 29, 2009 3:25 am
- Location: Japan
Re: linux build patch (gcc 4.4.2)
I’m not using a 64 bits linux.Jean wrote:Yes indeed, that is not going to work.This is because I fixed this line to compile:
(Credits.cpp)Code: Select all
- sprintf (buffer, _("Congratulations! You earn %i credits").c_str(), value); + sprintf (buffer, "%s %i", _("Congratulations! You earn %i credits").c_str(), value);
Now, I just tried to compile wagic with gcc 4.4.2 and I did not have any problem with sprintfs. I don't have access to a 64-bits architecture but I doubt this is related. So, can you please explain what gcc complains about with sprintfs ? Since the problem does not happen on my dev environments and you don't tell the error, it's hard to guess what's happening on your side.
I’ve updated http://wololo.net/miki/index.php/Wagic/Compiling with my info, hope it benefits someone (by the way, thanks Jean because that’s your posts that allowed me to compile).
Code: Select all
g++ -c -o objs/Credits.o -Wall -W -Werror -Wno-unused -I ../../JGE/include -I ../../JGE/src -DLINUX src/Credits.cpp
cc1plus: warnings being treated as errors
src/Credits.cpp: In member function ‘void Credits::Render()’:
src/Credits.cpp:151: error: format not a string literal and no format arguments
src/Credits.cpp:164: error: format not a string literal and no format arguments
make: *** [objs/Credits.o] Erreur 1
I also forgot to mention that card images in zip are not displayed on linux (but fine on my PSP).bnolsen wrote:[…] Also gcc doesn't seem to like "sprintf(buffer, "somestring") and requires sprintf(buffer, "%s", "somestring") instead. I added those.
…
?20100