Author Topic: Problems compiling code under Code::Blocks  (Read 2935 times)

Troglodyte (OP)

  • Posts: 3
Problems compiling code under Code::Blocks
« on: October 24, 2014, 06:36:20 pm »
Hi,
I am trying to port GLtron (www.gltron.org) over to the GCW Zero,
but I am experiencing some difficulty compiling the code.

I am using Code::Blocks 13.12 under PCLinuxOS, along with the latest GCW Zero Toolchain (2014-08-20).
Here are the errors I receive when compiling:
Code: [Select]
||=== Build: Debug in GCW-GLtron (compiler: GCW Compiler) ===|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lapi.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lcode.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/ldebug.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/ldo.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lfunc.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lgc.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lib/lauxlib.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lib/lbaselib.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lib/ldblib.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lib/liolib.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lib/lmathlib.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lib/lstrlib.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/llex.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lmem.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lobject.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lparser.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lstate.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lstring.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/ltable.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/ltests.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/ltm.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lundump.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lvm.o||No such file or directory|
 obj/Debug/GCW-GLtron/obj/Debug/lua/src/lzio.o||No such file or directory|
 /root/Documents/projects/gltron-0.70/lua/src/liblua.a||No such file or directory|
 /root/Documents/projects/gltron-0.70/lua/src/lib/liblualib.a||No such file or directory|
||=== Build failed: 26 error(s), 0 warning(s) (0 minute(s), 5 second(s)) ===|

Any help would be greatly appreciated.

pcercuei

  • ***
  • Posts: 1429
    • My devblog
Re: Problems compiling code under Code::Blocks
« Reply #1 on: October 24, 2014, 07:23:22 pm »
First thing, you're compiling Lua. What's the point? We have already that in the rootfs, a faster version even (LuaJIT).
Second, why the hell are you compiling as root?

ruffnutts

  • ****
  • Posts: 2680
Re: Problems compiling code under Code::Blocks
« Reply #2 on: October 24, 2014, 07:42:49 pm »
Cool.. love GLtron awesome game ;D

zear

  • * Moderator
  • Posts: 2379
Re: Problems compiling code under Code::Blocks
« Reply #3 on: October 25, 2014, 09:17:26 am »
These are linking issues to objects within your source code directory (included lua fails to compile with an error earlier in the log?). This shouldn't have anything to do with our toolchain. Revise your building script/Makefile. Secondly, do as pcercuei said and use the lua library that comes with our toolchain.

Troglodyte (OP)

  • Posts: 3
Re: Problems compiling code under Code::Blocks
« Reply #4 on: October 29, 2014, 01:57:00 am »
Thanks for the replies.
First of all, I am no longer compiling as root.
Second of all, I am no longer compiling Lua, and am using the lua library included in the toolchain.

The help I have received so far has gotten me further, but I am still having some problems compiling.
I know these errors should have nothing to do with the toolchain itself, and they are probably just a result of me not setting something up correctly in CodeBlocks, as I am still new to the CodeBlocks IDE, so any insight would be helpful.

