Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / cSpinLock problem when building Tier 2

Author
Message
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 16th Jan 2014 23:31
Hi,

I'm just moving on from using VS2008 to trying to compile a Tier 2 app with Eclipse.

Unfortunately I get the following error when trying to compile template_android - and really have struggled to advance any further:

Using eclipse to build the project (I get the same result using ndk-build in a Cygwin terminal):

Quote: "
C:\Android\NDK\android-ndk-r8d\ndk-build.cmd all
"Compile arm : template <= main.c
"Compile++ arm : template <= Core.cpp
In file included from jni/../../../common/include/agk.h:13:0,
from jni/Core.cpp:1:
jni/../../../common/include/cImage.h:137:4: error: 'cSpinLock' does not name a type
make: *** [obj/local/armeabi/objs/template/Core.o] Error 1"


I suspect it's a 'fairly' simple error based on an incorrect path/setting that I have overlooked - but after several frustrating hours I'm at a loss as to where to move next.

I have as a directory structure:

c:Android
--IDE -- all the AppGameKit stuff here copied from agk v108 install
--eclipse
--SDK
--NDK
----android-ndk-r8d

Any suggestions as to what to try next - gratefully received

Thanks

Martin
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 19th Jan 2014 11:15
Well several steps forward:

After a reinstall of everything & changing to using apps/template_android instead of templates/template_android - compilation has progressed (ndk-build does it's magic) and now I have only 35 errors - beginning with
Quote: "DialogListener cannot be resolved to a type"

and progressing through various facebook errors - so I now need to install the facebook sdk? My first attempt has failed (the sdk manager doesn't seem to include this - & I'm not sure eclipse is seeing it correctly after my attempts) so it's back to the forums for some more advice!

Any pointers gratefully received as ever.. & when I finally get this up and running I'll post an up to date step by step guide that works for Tier 2 apps (when not if!)
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 20th Jan 2014 19:24
Managed to compile interpreter_android - by adding the requisite jar files from the Facebook sdk. It even ran on the emulator (a small cheer) - joy was short lived - as opening main.c caused a slew of errors to appear (includes not found etc).

So I can repeatedly compile the one project (others have so far proved elusive) - but not to great effect. The process has been incredibly frustrating - there are several guides, but following them hasn't worked (and looking through the boards I see that other folk are in the same boat with Tier 2)

Is anyone working with Tier 2 - and please would they share their wisdom on how to get the build process (there really should be a straightforward guide in the AppGameKit docs - working through forum messages isn't ideal for this):

Other projects now give:

Quote: "
obj/local/armeabi/v7a/objs/android_native_app_glue/android_native_app_glue.o.d:1
: *** target pattern contains no '%'. Stop.
"


and I'm apt to cut my losses and convert my project to Tier 1 Basic.
The build process really shouldn't be this difficult (take Basic4Android as an example of how it can be done) - I'm hoping Version 2 of AppGameKit can improve on this......
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jan 2014 17:09
I have been working in Tier 2 for a while and have had no problems with Android.

But, if you plan to be working in Tier 2, you wouldn't be using the interpreter_android project as the basis for your project.

I recently relocated to Anchorage and am living in a hotel without my regular computer. I haven't tried my Android setup on my travel computer yet. If I get the chance after work tonight, I will see if my setup works and then I might be able to help.

I never saw the error you mention in your original post. What version of AppGameKit are you working with?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 21st Jan 2014 19:09
Hi AncientLady,

How is life in Anchorage - saw your recent posts about the imminent move in other threads - hope you enjoy the new life!

I'm using v108.19 - interpreter_android was the only template app I managed to compile (after trying the various template_android etc on offer in apps (and templates)) & I hoped that once one app had compiled it would become 'easier' to move to others.

My own app is based on template_android - but needless to say, compilation failed
I still suspect it's a simple setup problem - I just managed to compile template_android - but attempting to run this gives:

Quote: " android library projects cannot be launched"


Same problem, however, - it builds 'ok' but when I open main.c (or template.h etc)all of the includes are marked as errors. AGKHelper.java has errors with redefinition of Facebook class.
agk/ide/common/include is in the include path (initially as relative path, and I've just added it as an absolute path too - but to no avail)
I'm fairly new to eclipse (though I've used it to compile bits for Arduino) but not to c++.

Martin
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jan 2014 06:04
I have finished my second day at my new job and things are going fine. My monitors arrived today and I now have some proper real estate to work with. Tomorrow I will get my Mac Mini set up.

Hopefully, this weekend I can do some general cruising tourist style that we have always done on our visits. I want to see the mountains (which aren't quite visible from my office or hotel room). It has actually been warmer here than back in Virginia since I arrived and will stay that way for the next week.

Were you able to get <android_path>/IDE/apps/template_android to compile using the HardCodedCompileScript.bat file (with edits to point to the correct directory for your android-ndk install)?

Also, have you kept all the projects you are trying to compile in the <android_path>/IDE/apps directory? In other words, if you are in cygwin and in the project directory (under apps) and execute the command 'ls -l ../../common/include/agk.h', does it show the file or some error message?

The error message you display in the original post seems to indicate that either you don't have the project in the correct relative directory, or are missing some directories.

If you have gotten the

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 22nd Jan 2014 23:04
ls does display the file.

Still nothing will compile - the HardCoded batch file gives
Quote: "
Compile Interpreter CPP to Android BINARY

C:\Android\AGK\IDE\apps\template_android>C:\Android\cygwin\bin\bash -c "PATH=/bi
n:$PATH /cygdrive/c/Android/android-ndk-r8d/ndk-build clean"
obj/local/armeabi/objs/template/main.o.d:1: *** multiple target patterns. Stop.

C:\Android\AGK\IDE\apps\template_android>C:\Android\cygwin\bin\bash -c "PATH=/bin:$PATH /cygdrive/c/Android/android-ndk-r8d/ndk-build 2> log.txt""


and the log.txt file is
Quote: "
obj/local/armeabi/objs/template/main.o.d:1: *** multiple target patterns. Stop."


Also I notice that interpreter_android will no longer compile with:
a raft of error messages for undefined references (eg to AGK::uString to pick one at random) during linking.
In eclipse I'm back to cSpinLock problems - aaarrggghhh.

As an aside: Why is it necessary (is it necessary?) to compile things under Cygwin - when eclipse uses ndk-build to build the app?

Thanks for your time - get out there and enjoy the weekend!
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Jan 2014 17:17
Can you list the .c and .cpp files in your jni directory?

And, did you make any changes at all to any of the files in that directory?

Eclipse doesn't do the object file compilation, it does the Java side building. You shouldn't be doing anything that says 'compile' in Eclipse. Once the cygwin compile is done and the project is imported into Eclipse, you only do a 'run' to create the apk.

Maybe that is the problem.

You should probably clean the project (in cygwin and in Eclipse) and start the build from cygwin first. In Eclipse, you select your project, open the drop down from the 'Projects' (I think) menu item at the top and select 'clean' (something like that). Make sure that only the template project is selected. In the cygwin window, while in the template directory, execute ' /cygdrive/c/Android/android-ndk-r8d/ndk-build clean'.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 24th Jan 2014 09:17
Apologies if this is duplicate (and my messages are still being vetted) - broadband connection vanished last night just as I hit 'post'

jni contains:

Core.cpp
CorForApp.h
main.c
template.cpp
template.h

as well as Android.mk and Application.mk

All have nothing added or taken away...

I back with cSpinLock doesn't name a type (it's declared in WindowsNetwork.h - which is included: redeclaring (or forward decalring) it in cImage.h gives a duplicate identifier error...

Sorry - bit rushed, off to work now.
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jan 2014 22:00
If you are compiling in Android, it should not be using the WindowsNetwork.h file at all.

The CoreForApp.h file is actually not used in the build, it is actually only used in the Tier 1 compiles. It just sort of got included in that directory at some point and has persisted.

If your Android build (in cygwin or using the batch file) is somehow including it, then your setup is not correct.

'cSpinLock' is defined in AndroidNetwork.h for the Android platform.

And, again, you don't do the compilation in Eclipse. You only 'run' it in Eclipse to create the apk from the stuff created by the cygwin build.

I just cleaned and built the template_android project, added it to my Eclipse, 'ran' it and it created the apk in the template_android/bin directory without a hitch.

I suspect that your Android setup isn't quite right.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 26th Jan 2014 00:16
it's a bit odd - but cSpinLock ISN'T defined in AndroidNetwork.h (I just checked my original installation too!)- although it would seem it should be (it is defined in WindowsNetwork.h, so I probably should copy the definition across). I defined it, ok I just copied the definition of cLock - changing the names where appropriate. I know this isn't a long term solution but I'm starting to get desperate now - I'll go with 'can build' and then worry about running the app! I then get a huge list of unresolved names from the linker (ld) instead.... More evidence of an incorrect path possibly.

Incidentally - I can build & run the sample programs in the ndk directory - I was playing with moving the template_android to the sample directory and working from there.

I still have problems with 'multiple target' errors (googling this gives suggestions that gnumake 3.81 has a problem in this area (for example software.scandia.gov)- and to install 3.80 (which doesn't work - error: gnumake 3.81 or greater needed)

Martin
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Jan 2014 20:19
Don't put template_android anywhere other than in IDE/apps unless you want to play with settings to redirect where it looks for files.

Did you do any edits to things in the template_android project or elsewhere in AppGameKit specific directories?

The AndroidNetwork.h file is in IDE/platform/android/Source. If you can't find that, than it more and more appears that your Android setup is not done properly.

The WindowsNetwork.h file does not appear anywhere in the directories for the Android setup at all, not just not in the AppGameKit Android directories.

Certainly you shouldn't have to copy files/change stuff just to get the android_template project to build in cygwin.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 26th Jan 2014 22:01
Just made a major step forward.....

Instead of copying IDE directory from my the install - I did a fresh download and installed into the c:/Android directory.

Now ndk build is happy (that could be the sound of fireworks you can hear?)

- Imported into eclipse - added a couple of jar files and we are nearly there!! Now I just need to get eclipse to recognise the Nexus7 attached
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 26th Jan 2014 22:05
oops - what happened there...

Assuming my last post hasn't gone to the great hard-drive in the sky - I meant to say:

Thanks to AncientLady for all her help (she can get on with her new life again )no doubt I will be back looking for more help soon!
If anyone is interested (or even if not) I'll post the steps to get a working Tier2 compilation going as it has been a slow battle & I see from the forums that others have struggled before me...
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 27th Jan 2014 06:48
I am glad you got it working.

When you connect your Nexus 7 (I have one as well), can you access it via File Manager from Windows? (i.e. Is it visible as an external drive?)

As of Android <forget the version, but about 6 months back>, the developer's menu isn't visible immediately. If you don't see 'Developer Options' in your Settings, there is a way to make it display (it is hidden by default). Click on 'About Tablet' in Settings. Then tap on 'Build Number' five or six times (or it might be four) and it will make 'Developer Options' visible. Then you can turn on USB debugging which is necessary for Eclipse to be able to connect to it.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 27th Jan 2014 09:10
Nexus 7 now connected and running my app (changing from media device to camera on the notifications did the trick!): Well sort of, it displays the text but can't find it's media - just need to work out how to add my image/sound files correctly. Suspect (hope) it's just a case of adding them to the right directory. I'll pop them into the folder with the agk logo this evening...
mnf
7
Years of Service
User Offline
Joined: 29th Aug 2011
Location: Shetland
Posted: 27th Jan 2014 22:43
& we're away - moved all my files to the media folder & up and running. The agk libraries do allow you to create some very nice effects with very little coding... Sprites affected by gravity from scratch anyone!

Thanks again to AppGameKit Guru AncientLady for all her advice..
Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th Jan 2014 03:22
Welcome to the fun!

Happy Programming!

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2019-08-21 21:02:15
Your offset time is: 2019-08-21 21:02:15