Linux: Monkey (the binary file) not running...

Monkey Forums/Monkey Beginners/Linux: Monkey (the binary file) not running...

Derron(Posted 2015) [#1]
While the 77a-"free"-Monkey file could be executed without trouble, the one from "Pro 82b" doesn't.

Seems all needed files are existing
$ ldd Monkey
	linux-vdso.so.1 =>  (0x00007fff981fe000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0806551000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f080624d000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0806036000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0805c71000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f080679e000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f080596b000)


Ok, so I started "Ted" within the "bin"-folder ... but the "targets" are empty (only "Debug" and "Relase" could get selected).

So I went to the board and while writing this post here - I tried "./Monkey" again - and this time it started, but again with no targets in the drop down box...

I recognized "Monkey" (or "Ted") creates a folder within "bin" named "ted_linux_RonnyPC.ini" (RonnyPC is my computer name). Contained is an ini file which lists all potential targets: "" - none.

Further checks lead me to check folder permissions (as a limitation of a folder is recursively applied to subfolders). I gave the whole "MonkeyXPro82b" folder and all subfolders an widely-ranged 755 ... and now it recognized all potential targets.

I think such things should be written in the readme of the base folder. As this does not happen with the BlitzMax-downloads, I assume they are packaged differently.
Nonetheless there is no need to think of every Linux programmer remembering such small annoyances each time.

Uhm ya... felt welcomed in a warm and familar way... :-)


