MinGW/msys (possible) issues with romfs...

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

MinGW/msys (possible) issues with romfs...

Post by LBGSHI »

[Update]: gsKit issues resolved; romfs issues remain.

Hello, and might I apologize in advance for my probably inane questions :)

I'm using MinGW and msys, as outlined in a guide by Lukasz (many thanks to him for his contributions to me and the scene in general). I compiled PS2SDK, and was able to compile all the sources in Samples, all the source I've seen around the forums by whatisdot (many thanks to him as well, for all his examples), all the Hello World variants, and several other snippets here and there. Next, I wanted to compile some source that required SDL, so I checked out from SVN and installed gsKit, which seemed to work fine, then SDL, which also seemed to work fine. I was thus able to compile Lukasz's Doom SDL port. Next, there was some romfs-related source I wanted to compile, so I checked out romfs, and tried to do a make all install. However, this yielded the errors,

"genromfs.c:79:24: netinet/in.h: No such file or directory
genromfs.c:81:28: sys/sysmacros.h: No such file or directory"

Upon inspection, these files are nowhere to be found (on any of the three computers I have installed the PS2SDK on), but are apparently present in a normal Cygwin installation. I may be able to simply grab these from a Cygwin installation, and copy them over (though that's quite likely to fail, I suppose, or lead me to more missing files), but the question remains: is romfs compatible with the MinGW/msys PS2SDK setup?

Secondly, I was interested in compiling some gsKit examples, and saw ps2devman's qbert_ps2, pong_ps2, and a couple of others as a perfect opportunity for this (as they're relatively recent, and shouldn't be too outdated to compile on a new SDK). They can be found via this thread:

http://forums.ps2dev.org/viewtopic.php? ... ight=qbert

Upon attempting to compile any of them, however, I initially got the error,

"Makefile:27: /usr/local/ps2dev/gsKit/Makefile.pref: No such file or directory
Makefile:28: /usr/local/ps2dev/gsKit/Makefile.global: No such file or directory "

For a hopefully quick fix, I used a copy ps2devman sent me of each of these, but this resulted in an error that $(GSKITSRC)/ee/Rules.make could not be found. I have no ee dir under gsKit, let alone a Rules.make file inside of it. Hence, for another hopefully quick fix, I created an ee dir, and used a copy of Rules.make that ps2devman was generous enough to send me. However, this resulted in the errors,

"graphics.c:2:19: gsKit.h: No such file or directory
graphics.c:3:20: dmaKit.h: No such file or directory
graphics.c:9:19: gsKit.h: No such file or directory"

I have the missing files under local/ps2dev/gsKit/include, and gsKit seemed to install correctly, so I'm wondering why including them is failing...do I need to modify my environment variables in some way? And if so, shouldn't the gsKit installation have done that for me? Perhaps gsKit doesn't like msys/MinGW...

Does anyone have any idea about either of these issues? I do understand that these forums are generally not for beginners, and I also intend to remain a beginner for as little time as possible :) If you have a clue about what I'm missing, a friendly elbow to the ribs in the right direction would be very appreciated.
Last edited by LBGSHI on Wed Jul 16, 2008 2:22 am, edited 1 time in total.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

About the gskit issues :

Yes, to use gsKit in a project it's required to change your environment variables, so that's why the project you're compiling complains about not finding the gsKit.h and such files, which surely are present in your setup.

If you look closer to the gsKit makefile you'll see that it does this in a interesting way :

Code: Select all

ifeq (x$(GSKITSRC), x)
GSKITSRC=`pwd`
endif
so if the GSKITSRC environment variable isn't set, it sets it to the current path. It does this when you cd to your gsKit sdk and type 'make', but it's only temporary, so if your close your console window, bye-bye-see-you-another-time.

Also important is the stuff in Makefile.global : this set the path for important include files, for example (that's the reason for the error ""graphics.c:2:19: gsKit.h: No such file or directory"). Don't forget about Makefile.pref either.

I advise you to look and try to find what the heck the gsKit makefile is doing and how it works. First, read about makefiles in general... You won't be far without knowing the basics of it...

Then after all this, the final step is to strip from the gsKit makefiles the required stuff and merge with the makefile of the project you're trying to compile. This could take some time and be hard for a beginner, but that's the way it is :)
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

Hmm...but, assuming the projects in question were recently created, and apparently compile fine for others, wouldn't it stand to reason that I shouldn't need to modify the makefiles? Or, are you speculating that they need modification to work within the MinGW/msys framework? I suppose I should try compiling them on my Ubuntu box...but I still prefer to have a working Win32 environment as well.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