Here are the errors I now receive:
Code: [Select]
||=== Build: Debug in GCW-GLtron (compiler: GCW Zero Compiler) ===|
obj/Debug/nebu/audio/Source.o||In function `Sound::Source::Source()':|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_CreateMutex'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_CreateMutex'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_CreateSemaphore'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_CreateSemaphore'|
obj/Debug/nebu/audio/Source.o||In function `Sound::Source::~Source()':|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_DestroyMutex'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_DestroyMutex'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_DestroySemaphore'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source.cpp|| undefined reference to `SDL_DestroySemaphore'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source3D.cpp|174|undefined reference to `__assert_fail'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/Source3D.cpp|174|undefined reference to `__assert_fail'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|14|undefined reference to `__assert_fail'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|14|undefined reference to `__assert_fail'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|17|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|17|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|21|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|21|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|30|undefined reference to `SDL_MixAudio'|
obj/Debug/nebu/audio/SourceCopy.o:/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceCopy.cpp|30|more undefined references to `SDL_MixAudio' follow|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|27|undefined reference to `SDL_SemWait'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|27|undefined reference to `SDL_SemWait'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|34|undefined reference to `Sound_FreeSample'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|34|undefined reference to `Sound_FreeSample'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|41|undefined reference to `SDL_SemPost'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|41|undefined reference to `SDL_SemPost'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|54|undefined reference to `SDL_RWFromFile'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|54|undefined reference to `SDL_RWFromFile'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|63|undefined reference to `Sound_NewSample'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|63|undefined reference to `Sound_NewSample'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|67|undefined reference to `Sound_GetError'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|67|undefined reference to `Sound_GetError'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|88|undefined reference to `Sound_FreeSample'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|88|undefined reference to `Sound_FreeSample'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|94|undefined reference to `SDL_SemTryWait'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|94|undefined reference to `SDL_SemTryWait'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|108|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|108|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|115|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|115|undefined reference to `SDL_MixAudio'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|117|undefined reference to `SDL_MixAudio'|
obj/Debug/nebu/audio/SourceMusic.o:/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|117|more undefined references to `SDL_MixAudio' follow|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|127|undefined reference to `SDL_SemPost'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|127|undefined reference to `SDL_SemPost'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|142|undefined reference to `Sound_Decode'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|142|undefined reference to `Sound_Decode'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|161|undefined reference to `SDL_SemWait'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|161|undefined reference to `SDL_SemWait'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|179|undefined reference to `SDL_SemPost'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceMusic.cpp|179|undefined reference to `SDL_SemPost'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceSample.cpp|28|undefined reference to `SDL_RWFromFile'|
/home/coryadams/Documents/projects/gltron-0.70/nebu/audio/SourceSample.cpp|28|undefined reference to `SDL_RWFromFile'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 2 warning(s) (0 minute(s), 27 second(s)) ===|

Please let me know if you have any questions, and again, thanks for the support.
« Last Edit: October 29, 2014, 02:07:38 am by Troglodyte »

Senor Quack

  • *
  • Posts: 215
Re: Problems compiling code under Code::Blocks
« Reply #5 on: October 29, 2014, 05:07:31 am »
First off, you've picked a difficult port for a beginner because GLTron is meant for OpenGL and not OpenGLES.  That means you will either need to convert it all to OpenGLES yourself, or you should base your port on another port that has already done so. 
I would guess your best bet is here:  https://github.com/lunixbochs/pandora-gltron
or here:   https://github.com/olegk0/gltron-0.7_GLES

Also, compiling larger projects made by someone else under Code::Blocks can be a pain because the original game is meant to use autoconf to generate a Makefile for you and have that compile it.   Or, they'll provide a project file for Visual C+ or something.  They rarely ever give you a Code::Blocks project file. 

You are still going to need to do a good bit of work to get those GLES ports to work on GCW, and I have a feeling you're not quite there yet experience-wise.   Especially because the resolution of the GCW is so low and also because the Pandora GLES port uses X11 to create a GLES context.  You will need to adapt that code to make a raw framebuffer context.   Sigh.. Regardless, here's the next steps...

Follow all the directions on this GCW Wiki page first:    http://wiki.surkow.com/Tutorials:CodeBlocks

At the bottom, it instructs you to add libraries to the Linker Settings tab..  From looking at GLTron's source code, I can tell you'll have to at least add the following libraries to it:
SDL
pthread
GLES_v1_CM
EGL
SDL_sound
png
z
luajit-5.1

I know other people might say otherwise, but I found I had to add this include directory to the Compiler sub-tab under the  "Search Directories" tab to get things to build, in addition to the one you already added for SDL:
/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/
« Last Edit: October 29, 2014, 06:10:51 am by Senor Quack »

Troglodyte (OP)

  • Posts: 3
Re: Problems compiling code under Code::Blocks
« Reply #6 on: October 30, 2014, 02:32:29 am »
Quote
First off, you've picked a difficult port for a beginner because GLTron is meant for OpenGL and not OpenGLES.
Yea, I guess I did. I knew that it was programmed for OpenGL, and not OpenGL ES, but I didn't really realize they weren't cross compatible. My only experience with any OpenGL at all, has been creating an FPS Demo under Windows using Visual Studio, so I am not a complete beginner, but I have no experience with OpenGL ES, and have never used CodeBlocks before this.

I may have 'bitten off more than I can chew' but I appreciate the thorough reply.
Reading over your response, I noticed you pointed me to two code repositories,
the first one, was obviously a OpenGL ES port for use under the Pandora device, and the other what appears as a more general OpenGL ES port for Android? I assumed that it was for Android since it says that it as tested on an mk808m (an Android powered minipc). But then it states that it was merged with the first code repository for Pandora that you listed earlier. Do they both rely on X11, and / or is there a reason to choose one release over the other? Sorry if this is a 'newbie' question, but I wanted to have this clear before doing anything else.


Quote
Follow all the directions on this GCW Wiki page first...
Yep, I did all of that earlier, but thanks for making sure.

I'm not sure how far I will attempt to continue this, as I was mainly going to try porting GLtron as a 'learning experience', I just didn't realize that it was going to be that difficult of a project to take on.

Thanks again.
« Last Edit: October 30, 2014, 02:52:39 am by Troglodyte »

Senor Quack

  • *
  • Posts: 215
Re: Problems compiling code under Code::Blocks
« Reply #7 on: October 30, 2014, 10:00:18 am »
Reading over your response, I noticed you pointed me to two code repositories, the first one, was obviously a OpenGL ES port for use under the Pandora device, and the other what appears as a more general OpenGL ES port for Android? I assumed that it was for Android since it says that it as tested on an mk808m (an Android powered minipc). But then it states that it was merged with the first code repository for Pandora that you listed earlier. Do they both rely on X11, and / or is there a reason to choose one release over the other? Sorry if this is a 'newbie' question, but I wanted to have this clear before doing anything else.

I'm not sure which one you should choose, as I haven't looked far into it, only posted the two topmost google return search results.  However, I do know that the author of the Pandora GLTron port is also the maintainer of GLshim which often allows unmodified OpenGL programs to run directly on OpenGLES devices.  He's Lunixbochs on the Pandora forums and goes by _aegis_ on IRC chat in Freenode #gcw and #openpandora. 

If you need an example of how to set up an OpenGLES context on the GCW Zero, there's a simple example on my github page: https://github.com/senquack/lineloop      (Much credit to Pickle for example code I adapted from)  One big thing to take note of is that you do not initiate the SDL video subsystem like a normal SDL program would.  You do initialize the other SDL subsystems that you need, like audio and input. Oddly, you still use SDL_SetVideoMode() to set the screen dimensions and depth, despite having not initialized the SDL video subsystem.

You're still gonna have quite a bit of work ahead of you to make a good GCW port, though. Especially if you're not familiar that much with Linux. Good luck, though, looks like a cool game. If you decide not to do it in the end,  let us know here and someone else maybe will try to get on top of it.
« Last Edit: October 30, 2014, 10:06:35 am by Senor Quack »