Derron(Posted 2015) [#2]
Ok, next step tried: installing android-dev-requirements.

At first I tried to reuse my libGDX-setup (having NDK, JDK etc installed) but this did not work

TRANS monkey compiler V1.80
Parsing...
Semanting...
Translating...
Building...
sh: 1: /bin/ant: not found
TRANS FAILED: Android build failed.
Done.


ok ... checked "ant": "JAVA_HOME not set".

Opened my ".bashrc":
export JAVA_HOME=/my/path/to/jdk_1.7
export PATH=$PATH:my/path/to/jdk/too:/my/path/to/monkeyfree


ok, adjusted the monkey path to reflect the new one (pro) - checked.
exported java_home manually, tried "ant" and got:

$ ant
Buildfile: build.xml does not exist!
Build failed


So it seems to find what it should.

Restarted Monkey/Ted - tried to build and still got the same error.
Ok ... /bin/ant is not existing, so how to change the call to /bin/ant - my ant is in /opt/apache-ant/bin/ant ...
But hey, I have an /etc/profile.d/ant.sh -- but this isn't used by Monkey too.

Ok, so I used that installer too "mxdevinstall" provided here in the forums. It installed the oracle-8-jdk and an default-installer, skipped ant etc. But re-login does not help to convince monkey of finding ant.

Ah ... and config.linux.txt ... I adjusted the paths there ... but now, again while writing a post, I just tried to append this:

ANT_PATH="/opt/apache-ant"

and restarted Monkey ... compiling now!

But aheem... I pressed "build" ... not "build and execute":

....compilation steps omitted

install:
     [echo] Installing /bla/bla.buildv82b/android_new/bin/MonkeyGame-debug.apk onto default emulator or device...
     [exec] error: device not found
     [exec] - waiting for device -


Why does a "build" try to deploy the apk to a device?

I really miss the advanced options of "intellj" here... working together with the android tools and displaying attached devices.

But at least it seems to compile now....

Edit: ok, it compiled and when my device was attached, it copied it on the device.
Hey it also executed it ... but failed.

Why doesnt monkey open the failing lines in the monkey-files?

I/[Monkey](26140): Monkey Runtime Error : length=3; index=3
I/[Monkey](26140): /bla/digmonkey/base_util_input.monkey<41>
I/[Monkey](26140): /bla/jam.monkey<163>
I/[Monkey](26140): /MonkeyXPro/modules/mojo/app.monkey<105>


Shouldnt it open up line 41 of the "base_util_input.monkey"-file ?

If I am not doing something wrong, this is really something which adds some needed convenience to development (I expect "Jungle" to handle that, but on Linux the clocks tick differently).

bye
Ron


dawlane(Posted 2015) [#3]
I can honestly say that I have never had any problems getting Monkey to work with Linux, unless a new Linux distribution is released that throws a spanner in the works.
http://www.monkey-x.com/Community/posts.php?topic=7600

Why does a "build" try to deploy the apk to a device?
That's one for Mark to answer. I'm not sure if it was meant to fire up the Android emulator is a device wasn't attached. But if the emulator is running then it deploys to that instead.


Derron(Posted 2015) [#4]
@dawlane
I tried to follow your post (when installing) and checked what it might do different to what I already had done ... even downloaded your script. Thread structure made it a bit hard to recognize what to do for "mint" and not "arch".

So sorry for not promoting your guide again - it will really do what it should.

I have to admit that "Mint" isnt perfect for devs, as upgrades (what they disencourage you to do) are not flawless (they break "mintsources" with forgetting to apend the new codenames so you cannot edit package sources via GUI anymore, or "add-add-repository" ...). But I fixed that before, so that shouldn't be an issue.

What I could imagine as "failure source" is the existence of previously installed SDK/NDK ... but even then: how? SDK was found then, JAVA_HOME was exported (which I had to do manually for libGDX too).

Only "problem" was "bin/ant" which was not found before... but now this is gone - without being sure whether config.linux.txt: ANT_PATH="/opt/apache-ant" gets evaluated by Monkey or not (because it wasnt set "empty" by default). I assume it should - because it works now :D

Edit: App build successfully - on my Android 4.3 device I get sound but no music, on another 4.3 device it plays as it should. As music and sfx are all "ogg" this will create some more headaches to fix.

bye
Ron


dawlane(Posted 2015) [#5]
Thread structure made it a bit hard to recognize what to do for "mint" and not "arch".

Sorry if it was a bit hard to follow. It had to be written as a rough guide. When you consider on how many targets that Monkey supports and what is is involved to get each software development kit installed on each distribution. There is too much information to convey with the forums limitations, with all the [][/] tags and character limited posting. It gets hard to follow when updating and there is no preview. It also doesn't help me that for some reason the links for focusing on a post always take me to the last bloody page; they never use to.

JDK Tip
One of the first things to note about the JDK, is that not all distributions can run both the 32bit and the 64bit side by side. If for example if you are using Mageia 64bit, then using the 32bit version of the JDK is completely out of the question unless you completely remove the pre-installed 64bit OpenJDK; which in turn will break a hell of a lot of the system. It's not such a problem with the Debian based distributions so far as I can tell.

Monkey on the other hand as far as I know, doesn't care as long as there is a JDK there to build the apk as it should run on any JVM as long as it isn't calling and CPU native instruction code. This brings us then to the NDK, which as far as I know is still a loose end and as to date I have never seen any information on how to use it with Monkey.

without being sure whether config.linux.txt: ANT_PATH="/opt/apache-ant" gets evaluated by Monkey or not
I believe it does, but I think that that you would be better ensuring that JAVA_HOME and ANT_HOME are exported as well as included in your path in your home directories .profile as you are trying to use a non distribution version of the JDK and ANT.


Derron(Posted 2015) [#6]
Thanks for this further going elaboration.

No I have to find out why one of my devices cannot play multiple sounds simultaneously (music + sfx). Other apps on the device do not have this problem.


Edit: HTML5-mserver has trouble with this pro-version too:
Monkey Runtime Error : Failed to start MServer

{{~~(null)~~}}


bye
Ron


dawlane(Posted 2015) [#7]
You will have to elaborate on how you are playing the music+sfx. If you are checking for states of the channels or music, then you will more than likely find that the states cannot be determined with Android. I have come across a situation where no sound is played as a result of the next sound trying to use the same channel before the previous has finished playing.

Monkey Runtime Error : Failed to start MServer
Yes I use to have this problem with the old version of Mserver. You could run a HTML5, and Ted would start the server with a browser. But would throw the error if you closed the browser and the server, and then tried to run the HTML again immediately after. Looking at the systems monitor, it appeared that the server was taking it's time shutting down. It may have had something to do with Apache running in the background, but I never bothered to investigate any further.