Mednafen Members Members   Search Search   Help Help   Register Register   Login Login   Home Home
Home » Mednafen » Development » mednafen does not build with gcc-4.4
Show: Today's Messages  :: Show Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
mednafen does not build with gcc-4.4 [message #1439] Wed, 11 March 2009 11:04 Go to next message
belegdol  [PM]
Hi,

I'm maintaining mednafen packages in RPM Fusion, which is an add-on package repository for Fedora. The development branch of Fedora, rawhide, recently moved to gcc-4.4 and as a result it is now impossible to build mednafen. The build process dies with the following message:
Quote:

file.cpp: In function 'bool ApplyIPS(FILE*, MDFNFILE*, const char*)':
file.cpp:144: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result
file.cpp: In function 'MDFNFILE* MakeMemWrap(void*, int)':
file.cpp:207: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result
file.cpp: In function 'MDFNFILE* MDFN_fopen(const char*, const char*, const char*, const char*)':
file.cpp:421: error: invalid conversion from 'const char*' to 'char*'
file.cpp: In function 'int MDFN_read16le(uint16*, MDFNFILE*)':
file.cpp:579: warning: dereferencing type-punned pointer will break strict-aliasing rules
file.cpp: In function 'bool MDFN_DumpToFileReal(const char*, int, const std::vector<PtrLengthPair, std::allocator<PtrLengthPair> >&)':
file.cpp:678: warning: comparison between signed and unsigned integer expressions
make[2]: *** [file.o] Error 1

Some explanation is given here, but unfortunately I don't know how to code so I can't fix it myself Sad
Re: mednafen does not build with gcc-4.4 [message #1440 is a reply to message #1439 ] Wed, 11 March 2009 11:51 Go to previous messageGo to next message
Near  [PM]
You really only need to change line 421. The other stuff is just GCC being increasingly pedantic with each revision.

Line 144:
fread(dest->data+offset,1,size,ips);
->
int shut_up_gcc___nobody_cares = fread(dest->data+offset,1,size,ips);

Line 207:
fread(tmp->data,1,tmp->size,(FILE *)tz);
->
int the_road_to_hell_is_paved_with_good_warning_message_intentions = fread(tmp->data,1,tmp->size,(FILE *)tz);

Line 421: scary, GCC was allowing const char* return to be cast to char* ...
Also, this might be slightly dangerous: a path of "/home/foobar/.mednafen/file" would return ".mednafen/file".

char *ld = strrchr(path, '.');
->
const char *ld = strrchr(path, '.');

Line 579: I have no idea what's going on here ...

Line 678: tough one, gzwrite takes unsigned int for length, returns int (which can be < 0 ... why?) for actual write amount. But length is of type uint64; where sizeof(int) is usually < sizeof(uint64). Meh.

if(gzwrite(gp, data, length) != length)
->
if(gzwrite(gp, data, length) != (int)length)

[Updated on: Wed, 11 March 2009 11:58]

Re: mednafen does not build with gcc-4.4 [message #1441 is a reply to message #1439 ] Wed, 11 March 2009 12:13 Go to previous messageGo to next message
belegdol  [PM]
OK, that did the trick. Thanks!
Re: mednafen does not build with gcc-4.4 [message #1442 is a reply to message #1439 ] Wed, 11 March 2009 13:46 Go to previous messageGo to next message
belegdol  [PM]
Looks like I spoke too soon. It works on x86_64, but not on ppc64:
Quote:

{standard input}: Assembler messages:
{standard input}:11673: Error: operand out of domain (26 is not a multiple of 4)
make[2]: *** [psg.o] Error 1

Here is the full build log.

[Updated on: Wed, 11 March 2009 14:36]

Re: mednafen does not build with gcc-4.4 [message #1443 is a reply to message #1442 ] Wed, 11 March 2009 15:05 Go to previous messageGo to next message
Near  [PM]
Tons of warnings, but the only error there is:

{standard input}: Assembler messages:
{standard input}:11673: Error: operand out of domain (26 is not a multiple of 4)

That looks like a problem with libc or something ... not sure how you'd fix that.
Re: mednafen does not build with gcc-4.4 [message #1445 is a reply to message #1443 ] Sun, 15 March 2009 13:55 Go to previous message
belegdol  [PM]
I added an ExcludeArch, if someone comes up with a fix I'll be happy to share.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:question for developers of mednafen
Next Topic:More info on the NeoGeo Pocket
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ ]

Current Time: Sat May 18 12:16:48 CDT 2024
.:: Contact :: Home ::.

Powered by FUDforum.
Copyright © FUDforum Bulletin Board Software