OK, for the gsKit projects (we'll use ps2devman's ps2_qbert for an example), I went through Rules.make, and noticed that the gsKit includes referenced were not where they were assumed to be. Rules.make (which, admittedly, was just a copy of ps2devman's Rules.make, from his environment) referenced all the gsKit includes being under ee/gs/include and dma/include; however, those directories are empty in my gsKit install, whereas gsKit/include contains all the gsKit include files. After adding -I$(GSKIT)/include to EE_INCS :=

...I managed to fix the issues I was having, but come across some new ones. The current output is:

Code: Select all

$ make
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c main.c -o m
ain.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c graphics.c
-o graphics.o
graphics.c: In function `loadsprite':
graphics.c:138: warning: implicit declaration of function `memalign'
graphics.c:138: warning: assignment makes pointer from integer without a cast
graphics.c:173: warning: implicit declaration of function `free'
graphics.c:200: warning: assignment makes pointer from integer without a cast
graphics.c: In function `reloadsprite':
graphics.c:287: warning: assignment makes pointer from integer without a cast
graphics.c:344: warning: assignment makes pointer from integer without a cast
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c qbert.c -o
qbert.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c game.c -o g
ame.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c bitmaps.c -
o bitmaps.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c irx_data.c
-o irx_data.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c iop_init.c
-o iop_init.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c ee_init.c -
o ee_init.o
ee-gcc -D_EE -O2 -G0 -Wall -g -fno-builtin-printf  -I/usr/local/ps2dev/ps2sdk/ee
/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/gsKit/ee/
dma/include -I/usr/local/ps2dev/gsKit/ee/gs/include -I/usr/local/ps2dev/gsKit/in
clude -I/usr/local/ps2dev/gsKit/ee/gs/include  -I/usr/local/ps2dev/gsKit/ee/dma/
include -I/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include -I/ee -c system.c -o
 system.o
system.c: In function `initscreen':
system.c:248: too few arguments to function `dmaKit_init'
make: *** [system.o] Error 1
I'll dig around and see what else I can figure out. Again, if anyone has any further ideas concerning either of these, please let me know, so I can have a fully working environment with gsKit and romfs as soon as possible.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

OK, I've "fixed" and managed to compile ps2_qbert. The offending code was "dmaKit_init", in system.c, below:

Code: Select all

	// This makes things look marginally better in half-buffer mode...
	// however on some CRT and all LCD, it makes a really horrible screen shake.
	// Uncomment this to disable it. (It is on by default)
	gsGlobal->DoSubOffset = GS_SETTING_OFF;	

	gsGlobal->PrimAlphaEnable = GS_SETTING_ON;	

	dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8);
...which, upon reading the comments above, and noting that it wasn't essential, I commented out. After doing so, the project compiled perfectly :)

I was also able to compile ps2_pong (also by ps2devman), after performing the same modification to system.c.

I'm still curious as to why it wouldn't compile, though. Perhaps ps2devman could shed some light onto that?

I'll tinker around with romfs a bit more in the meantime.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

LBGSHI wrote:OK, I've "fixed" and managed to compile ps2_qbert. The offending code was "dmaKit_init", in system.c, below:

Code: Select all

	// This makes things look marginally better in half-buffer mode...
	// however on some CRT and all LCD, it makes a really horrible screen shake.
	// Uncomment this to disable it. (It is on by default)
	gsGlobal->DoSubOffset = GS_SETTING_OFF;	

	gsGlobal->PrimAlphaEnable = GS_SETTING_ON;	

	dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8);
...which, upon reading the comments above, and noting that it wasn't essential, I commented out. After doing so, the project compiled perfectly :)
That's odd... If I understood correctly, you commented the dmaKit_init line... Which is a core part of gsKit.

If I also understood right again, the line that could be commented was "gsGlobal->DoSubOffset = GS_SETTING_OFF;" not the whole section you posted above.

I already tried to compile it long time ago. All I had to do is replace the dmaKit_init by this :

