Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Tue Mar 19, 2024 7:19 am

All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Tue Dec 02, 2008 1:38 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
Not to waste anyone's time, but does anyone know how hard it would be to compile raydium/mania drive in freebsd? I gave it a shot, even though I don't know too much about coding/compiling other than a few scripting languages.
As far as I could tell, some issues are joystick libraries (which it seems freebsd is lacking in) and I think the other thing was a realtime clock capability in the linux kernel, which freebsd doesn't have (?).
Do you think it is just a matter of those "#ifdef WIN32" type conditions, or is it more than that?


Top
 Profile  
 
PostPosted: Tue Dec 02, 2008 11:09 am 
Offline

Joined: Tue Jul 08, 2008 2:37 am
Posts: 181
Hi,

long time ago I'd the same idea, I've tested out many different operating systems including SkyOS, Haiku, OpenBSD and much more. On my operating system trip, the official 3D driver supported ones like FreeBSD and Solaris had at anytime a very special status for me, but for now I've chosen to go the Apple way ... I've no more time to proceed and maintain another Raydium operating system port, but I'll try to help you if you want to start it.

I'm sorry, I've lost my FreeBSD crystal ball :roll:, but as far as I can judge this situation it should be not so much changes needed as for example for the Windows or Mac OS X port. I dare say that we can use much parts from the GNU/Linux target, especially the X11 routines. Not really sure about the RTC, but there should be something similar available. For the joystick support we could use some BSD code from PLIB.

First step should check if all dependencies used by Raydium are available for your target operating system.
Mac OS X dependency list wrote:
JPEG 6b http://ijg.org/
Build options: --disable-shared

Cal3D 0.11.0 http://home.gna.org/cal3d/
Build options: --disable-shared --enable-static

libIntl from GetText 0.17 http://gnu.org/
Build options: --disable-shared --disable-java --disable-native-java --disable-csharp --without-emacs

libVorbis 1.2.0 http://xiph.org/
Build options: --disable-shared --disable-docs --disable-oggtest

FreeALUT 1.1.0 http://openal.org/
Build options: --disable-shared

PHP 5.2.6 http://php.net/
Build options: --disable-shared --enable-embed=static --with-zlib --enable-ftp --enable-static=zlib --with-curl --disable-simplexml --disable-xmlreader --disable-xmlwriter --enable-soap --without-iconv

libOgg 1.1.3 http://xiph.org/
Build options: --disable-shared

GLEW 1.5.0 http://glew.sf.net/
Build options: default

ODE 0.10.0 http://ode.org/
Build options: --disable-shared --disable-double-precision --disable-demos
Please also read the related wiki articles and perhaps the (GNU/Linux) configure script will aspire you in this topic.

mdg583 wrote:
... how hard ... just a matter of those "#ifdef WIN32" type conditions, or is it more than that?
Just try to do it! It's possible to port Raydium and accordingly also ManiaDrive to FreeBSD. In the first step you should check the dependencies as written above. Second step should concentrate on a compilable Raydium library using preprocessor directives wherever needed. Ignore some parts from the engine using e.g. "#ifndef __FreeBSD__", like the Live API and joystick support for now, that don't want to compile. Final step should implement missing parts of the engine under your target operating system.

Best regards,
st


