Unable to compile SVN r3945

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Unable to compile SVN r3945

Post by CyberBotX »

I have tried to compile r3945 on both Windows with MinGW and on FreeBSD. In both cases, it fails saying there is an undefined reference in initc.c to gzdirect. FreeBSD gives me a nicer error saying it's in the loadGZipFile function. I am compiling under Windows 2000 using MinGW with GCC 3.4.2 and under FreeBSD with GCC 3.4.4. -lz is in the libs flags for both. Backing up to the last SVN revision that had a change to initc.c, 3944, has the same problem, but backing up to the one before that in which initc.c was changed, 3937, it compiles fine.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Firon
Trooper
Posts: 361
Joined: Fri May 05, 2006 4:37 pm
Contact:

Post by Firon »

Have you tried doing make clean, or if all else fails, a fresh checkout? Sometimes that fixes it. (I compiled r3945 with zget)
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

I have done a make clean, and when that did fail, I removed the directory and did a fresh SVN checkout. Same problem. I've got everything in MinGW to compile ZSNES, since I was able to compile all the ones before I tried 3945. Same with my FreeBSD machine.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Why does it sound like your compiled zlib is old... the MinGW in Zget is gcc 3.4.5.. if that means anything to you.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

Well, 3.4.5 is on MinGW's page as a Candidate version. I'm using the Current version. But aparently, my version of zlib, which is 1.2.3 on MinGW and 1.2.2 on FreeBSD, doesn't have a gzdirect function. And while I'm not sure if FreeBSD's base system has updated it's zlib or not, there is no updated msys port for zlib. zlib 1.2.3 was the last version that there is a mingwPORT of.

Edit: Considering zlib 1.2.3 is the current version of zlib, it makes me wonder why you are trying to use a function that doesn't come with 1.2.3.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

The latest zlib version (1.2.3) is required though.. (there are some functions in the latest version that are used).

As for zlib in Windows, try copying the libs (the headers and the .a/.so files) from the Zget MinGW package and see if that helps you.
CyberBotX wrote:Edit: Considering zlib 1.2.3 is the current version of zlib, it makes me wonder why you are trying to use a function that doesn't come with 1.2.3.
It exists, but for some reason, certain distro zlib releases don't seem to have this in it (*cough* Gentoo *cough*).
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

I don't see where you'd want me to copy them to. I just noticed something, though. The header file that includes zlib.h, glbhdr.h, is only included when __UNIXSDL__ is defined. Which it isn't when you compile the Windows version. So that might be why the Windows version fails to compile. FreeBSD, on the other hand, is only using 1.2.2, so it's missing gzdirect. I'll have to see if they updated to 1.2.3 in the base system or not.

EDIT: FreeBSD hasn't updated to 1.2.3, so I manually patched the files (more like copied, but you know...), and r3945 compiles under FreeBSD now. I edited initc.c on my Windows machine to have #include <zlib.h> in the #else...#endif after #ifdef __UNIXSDL__, and the Windows version compiles now as well. So yeah, it wasn't compiling under Windows because it didn't get the prototype correctly.
Last edited by CyberBotX on Sun Oct 01, 2006 11:11 am, edited 1 time in total.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Headers goes to MinGW/include and the .a file goes to the MinGW/lib.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

They are there. I edited my previous post. It works now, but only after editing initc.c to include zlib.h even if compiling under Windows. I'm guessing you guys might need to add a special -D to compiling initc.c under Windows with MinGW so it includes zlib.h.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

zlib 1.2.3 is required now. If you get a link error about gzdirect() not existing, you are not using zlib 1.2.3 or later.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

This is strange. Sometime between last night and this afternoon, all of the sudden, gcc is saying it can't find gzdirect again. This is only on my Windows machine. I checked libz.a and it does have gzdirect defined. I even tried to erase the files that zlib installs and installed zlib again, and it still fails. I don't see how it managed to compile last night but won't compile now. It gets all the other zlib functions fine, but not gzdirect. I can compile it on FreeBSD with no problem. Even a small program I wrote up that only uses gzopen, gzdirect, and gzclose doesn't compile. Obviously without -lz, it says all 3 can't be found, but when I add -lz, it still says it can't find gzdirect.

Oh, I did update to SVN r3946 also. But I see that the only change was adding in the #include for zlib.h, so that can't be the problem.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I don't know what to tell you.

I've used gzdirect() with a hand compiled zlib 1.2.3 and Debian provided one on DOS, Windows, and Linux.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

I tried emailing Mark Adler with zlib, and he tells me he can't see any reason why it isn't working either. libz.a is 1.2.3, and looking at the strings output, I can see _gzdirect in the file. I even tried to update gcc to 3.4.5 since Deathlike2 suggested that. Still has the same problem, though. I'll try to see if the libz.a that you packaged with zget corrects the problem or not. If not, I don't know what else I could do.