Code: Select all

	dmaKit_init(D_CTRL_RELE_OFF,D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
		    D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF&#41;;
which I took from the bigtex.c gskit example.

If you look closely to the sources of gsKit, dmaKit_init has and extra parameter (1 << DMA_CHANNEL_GIF). I guess the source of ps2_qbert is old and gsKit changed it the meanwhile.
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

LBGSHI wrote:Hmm...but, assuming the projects in question were recently created, and apparently compile fine for others, wouldn't it stand to reason that I shouldn't need to modify the makefiles? Or, are you speculating that they need modification to work within the MinGW/msys framework? I suppose I should try compiling them on my Ubuntu box...but I still prefer to have a working Win32 environment as well.
No, I'm saying the project you're compiling can't find the gsKit include stuff :

Code: Select all

"graphics.c&#58;2&#58;19&#58; gsKit.h&#58; No such file or directory 
graphics.c&#58;3&#58;20&#58; dmaKit.h&#58; No such file or directory 
graphics.c&#58;9&#58;19&#58; gsKit.h&#58; No such file or directory" 
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

Ah; thanks for the info concerning dmaKit (yes; it compiled fine with the change you mentioned, though it still doesn't run on PCSX2t, but I'm guessing it was written to run via PS2Link).

As for the includes, I see. I fixed that earlier, though, by manually modifying my /gsKit/ee/Rules.make file (adding -I$(GSKIT)/include to EE_INCS :=)

And, as always, thanks immensely for the help.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
ps2devman
Posts: 259
Joined: Mon Oct 09, 2006 3:56 pm

Post by ps2devman »

Thanks for your efforts. I've added a readme_2008.txt file to the pong, qbert and initial fantasy archives, with your notes inside about gsKit change.
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

Cool. Heh, it may have been partially thanks to my efforts, but it relied heavily upon everyone else's knowledge and experience :)

I'm still waiting for a copy of a couple of Cygwin files, to see if a direct copy/paste will fix an issue with compiling romfs in MinGW.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

All right; after implanting all missing included Cygwin files (four header files, namely netinet/in.h, cygwin/in.h, sys/sysmacros.h, and asm/byteorder.h), I'm still receiving the following:

Code: Select all

$ make all install
make -C tools/genromfs all
make&#91;1&#93;&#58; Entering directory `/home/romfs/tools/genromfs'
gcc -O2 -Wall    -c -o genromfs.o genromfs.c
genromfs.c&#58; In function `dumpnode'&#58;
genromfs.c&#58;349&#58; warning&#58; implicit declaration of function `S_ISLNK'
genromfs.c&#58;353&#58; warning&#58; implicit declaration of function `readlink'
genromfs.c&#58;395&#58; warning&#58; implicit declaration of function `S_ISSOCK'
genromfs.c&#58; In function `processdir'&#58;
genromfs.c&#58;546&#58; warning&#58; implicit declaration of function `lstat'
gcc -s  genromfs.o   -o genromfs
genromfs.o&#58;genromfs.c&#58;&#40;.text+0x5be&#41;&#58; undefined reference to `S_ISLNK'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0x605&#41;&#58; undefined reference to `S_ISSOCK'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0x73d&#41;&#58; undefined reference to `readlink'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0xc22&#41;&#58; undefined reference to `lstat'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0xc99&#41;&#58; undefined reference to `S_ISLNK'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0xd88&#41;&#58; undefined reference to `S_ISLNK'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0xe7e&#41;&#58; undefined reference to `lstat'
genromfs.o&#58;genromfs.c&#58;&#40;.text+0xf0c&#41;&#58; undefined reference to `lstat'
collect2&#58; ld returned 1 exit status
make&#91;1&#93;&#58; *** &#91;genromfs&#93; Error 1
make&#91;1&#93;&#58; Leaving directory `/home/romfs/tools/genromfs'
make&#58; *** &#91;all&#93; Error 2
I'm still searching around for what exactly each of these is and does, and trying to figure out why they're being called undefined. I'll post back if I come up with a solution. In the meantime, feel free to knock me over the head with the answer if you have it :)

As a note, I am a beginner here, and I understand this. If my questions or comments are too ignorant, too needy, or both, I apologize. I'm only doing my best. Thanks in advance for any help, and if none, thanks for the help provided thus far, and I'll try to pay it back by creating some useful things for the scene. Off to toy with romfs a bit more...
I may be lazy, but I can...zzzZZZzzzZZZzzz...
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

Well, for experiment's sake, I butchered \romfs\tools\genromfs\genromfs.c, removing all the offending references and functions. I'm sure there will be lost functionality, if not complete loss of functionality (from what I can gather from the source, I'm almost positive I've at least disabled its ability to make sure the files being called from within an ELF exist before trying to load them, for example), but I'd still like to test it, as it did seem to build and install correctly, at least.

Would anyone happen to have some very simple example code that utilizes romfs?
I may be lazy, but I can...zzzZZZzzzZZZzzz...
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

Hmm...I was able to compile Jason Yu's SDL Doom source, though if I remember correctly, the romfs stuff was commented out by default...I have to go to lunch at the moment, but I'll check up on that a little later. Still, if anyone's got some more romfs stuff to point me to, please do.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

I was able to compile Super Mario War, though, since it uses some sort of created-on-demand /tools/genromfs.c (I must confess that I was too lazy to dig around looking for it at the moment), I had to simply drop my modified copy of that directory and file into the source directory, and slightly modify the source to look for it there. Anyway, that should have exactly the same effect as testing some source that actually includes the installed romfs files, unless there's something I'm not thinking of.

However, I wasn't able to run it via PCXS2 (using PCSX2t.exe). This could be because of some of the missing snippets of code, or it could be because SMW was designed to be run via PS2Link (or just doesn't emulate well).
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Post Reply