Compiling bsnes on Linux

Announce new emulators, discuss which games run best under each emulator, and much much more.

Moderator: General Mods

Post Reply
xamenus
Veteran
Posts: 907
Joined: Fri Jul 30, 2004 12:26 am

Compiling bsnes on Linux

Post by xamenus »

Or more specifically, Xubuntu. I can't seem to find any documentation or instructions anywhere that explain how to compile it. Recent versions should compile, shouldn't they?

After running make in the ui directory, I get the following error:

Code: Select all

g++   main.cpp
In file included from main.cpp:3:
../base.h:33:4: error: #error "unsupported processor"
In file included from ../base.h:36,
                 from main.cpp:3:
../lib/libbase.h:44:16: error: io.h: No such file or directory
In file included from ../base.h:37,
                 from main.cpp:3:
../lib/libsort.h:34:8: warning: extra tokens at end of #endif directive
main.cpp:34:4: error: #error "unsupported platform"
../lib/libbase.h: In function ‘int ftruncate(FILE*, long int)’:
../lib/libbase.h:393: error: invalid conversion from ‘int’ to ‘FILE*’
../lib/libbase.h:393: error:   initializing argument 1 of ‘int ftruncate(FILE*, long int)’
make: *** [main.] Error 1
Can anyone help? Thanks in advance.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

You're not going to get anything recent to compile.

There may have been one release a while back (I don't fully remember) which compiled on Linux. The rest of the time you needed one of my patched releases or a patched WIP.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
xamenus
Veteran
Posts: 907
Joined: Fri Jul 30, 2004 12:26 am

Post by xamenus »

OK, that explains it then. I managed to compile 0.016 on your site just fine.
byuu

Post by byuu »

You hit #error "unsupported processor", so you won't be able to compile anything. This will only work with an x86 processor, if you have that, then be sure to use the included makefile. You need to specify a target platform. x-sdl or x-gtk-sdl or something like that, I believe, will work. The GTK+ one still has no input support. I thought I already #ifdef'd <io.h>, but I'll do so again. You can comment that line out, it's only needed for Windows, apparently. As for ftruncate, I don't know how to fix that one yet. It's unused in bsnes at least, so you can just delete the function.

I'm planning on merging in libui, so the next release should build cleanly on 32-bit Linux/BSD, as well as have a fully functional GUI. No idea how I'm going to get input working yet, though.

Sorry for the inconvenience.
xamenus
Veteran
Posts: 907
Joined: Fri Jul 30, 2004 12:26 am

Post by xamenus »

I commented out those things in the libbase.h file, ran "make PLATFORM=x-gcc-sdl" and still got a few errors. I could post them if you want, otherwise I'll just wait till the next release.

Thank you for your help, though.
Last edited by xamenus on Wed Jan 03, 2007 7:11 pm, edited 1 time in total.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

You won't get around the ftruncate errors without a bit of code rewriting.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

So, GCC ftruncate takes an open file handle, eg FILE*, but Windows' _chsize takes fileno(FILE*) ?
I guess I can #ifdef the ftruncate function to only exist on Windows, and wrap it around _chsize. Sound good?
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 told you before that ftruncate and chsize are identical and both take a file descriptor. You for some reason made a function called ftruncate which takes a FILE *. Overloading a built in function isn't a good idea.

Prototypes:
int ftruncate(int fd, off_t length);
_CRTIMP int __cdecl chsize (int, long );
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

Didn't see this post earlier for some reason.

Changed to int fresize(FILE*, long), thank you.
Post Reply