EDIT: Well, even using zget to it's fullest, I see the same error. I'm stumped. I see no reason for the undefined reference and it makes no sense whatsoever.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

CyberBotX wrote:I tried emailing Mark Adler with zlib, and he tells me he can't see any reason why it isn't working either. libz.a is 1.2.3, and looking at the strings output, I can see _gzdirect in the file. I even tried to update gcc to 3.4.5 since Deathlike2 suggested that. Still has the same problem, though.
Strange. Although interesting you got such an immediate response from Mark. Perhaps I should e-mail him sometimes ;)
CyberBotX wrote: I'll try to see if the libz.a that you packaged with zget corrects the problem or not. If not, I don't know what else I could do.

EDIT: Well, even using zget to it's fullest, I see the same error. I'm stumped. I see no reason for the undefined reference and it makes no sense whatsoever.
Did you try using my libz.a over the other one? Since if you only tried running it through zget, I'm wondering if your other lib directory is preempting the one I provide with zget.

As Deathlike can attest, he has no issues use my zget with no other MinGWs around.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

Yeah, I copied libz.a from the MinGW folder that zget installs into my own MinGW's lib folder. Same result. I'm wondering if it is a MinGW issue or not. I guess only other thing I can try is to uninstall all MinGW products and install them again, see if that changes anything.

EDIT: Nope. Wiped out my MinGW and msys folders after uninstalling them, reinstalled the latest of everything, still no dice. Dunno what else to do. Makes no sense why it won't work. There's no other libz.a on the system except for the one that is now in the MinGW folder created by zget. Both of them contain _gzdirect in their strings output. ld should find gzdirect, but it can't. I'm at a loss.

EDIT²: OK, the oddest thing. After the previous failure, I checked MinGW's DocWiki for zlib. I found a link to GnuWin32. I downloaded their zlib package, installed it, copied their libz.a file, and tried to compile both my test program and the latest ZSNES source... both worked this time! I don't get it, but I'm glad it finally works!
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Something very strange is going on. I'm not sure what the cause may be though. I've been hunting in gzio.c to see if there's any issues. gzdirect() seems to match the style of the other functions, I can't really imagine why that one function should act up. Or that both Deathlike and myself can use a pure zget install and have no issues, yet you say that one function complains.

On another note though, while hunting in gzio.c I came across a buffer issue. Not a buffer overflow exactly, but some issues with gzprintf(). In fact they seem to detail some of it in zlib.h.

Code: Select all

gzprintf returns the number of uncompressed bytes actually written (0 in case of error).  The number of uncompressed bytes written is limited to 4095. The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return return an error (0) with nothing written.
Evil really. If someone actually bothered to implement a full *printf() function properly in gzio.c, it wouldn't have any of these limitations or possible pitfalls...
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
OmegaX
Rookie
Posts: 14
Joined: Sat Nov 04, 2006 4:04 am

Post by OmegaX »

Hi, i had the same problem with zlib in Linux (i'm using CentOs 4.4 btw), the most recent version of zlib in yum repos is 1.2.1, but i found something that can help in a linux forum, this is the link : http://www.howtoforge.com/forums/showthread.php?t=7026
Basically it explains how to build your own zlib rpm in very single steps that you can copy & paste in a console:
# yum install gcc
# yum install rpm-build
# wget ftp://chuck.ucs.indiana.edu/pub/array2/ ... .1.src.rpm
# rpmbuild --rebuild zlib-1.2.3-1.2.1.src.rpm
# rpm -Uhv /usr/src/redhat/RPMS/i386/zlib-*1.2.3-1.2.1.i386.rpm
# rpm -q zlib
zlib-1.2.3-1.2.1

I hope it will help anybody with this problem.
jaymz1219

Post by jaymz1219 »

Just so CyberBotX doesn't feel alone on this issue, I too experienced the same compilation problem with missing reference to gzdirect on Windows.

I've just downloaded the GnuWin32 port of zlib (developer files) and copied it into the zmingw appropriate folders (lib/ and include/). I'm rebuilding right now and will update this post on completion.

EDIT: That didn't work. I removed the GZ specific code from initc.c since I highly doubt I'll be loading any GZ-compressed files anyway. Build works now, obviously. :)
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

jaymz1219 wrote:Just so CyberBotX doesn't feel alone on this issue, I too experienced the same compilation problem with missing reference to gzdirect on Windows.

I've just downloaded the GnuWin32 port of zlib (developer files) and copied it into the zmingw appropriate folders (lib/ and include/). I'm rebuilding right now and will update this post on completion.

EDIT: That didn't work. I removed the GZ specific code from initc.c since I highly doubt I'll be loading any GZ-compressed files anyway. Build works now, obviously. :)
Um, if you're not using Zget and/or a good zlib 1.2.3, then you will always get the error.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Post Reply