Last edited by st on Wed Feb 15, 2012 6:42 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Dec 06, 2008 12:24 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I think I will give this a bit of a try in my free time. (on the weekend). When I run into difficulty (which I'm sure I will) I might ask for some more advice.

thanks for your response.

Would you suggest I start with the unstable or stable version?

Matthew


Top
 Profile  
 
PostPosted: Sat Dec 06, 2008 11:16 am 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

I think that dependency are the same for stable and unstable, so it's not a problem.

Good luck :D

have a nice day.
Ouille


Top
 Profile  
 
PostPosted: Sat Dec 06, 2008 3:41 pm 
Offline

Joined: Tue Jul 08, 2008 2:37 am
Posts: 181
You're welcome. You're pleased to ask questions, so we can try to help you on this, wherever we can.

As ouille said, it shouldn't matter which version you specify. Personally I'd always use and stay at the latest revision and follow the trunk commits, because it's easier to get help from others and it could also a little bit easier to make a patch based on the current revision.

Good luck and have fun! Feel free and don't hesitate to ask questions, I'd really like to see Raydium going FreeBSD.


Top
 Profile  
 
PostPosted: Mon Dec 15, 2008 1:47 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I have a few questions about how to correctly do things. This may show how little I know about this stuff.
Also, mania drive works about 99% in the linuxulator in freebsd. So I don't know how useful it is to compile it in freebsd. I know I would like it, anyway.

Here are some questions:

- include and library directory: does it need to be explicitly set every time?
I've had to add '-I/usr/local/include' and '-L/usr/local/lib' to all gcc commands, since files like this are stored in /usr/local in freebsd.
What is the best way to deal with this? Is it to use something like this: export C_INCLUDE_PATH='/usr/local/include'? Or to add the -L/usr/local/lib -I/usr/local/include options to gcc commands?

- do I need to download the latest version of php and ode for raydium? Or can I just try to use the ode and php that is already available for freebsd? (from the ports). Chances are ode in the ports will be a little outdated, but I would guess freebsd would try to keep php very up to date.
The ports versions are: php 5.2.8, ODE 0.9, curl 7.18.0.

When trying to run the raydium makefile, it says: make: don't know how to make raydium/compile/background.o. Stop. That is from this line in the makefile:
Code:
raydium/compile/%.o: raydium/%.c $(HEADERS)
   @mkdir -p $(COMPILE_DIR)
   @echo "Creating: $@"
   @$(CC) $(COMPILE_OPTIONS) $(CFLAGS) -o $@ -c $< $(INCLUDE_PATH)


I was not able to make this inference rule work for me, but the following works. Is this okay?

Code:
$(OBJECTS): $(@:raydium/compile/%.o=raydium/%.c) $(HEADERS)
   @mkdir -p $(COMPILE_DIR)
   @echo "Creating: $@"
   @$(CC) $(COMPILE_OPTIONS) $(CFLAGS) -o $@ -c $(@:raydium/compile/%.o=raydium/%.c) $(INCLUDE_PATH)


Matthew


Top
 Profile  
 
PostPosted: Mon Dec 15, 2008 1:58 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
Oh yeah, here are some of the ports versions of the programs you specified above. php is a newer version than required. The ports version of ode and GLEW are older than required. All the others match. I don't know what options were used in compilation. i could figure this out, I suppose, if it is important.

Here are the versions:
jpeg 6b:
cal3d 0.11.0
gettext 0.17
libvorbis 1.2.0
freealut 1.1.0
libogg 1.1.3

php 5.2.8

GLEW 1.4.0
ODE 0.9


Top
 Profile  
 
PostPosted: Mon Dec 15, 2008 3:54 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I got a little further. It was pretty easy to add #ifndef __FreeBSD___ in many of the places there is #ifndef __APPLE__, whereever the make of raydium failed. So now I have a compiled libraydium.so, and am trying to see if it is usable.

I have a file like this:

Code:
#include "raydium/index.c"

int main(void) {
   int test;


   test = raydium_random_i(10,50);

   if(0) glVertex3f(0,0,0); return 0;
   
}


And I am trying this on it:

Code:
gcc -DFORCE_LIBRAYDIUM -g test.c -Wall -o test.bin -L/usr/local/libexec/apache22/ -L/usr/home/matt/raydium/raydium-2008-12-14/ -lraydium -I/usr/home/matt/raydium/raydium-2008-12-14/ -lGL -I/usr/local/include/php/main -I/usr/local/include/php/ -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -L/usr/local/lib -L/usr/X11R6/lib


And I am getting this error:

/usr/bin/ld: warning: libphp5.so, needed by /usr/home/matt/raydium/raydium-2008-12-14//libraydium.so, not found (try using -rpath or -rpath-link)
/var/tmp//ccXPLwgS.o(.text+0x71): In function `main':
/usr/home/matt/work/test.c:7: undefined reference to `raydium_random_i'


Right now I am just focusing on the fact that libraydium.so is failing to link to libphp5.so. This may have to do with the fact that I did not have raydium fetch and compile a new version of php, but am trying to use the ports version.
The libphp5.so is in this location: /usr/local/libexec/apache22/. I am not sure why it is here, rather than the standard /usr/local/lib. It is accompanied by a bunch of mod_*.so files. The line '-L/usr/local/libexec/apache22/' above did not help.
Any ideas? Is this a problem in how libraydium.so was compiled?

Thanks for any help.


Top
 Profile  
 
PostPosted: Mon Dec 15, 2008 3:10 pm 
Offline

Joined: Tue Jul 08, 2008 2:37 am
Posts: 181
Gladly to see that you're on it - working hard to port Raydium to FreeBSD. 8)

I know there are ways to execute GNU/Linux binaries on FreeBSD, but let's focus on the native part. Libraries you've installed in a non standard directory, which should be at some common places like e. g. "/usr" and "/urs/local", must be given to the compiler and linker commands. You've also the possibility to create symbolic links or to export the necessary flags, but I'd normally prefer the way to pass the options to the commands.

As mentioned above you should check the configure script which comes with Raydium. Perhaps it'll be useful to get this script running under FreeBSD, because it'll check the availability of the libraries and install some required libraries in the right directories with the required build options. Using the configure script you can see, that on the GNU/Linux target the stable version of ODE is always 0.7 and the latest snapshot version of PHP is always 5.2. The dependency list above is an example to see what is used under Mac OS X. You can use your preferred port system to get the needed packages, but be sure to obtain them with at least the build options that Raydium requires. For example ODE needs to be build without double precision, so be sure that it was build using single precision. That is one reason I've posted the dependency list with the build options, but the list doesn't include the minimum library versions required. Using the versions included within the list works and using lower or higher versions could work. So, the libraries you've posted should work, regarding they were build with the options needed by Raydium. There are also port systems available for Mac OS X, e. g. MacPorts, but I'm building the needed libraries myself manually to have maximum control over the build options.

Regarding to your modification on the Makefile, I can only say that you have to modify whatever needed to reach our goal, to get Raydium natively running under FreeBSD. Good job! :D

While reading your last post, I've to think about the PHP module for Apache. I don't really know if you can use the Apache module version of PHP for Raydium. To exclude this issue, you're pleased to try a method written above. To get the configure script up and running or to build the library manually yourself from scratch, to obtain a new, adapted version of PHP which exactly matches the Raydium requirements.
Perhaps it'll be easier to make tests, using (modified versions of) the GNU/Linux compile scripts and some "official" test files like e. g. "./odyncomp.sh test6.c".


Top
 Profile  
 
PostPosted: Sat Dec 20, 2008 11:29 pm 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I've found a problem was that I was trying to statically link the file libphp.so, which is a dynamic library, rather than a libphp.a file. But libphp.a isn't build by php by default - the mania drive configure script gave the option for it(--enable-embed=static --with-zlib --enable-static=zlib).

Just to try to get things working, I've modified the ports version of php to have some of the options in the configure script, including those above.)

-- now test6.c compiles, but running it gives a segfault...

I am a bit wary of just getting and compiling php and ode, because to do so requires a bunch of patched, which are provided by the ports system (as far as I can tell.)


Top
 Profile  
 
PostPosted: Mon Dec 22, 2008 1:00 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I've started to try using gdb to find out why it is segfaulting and I was wondering if you could help me with something?

I am sure the segfault I mentioned above had nothing to do with libraydium or my test program - it had to do with the dynamicly linked libraries. (I tried compiling a failsafe .c file into a library with the raydium compile options and then linking to it with a test program, and it failed the same way).

So after this I made an empty program and compiled it against all the shared libraries libraydium is compiled against, and get the following:
Code:
gcc test.c -o test.bin -L/usr/X11R6/lib/ -L/usr/local/lib /usr/local/lib/libode.a /usr/ports/lang/php5/work/php-5.2.8/libs/libphp5.a -lGL -lGLU -lXinerama -lm -ljpeg -lopenal -lalut -lvorbis -lvorbisfile -logg -lcrypt -lz -lcurl -lxml2 -lGLEW

/usr/bin/ld: warning: libm.so.3, needed by /usr/X11R6/lib//libGL.so, may conflict with libm.so.5


It seems my nvidia drivers installed a compat5x package which contains freebsd5 libraries for compatability, and places them in /usr/local/lib/compat (link, same as below). So I have 2 versions of libm.so.5: one in /usr/lib, and one in /usr/local/compat/libm.so.3.

Now here is my question: how to I specify to the compiler to try to link raydium against /usr/local/compat/libm.so.3 rather than /usr/lib/libm.so.5? Or is this a bad idea?

On the other hand, it could be this is not what is causing the segfault.This seems more likely to me right now.

I think some other of the linked libraries depend on libm.so.5 - if I remove -lm in the above test, ldd shows the program is still lining to /usr/lib/libm.so.5. Some people mention this issue here.

If it helps, here is a backtrace of the segfault, from gdb:

Code:
#0  0x49c962c2 in pthread_mutexattr_setkind_np () from /lib/libthr.so.3
#1  0x48f010c3 in _nv000007gl () from /usr/local/lib/libGL.so.1
#2  0xbfbfe6c0 in ?? ()
#3  0x00000002 in ?? ()
#4  0x0000000a in ?? ()
#5  0x48f01130 in _nv000007gl () from /usr/local/lib/libGL.so.1
#6  0x48f01100 in _nv000007gl () from /usr/local/lib/libGL.so.1
#7  0x00000000 in ?? ()
#8  0x48079950 in ?? ()
#9  0x493832d0 in _nv001238gl () from /usr/local/lib/libGLcore.so.1
#10 0xbfbfe728 in ?? ()
#11 0x4965509b in _nv000387gl () from /usr/local/lib/libGLcore.so.1
#12 0x00000000 in ?? ()
#13 0x48079950 in ?? ()
#14 0xbfbfe8b8 in ?? ()
#15 0x48f18dff in _init () from /usr/local/lib/libGL.so.1
#16 0xbfbfe728 in ?? ()
#17 0x48070734 in ?? () from /libexec/ld-elf.so.1
#18 0x4804e50c in dlsym () from /libexec/ld-elf.so.1
#19 0x4804f7e9 in dlopen () from /libexec/ld-elf.so.1
#20 0x4804a44e in ?? () from /libexec/ld-elf.so.1


Thanks for any help. I guess I will keep trying to figure out what is happening.


Top
 Profile  
 
PostPosted: Mon Dec 22, 2008 1:13 am 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I think I am going to leave this for today, but the following:

Code:
gcc test.c -g -o test.bin -L/usr/X11R6/lib/ -L/usr/local/lib -lopenal -lGLEW


run on this test.c:
Code:
int main(void) {
   int test;

   test = 5;
   return 0;

}


builds, but when run it fails with this backtrace:

Segmentation fault: 11 (core dumped)
Code:
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 100162]
0x482082c2 in pthread_mutexattr_setkind_np () from /lib/libthr.so.3
(gdb) backtrace
#0  0x482082c2 in pthread_mutexattr_setkind_np () from /lib/libthr.so.3
#1  0x482d70c3 in _nv000007gl () from /usr/local/lib/libGL.so.1
#2  0xbfbfe6c0 in ?? ()
#3  0x00000002 in ?? ()
#4  0x0000000a in ?? ()
#5  0x482d7130 in _nv000007gl () from /usr/local/lib/libGL.so.1
#6  0x482d7100 in _nv000007gl () from /usr/local/lib/libGL.so.1
#7  0x00000000 in ?? ()
#8  0x480795b0 in ?? ()
#9  0x486ea2d0 in _nv001238gl () from /usr/local/lib/libGLcore.so.1
#10 0xbfbfe728 in ?? ()
#11 0x489bc09b in _nv000387gl () from /usr/local/lib/libGLcore.so.1
#12 0x00000000 in ?? ()
#13 0x480795b0 in ?? ()
#14 0xbfbfe8b8 in ?? ()
#15 0x482eedff in _init () from /usr/local/lib/libGL.so.1
#16 0xbfbfe728 in ?? ()
#17 0x48070734 in ?? () from /libexec/ld-elf.so.1
#18 0x4804e50c in dlsym () from /libexec/ld-elf.so.1
#19 0x4804f7e9 in dlopen () from /libexec/ld-elf.so.1
#20 0x4804a44e in ?? () from /libexec/ld-elf.so.1


Removing either of -lopenal or -lGLEW make it work fine.


Top
 Profile  
 
PostPosted: Fri Dec 26, 2008 10:13 pm 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I put #ifndef NO_SOUND_DEBUG around every call to a function in sound.c, and wrapped it around all of sound.c. Then I commented out all calls to sound functions in test6.c, built raydium without -lopenal or -lalut, and everything else seems to be working!

I am going to post the openal and libGL linking problem on nvidia forums - I am wondering if their libGL is at fault.

Matthew


Attachments:
File comment: Screenshot of test8.c
Screenshot-test Viewports.jpg
Screenshot-test Viewports.jpg [ 51.41 KiB | Viewed 48383 times ]
Top
 Profile  
 
PostPosted: Fri Dec 26, 2008 11:56 pm 
Offline

Joined: Sun May 04, 2008 3:40 am
Posts: 27
Location: Canada
I commented out all raydium_sound functions from mania_drive.c - and it is working for me too.

It works exactly the same as in the linuxulator. It has an occasional lag (about .1 to .5 seconds every 4 or 5 seconds). It shows a much lower fps than in the linuxulator - maybe it could easily be that the linuxulator version doesn't show the fps right?

In the linuxulator it shows 500 fps. The one I have compiled in freebsd shows 100 fps.
It could also be that the linux binary version I have is the stable one that was released, and the compiled version is the unstable version.


Attachments:
File comment: mania drive screenshot
Screenshot-ManiaDrive 1.3custom.jpg
Screenshot-ManiaDrive 1.3custom.jpg [ 14.34 KiB | Viewed 48379 times ]
Top
 Profile  
 
PostPosted: Thu Jan 01, 2009 9:34 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Nice job ! A good start for some "official" Raydium BSD port ? :)

You're right about the FPS counter: it may report some very strange results under certain circumstances when timers are "disturbed", and it's very common with VM/emulation.

You may also have a different 3D driver setting about VBL synchronisation, so your native version of ManiaDrive waits for VBL and is limited to 100 Hz (your screen frequency ?)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group