Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
516 stars 133 forks source link

Can´t compile #42

Closed khkramer closed 10 years ago

khkramer commented 10 years ago
In file included from /home/khkramer/mkxp-master/src/main.cpp:36:0:
/home/khkramer/mkxp-master/src/gl-fun.h:54:152: error: conflicting declaration ‘typedef void (* GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*)’
 typedef void (APIENTRY * GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);
                                                                                                                                                        ^
In file included from /usr/local/include/SDL2/SDL_opengl.h:80:0,
                 from /home/khkramer/mkxp-master/src/gl-fun.h:25,
                 from /home/khkramer/mkxp-master/src/main.cpp:36:
/usr/local/include/SDL2/SDL_opengl_glext.h:2182:26: error: ‘GLDEBUGPROC’ has a previous declaration as ‘typedef void (* GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, const void*)’
 typedef void (APIENTRY  *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
                          ^
make[2]: *** [CMakeFiles/mkxp.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/mkxp.dir/all] Error 2
make: *** [all] Error 2

I'm pretty new to compiling C++ programs, so could this be a mistake on my end?

Ancurio commented 10 years ago

Nope, that was my bad. Pushed a fix, can you try with latest master?

khkramer commented 10 years ago

That fixed that issue, thanks Will update this post later

hanetzer commented 10 years ago

@khkramer So, how'd it work?

khkramer commented 10 years ago

It compiled without any error.s

However I accidently compiled for Linux instead of using a cross-compiler ._.

And I can't seem to get a Cygwin or Msys2 enviroment set up correctly, they all 'break' at some point.

hanetzer commented 10 years ago

Hrm. Mayhaps I should write up a tutorial for compiling mkxp on windows under msys2. How are you trying to setup msys2?

khkramer commented 10 years ago

Nvm actually.

I've got my lubuntu vm to make me a nice windows executable :)

And then I found I build SDL_image without jpeg support..

khkramer commented 10 years ago

Alright recompiled SDL_image and now it's working.

EDIT: Got Win32API working (I think).

hanetzer commented 10 years ago

Yeah, Win32API can be used, but I think you have to require it now. Though, I'd recommend not using it, its slated for removal and will prevent you from making cross-platform games. Btw, does mkxp.exe open a console window when you use it?

khkramer commented 10 years ago

Yes it does open a console window.

I currently have no other option to use Win32api till I port all the functions to ffi.

khkramer commented 10 years ago

Also I can't seem to be able to find or use Zlib.

hanetzer commented 10 years ago

Do you get into the game proper? If so, you have access to zlib (the scripts are zlib compressed within Scripts.rxdata, so if you can use those, you have access to zlib)

khkramer commented 10 years ago

It loads the scripts.rxdata yeah but is crashing because I can't use zlib in scripts and require 'zlib' doesn't work.

While in the regular rgss player I can use zlib just fine.

cremno commented 10 years ago

Zlib is not in the core. It's part of the standard library.

How you deal with that depends on how your mkxp build was linked against libruby (dynamically or statically). Either you're able to require it (that assumes extension libraries like zlib.so can be found; if not, just copy them to somewhere and add that path to $LOAD_PATH), or you need to rebuild Ruby and statically link all wanted extension (like the RGSS programmer(s) did).

hanetzer commented 10 years ago

@khkramer you can place $: << 'lib' in a script, then place zlib.so from the apropriate ruby version in a folder, lib inside the game dir and require it.

EDIT: and yes, even though its a windows library, it is named *.so, and renaming it to zlib.dll doesn't work lol.

khkramer commented 10 years ago

It doesn't give an error on the require, so I assume it's loading zlib.so correctly, for some reason still can't use zlib though.

I'll try recompiling ruby.

hanetzer commented 10 years ago

@khkramer how are you attempting to use zlib? Any error output there?

khkramer commented 10 years ago
Uninitialized constant Zlib.

And I'm using it like this:

ZLib::Inflate.inflate(data)
cremno commented 10 years ago

Always copy error messages (if possible)! Did you write Zlib or ZLib in your code? It's Zlib with a lowercase L. And try printing $LOADED_FEATURES. If it was successfully loaded, this array contains a path to the library.

khkramer commented 10 years ago

@cremno

Turns out somewhere in the code it was indeed spelled as ZLib, it took me so long to notice it .. Thanks.

hanetzer commented 10 years ago

@khkramer yeah, typos can kill you if you're not careful :P

Ancurio commented 10 years ago

Can we close this issue?

khkramer commented 10 years ago

Yes, no compilations issues anymore so..