fpc code for Java class and Android.

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

fpc code for Java class and Android.

fredvs
Hello.

Here a easy way to translate all your fpc applications into Java applications (class).
The trick is to convert your fpc applications into native java libraries.
It works for fpc console, fpGUI and MSEgui code on Android OS too.

Here we go:

1) In your main application change this:

program myapp;

with this:

library myapp;

2) Change your main procedure:

procedure MainProc;

with this:

procedure MainProc(PEnv: pointer; Obj: pointer); cdecl;

3) At the end of code (just before end.) add this:

exports
  {Here the only-one exported procedure...}
  MainProc name 'Java_myapp_mainproc';

4) Compile your new java native library. (For Android, compile it for the same cpu as your Android device).

Ok, now to run your library, create that Java class and save it as "myapp.java":

public class myapp{

  public static native void mainproc();

  public static void main(String[] args)

  {
  System.loadLibrary("myapp");
  mainproc();
  }
}

And compile it:

# javac myapp.java

Yep, all is done.

To run your Java class+ fpc native Java library, do in console:

# java -Djava.library.path=. myapp

Here video that shows all the process:

https://sites.google.com/site/designerext/fpc_java.mp4

Fre;D





Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
On 04/08/2017 09:21 AM, fredvs wrote:
...
> Here video that shows all the process:
>
> https://sites.google.com/site/designerext/fpc_java.mp4

Thank you *very* much for that nice 3:24 6.2 MB video.  Now I need to
figure out the most *simple* way to do that on an Android phone or tablet.

Thanks,
Paul
www.ControlPascal.com


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

fredvs
> Thank you *very* much for that nice 3:24 6.2 MB video.

Thanks for the thanks ;-).  

>  Now I need to figure out the most *simple* way to do that on an Android phone or tablet.

For this, Xorg must be installed.
Take a look here:

https://blog.hamal.in/?p=15


or here:

https://github.com/csulmone/X11/tree/master/xorg-server-android

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

fredvs
> For this, Xorg must be installed.

Huh, of course only for gui applications (fpGUI or MSEgui).

For no gui console application, compile your fpc java native library for the same cpu than the one of Android.
For example RPi (but I am not sure it is the same cpu as android-devices).

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
On 04/09/2017 11:32 AM, fredvs wrote:
>> For this, Xorg must be installed.
>
> Huh, of course only for gui applications (fpGUI or MSEgui).
>
> For no gui console application, compile your fpc java native library for the
> same cpu than the one of Android.
> For example RPi (but I am not sure it is the same cpu as android-devices).

I'd like to try console apps (also with Free Vision) first in
conjunction with this:
   http://turbocontrol.com/gnuroot.htm

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

fredvs
> I'd like to try console apps (also with Free Vision) first in conjunction with this:
>   http://turbocontrol.com/gnuroot.htm

Wow, if it works, it is a revolutionary solution.
I do not have a rpi nor a Android machine to test.
But I am your fan.

Hope sincerely that it will work.

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Jon Foster
In reply to this post by Paul Breneman
On 04/09/2017 11:30 AM, Paul Breneman wrote:

> On 04/09/2017 11:32 AM, fredvs wrote:
>>> For this, Xorg must be installed.
>>
>> Huh, of course only for gui applications (fpGUI or MSEgui).
>>
>> For no gui console application, compile your fpc java native library for
>> the
>> same cpu than the one of Android.
>> For example RPi (but I am not sure it is the same cpu as android-devices).
>
> I'd like to try console apps (also with Free Vision) first in conjunction
> with this:
>   http://turbocontrol.com/gnuroot.htm
The only thing that console apps need is a terminal emulator. A bunch of
ways that can happen and it depends on whether this is to be provided
through the Android market or not. If not things are much easier. Terminal
emulators abound you can pretty much just pick one.

Now for the obstacles:

1.  Linux (Android kernel) only runs executables from a file system that
allows you to set the "execute" permission, which means that you can't just
put your stuff on an SD card and run it, since FAT and descendants don't
have that permission. So you have to get your exes into the internal
non-FAT App storage and Android permissions throw up plenty of barriers.

2.  Compiling for ARM. This can be done with cross build tools, with an ARM
Linux computer or some other *nix variant available on ARM, or with several
of the Android apps that provide pre-built versions of the compiler and a
term environment. I actually built the compiler and tools with a CHIP /
PocketCHIP (http://getchip.com/). Very inexpensive full blown Debian 8
install. But I think I had to build a bootstrap compiler with my Intel
based Linux box first. Which meant building a cross "binutils" for ARM,
which was fairly simple. I can probably post some scripts if desired.

My final solution for compiling and running things was "Terminal IDE" Its
setup for Java, C & C++ but it provides the terminal, assembler, linker,
some Android packaging tools and it provides full access to the packages
"home" folder which allows the executable permission. If there is an ARM
bootstrap compiler, and I haven't looked in a while, you should be able to
build FPC and units all from within Terminal IDE. You will want to use the
automated installer for the C compiler and stuff, since that contains
"binutils" (assembler, linker, ...).

*NOTE* Last I looked this won't work on Android 5+, explained below (#3).

My problem with it is "vi" for editing. And since other apps don't have
access to its "sandbox" you have to do some juggling for a complete on
device dev environment. It would technically be possible to keep source on
the FAT storage (SD or internal) and just build into the sandbox, which has
permissions.

You will need a ".fpc.cfg" in the IDE's home folder and you won't be able
to install one to "/etc". You can find the correct location by typing "echo
$HOME" (case is significant) in the terminal window.

I should also mention that the "hacker's keyboard" is very desirable for
this. But you will probably want a larger screen size. Those buttons can
get pretty small!

3.  Android 5+ introduced *mandatory* address space randomization. This
means that binaries compiled for <5 won't run on 5+ and visa-versa. It also
means you need address independent output from FPC for 5+. I believe this
is now an option in FPC 3. But I don't believe the Terminal IDE guy ever
produced a build that will work on Android 5+.

If distributing you will probably want to build both an address independent
and non-independent version and then selectively launch the correct one.
But that ties in with 4 & 5 below.

4.  Google does not allow one package to require another package. So your
package has to be self contained, meaning that if you need an X server or
Terminal emulator it has to be combined into one package with your fpc
binaries and data. This has licensing implications that may not be
acceptable. Depending on your situation you may be able to take someone
else's OpenSource package and hack your stuff into it. ie. Get an open
source term app, "rebrand" it, inject your FPC app, and patch it to
auto-start your app and shutdown when your app finishes.

5.  Android *only* launches Dalvik (Java) based apps so if packaging you
have to provide some kind of Java based wrapper anyways. Making #4
mandatory anyways.

6.  App lifespan. Terminal apps expect that they will start and run until
either their task has finished or the user signals it to stop. Android
expects it can terminate and restart apps as it sees fit. This can cause
problems when your app unexpectedly gets terminated.

I should also mention that the JVM target for FPC seems to work quite well.
So its possible to use FPC to write the mandatory Dalvik wrapper for your
native FPC code. I have an App that I kept the same core code and wrote a
new Dalvik front end in FPC, using the JVM target. But its very time
consuming and fraught with peril. The Android UI does many unexpected
things and the Java environment has many obstacles that we FPC users don't
expect. And FPC hasn't ported their units so you'll need the Android API
reference handy and will have to dig for normal things like converting an
integer to a string. And then there is the renaming of stuff done by the
FPC API converter and ...

I'm sure I haven't listed all of the obstacles. But those are the majors. I
also don't have a single solution that will work reliably. Depending on
needs/wants you may be able to work out something that you can use. Right
now I'm looking over fpGUI with an eye to porting it to Android to make a
more sane environment.


--

Sent from my Debian Linux laptop -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

fredvs
Jon Foster wrote
The only thing that console apps need is a terminal emulator.
Huh, yes, when I re-read my mail, I see directly that this will be the problem.
The "One only library-method used by the Java Class" needs of course a terminal to show his output.

Jon Foster wrote
Linux (Android kernel) only runs executables from a file system that
allows you to set the "execute" permission
For Java-native libraries too ?

Jon Foster wrote
Android *only* launches Dalvik (Java) based apps so if packaging you
have to provide some kind of Java based wrapper anyways.
Yes, of course the trick needs a Java main class app that will execute only one main-method from the fpc-Java_Native library.

Jon Foster wrote
Right now I'm looking over fpGUI with an eye to porting it to Android to make a
more sane environment.
Of course this is the solution who will make all others obsolete (even those using Jni.pas).

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Jon Foster-2

On 04/15/2017 12:14 PM, fredvs wrote:

> Jon Foster wrote
>> The only thing that console apps need is a terminal emulator.
> Huh, yes, when I re-read my mail, I see directly that this will be the
> problem.
> The "One only library-method used by the Java Class" needs of course a
> terminal to show his output.
>
>
> Jon Foster wrote
>> Linux (Android kernel) only runs executables from a file system that
>> allows you to set the "execute" permission
> For Java-native libraries too ?
If I understand your question correctly: No, since the library isn't
"executed" (in the traditional *nix sense) its "loaded" and used. As you
stated you need an Android Java (Dalvik) app, which gets executed, and then
it loads the library and calls the functions in it. But never forget you
need someway to display stuff... and the normal Pascal methods of providing
user interaction are not available on Android.

Take this simple program:

program hello;
uses SysUtils;
var
s: string;
begin
   write('Enter your name: ');
   ReadLn(s);
   WriteLn('Hello ', s);
end.

Assuming you made it into a library and write a Dalvik wrapper you still
need some place for the input to come from and the output to go to. On
Linux this would be "standard in" and "standard out", attached to a
terminal somewhere/somehow (VGA adapter, xterm, pipes, ...).

Technically all you need to do this with Android is a compiler for the
architecture of the Android device (usually ARM) and a terminal app. Once
compiled you can place the app on an SD card (typically available) then
launch your terminal app, copy the app from the SD card into "/data/tmp",
"chmod a+x /data/tmp/myapp" (change "myapp" to the name of yours) and then
launch it and interact with it via the terminal app.

You have to copy the app to "/data/tmp" as that is usually the only place
on Android with a Linux file system that all users have access to. You
can't look in there so you kind of have to fly blind. :-) "Terminal IDE"
makes this easier, assuming you have a compatible Android version, since it
provides the Linux file system space, term emulator and easy access.

This was what I thought Paul was looking to do. FreeVision might work
depending on a number of variables... but I'm not familiar with it. Most
Android terminal apps would provide some kind of VT100 like emulation so
you may have to force FreeVision to output for that emulation. If it tries
to use a "termcap" through normal means it probably will crash.

--
Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
On 04/17/2017 08:42 PM, Jon Foster wrote:
...

> You have to copy the app to "/data/tmp" as that is usually the only
> place on Android with a Linux file system that all users have access to.
> You can't look in there so you kind of have to fly blind. :-) "Terminal
> IDE" makes this easier, assuming you have a compatible Android version,
> since it provides the Linux file system space, term emulator and easy
> access.
>
> This was what I thought Paul was looking to do. FreeVision might work
> depending on a number of variables... but I'm not familiar with it. Most
> Android terminal apps would provide some kind of VT100 like emulation so
> you may have to force FreeVision to output for that emulation. If it
> tries to use a "termcap" through normal means it probably will crash.
>

Thanks Jon *very* much for the details that you shared!  I hope to get
time to get back into this soon and I'm sure that your notes will help.

The last problem that I had *three years* ago was that I failed to get
the mouse to work in the text mode IDE (I did have a keyboard and mouse
that worked in Android).  The mouse is not absolutely required for the
simple programs I'd like to do.

Regards,
Paul
www.ControlPascal.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Jon Foster
On 04/18/2017 04:38 AM, Paul Breneman wrote:

> On 04/17/2017 08:42 PM, Jon Foster wrote:
> ...
>> You have to copy the app to "/data/tmp" as that is usually the only
>> place on Android with a Linux file system that all users have access to.
>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>> IDE" makes this easier, assuming you have a compatible Android version,
>> since it provides the Linux file system space, term emulator and easy
>> access.
>>
>> This was what I thought Paul was looking to do. FreeVision might work
>> depending on a number of variables... but I'm not familiar with it. Most
>> Android terminal apps would provide some kind of VT100 like emulation so
>> you may have to force FreeVision to output for that emulation. If it
>> tries to use a "termcap" through normal means it probably will crash.
>>
>
> Thanks Jon *very* much for the details that you shared!  I hope to get
> time to get back into this soon and I'm sure that your notes will help.
>
> The last problem that I had *three years* ago was that I failed to get
> the mouse to work in the text mode IDE (I did have a keyboard and mouse
> that worked in Android).  The mouse is not absolutely required for the
> simple programs I'd like to do.
>
> Regards,
> Paul
The "mouse" will more than likely be unavailable. Most people don't think
"terminal" and "mouse". Still if you can find an Android terminal app with
"gpm" or xterm style mouse support it could work. I've never used a "text
mode" mouse in Linux. I can't think of any terminal based programs I use
that offer mouse support. :-) And then you could always download an
OpenSource terminal app and hack it to provide that support. The "xterm"
man page documents its mouse protocol, which is probably the defacto standard.

THX - Jon

--
Jon Foster
JF Possibilities, Inc.
[hidden email]


--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]
541-410-2760
Making computers work for you!
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Jon Foster
On 04/18/2017 10:13 AM, Jon Foster wrote:

> On 04/18/2017 04:38 AM, Paul Breneman wrote:
>> On 04/17/2017 08:42 PM, Jon Foster wrote:
>> ...
>>> You have to copy the app to "/data/tmp" as that is usually the only
>>> place on Android with a Linux file system that all users have access to.
>>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>>> IDE" makes this easier, assuming you have a compatible Android version,
>>> since it provides the Linux file system space, term emulator and easy
>>> access.
>>>
>>> This was what I thought Paul was looking to do. FreeVision might work
>>> depending on a number of variables... but I'm not familiar with it. Most
>>> Android terminal apps would provide some kind of VT100 like emulation so
>>> you may have to force FreeVision to output for that emulation. If it
>>> tries to use a "termcap" through normal means it probably will crash.
>>>
>>
>> Thanks Jon *very* much for the details that you shared!  I hope to get
>> time to get back into this soon and I'm sure that your notes will help.
>>
>> The last problem that I had *three years* ago was that I failed to get
>> the mouse to work in the text mode IDE (I did have a keyboard and mouse
>> that worked in Android).  The mouse is not absolutely required for the
>> simple programs I'd like to do.
>>
>> Regards,
>> Paul
> The "mouse" will more than likely be unavailable. Most people don't think
> "terminal" and "mouse". Still if you can find an Android terminal app
> with "gpm" or xterm style mouse support it could work. I've never used a
> "text mode" mouse in Linux. I can't think of any terminal based programs
> I use that offer mouse support. :-) And then you could always download an
> OpenSource terminal app and hack it to provide that support. The "xterm"
> man page documents its mouse protocol, which is probably the defacto
> standard.
>
> THX - Jon
>
I should also mention that PascalGUI is probably the most mature
FPC+term+editor app that I know of. Its been a while but it seems they've
added some nice touches. I had been using "Pascal Develop" since I could
download the source and alter its compile target. But it doesn't provide
proper terminal emulation and came packaged with FPC 2.6 pre v3 beta, which
was good at the time since 3 hadn't been out yet. :-D I patched and added
many FPC units to his original set, which I think he released.

--
Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
On 04/18/2017 01:27 PM, Jon Foster wrote:

> On 04/18/2017 10:13 AM, Jon Foster wrote:
>> On 04/18/2017 04:38 AM, Paul Breneman wrote:
>>> On 04/17/2017 08:42 PM, Jon Foster wrote:
>>> ...
>>>> You have to copy the app to "/data/tmp" as that is usually the only
>>>> place on Android with a Linux file system that all users have access
>>>> to.
>>>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>>>> IDE" makes this easier, assuming you have a compatible Android version,
>>>> since it provides the Linux file system space, term emulator and easy
>>>> access.
>>>>
>>>> This was what I thought Paul was looking to do. FreeVision might work
>>>> depending on a number of variables... but I'm not familiar with it.
>>>> Most
>>>> Android terminal apps would provide some kind of VT100 like
>>>> emulation so
>>>> you may have to force FreeVision to output for that emulation. If it
>>>> tries to use a "termcap" through normal means it probably will crash.
>>>>
>>>
>>> Thanks Jon *very* much for the details that you shared!  I hope to get
>>> time to get back into this soon and I'm sure that your notes will help.
>>>
>>> The last problem that I had *three years* ago was that I failed to get
>>> the mouse to work in the text mode IDE (I did have a keyboard and mouse
>>> that worked in Android).  The mouse is not absolutely required for the
>>> simple programs I'd like to do.
>>>
>>> Regards,
>>> Paul
>> The "mouse" will more than likely be unavailable. Most people don't
>> think "terminal" and "mouse". Still if you can find an Android
>> terminal app with "gpm" or xterm style mouse support it could work.
>> I've never used a "text mode" mouse in Linux. I can't think of any
>> terminal based programs I use that offer mouse support. :-) And then
>> you could always download an OpenSource terminal app and hack it to
>> provide that support. The "xterm" man page documents its mouse
>> protocol, which is probably the defacto standard.
>>
>> THX - Jon
>>
> I should also mention that PascalGUI is probably the most mature
> FPC+term+editor app that I know of. Its been a while but it seems
> they've added some nice touches. I had been using "Pascal Develop" since
> I could download the source and alter its compile target. But it doesn't
> provide proper terminal emulation and came packaged with FPC 2.6 pre v3
> beta, which was good at the time since 3 hadn't been out yet. :-D I
> patched and added many FPC units to his original set, which I think he
> released.
>

I'm pretty sure that the Turbo Pascal text mode IDE offered mouse
support (under MS-DOS), and also the Free Pascal IDE (which you can try
under Linux).

Thanks again Jon for your notes.  I've know about PascalGUI for a while
and have a little doc about it near the bottom of this page:
   http://turbocontrol.com/helloworld.htm

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Marco van de Voort
In our previous episode, Paul Breneman said:

> > they've added some nice touches. I had been using "Pascal Develop" since
> > I could download the source and alter its compile target. But it doesn't
> > provide proper terminal emulation and came packaged with FPC 2.6 pre v3
> > beta, which was good at the time since 3 hadn't been out yet. :-D I
> > patched and added many FPC units to his original set, which I think he
> > released.
> >
>
> I'm pretty sure that the Turbo Pascal text mode IDE offered mouse
> support (under MS-DOS), and also the Free Pascal IDE (which you can try
> under Linux).
>
> Thanks again Jon for your notes.  I've know about PascalGUI for a while
> and have a little doc about it near the bottom of this page:
>    http://turbocontrol.com/helloworld.htm

Sure, I used mouse support in the IDE running in a putty to a linux machine for years
to do minor FPC development in an environment where I didn't have a fixed
PC.

Requires some minor tweaking of putty properties though.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Graeme Geldenhuys-6
In reply to this post by Jon Foster
On 2017-04-18 18:13, Jon Foster wrote:
> I can't think of any terminal based programs I use
> that offer mouse support.

No idea what this thread is about really, but as for the above
statement. I use plenty terminal apps that have mouse support. Midnight
Commander (2 panel file manager), Free Pascal Text IDE (in a pinch),
htop (*nix process manager), many text installers etc.

Regards,
  Graeme

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
In reply to this post by Paul Breneman
On 04/18/2017 07:38 AM, Paul Breneman wrote:

> On 04/17/2017 08:42 PM, Jon Foster wrote:
> ...
>> You have to copy the app to "/data/tmp" as that is usually the only
>> place on Android with a Linux file system that all users have access to.
>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>> IDE" makes this easier, assuming you have a compatible Android version,
>> since it provides the Linux file system space, term emulator and easy
>> access.
>>
>> This was what I thought Paul was looking to do. FreeVision might work
>> depending on a number of variables... but I'm not familiar with it. Most
>> Android terminal apps would provide some kind of VT100 like emulation so
>> you may have to force FreeVision to output for that emulation. If it
>> tries to use a "termcap" through normal means it probably will crash.
>>
>
> Thanks Jon *very* much for the details that you shared!  I hope to get
> time to get back into this soon and I'm sure that your notes will help.

Well, I tried a bit this morning but have failed so far.

With GNURoot Debian it comes up as Debian version 8.1 but I upgraded to
8.7 using the instructions near the bottom of this page:
   http://turbocontrol.com/gnuroot.htm

The 2.6.0 ppcarm itself fails to run with: Illegal instruction

I also posted a new zip (not yet on web page) and tried that:
HelloWorld-fpc-3.0.2.arm-linux-041917.zip

The 3.0.2 ppcarm itself fails with: Segmentation fault

Thanks in advance for *any* suggestions.  As soon as I get this working
I hope to create a new wiki page so it is easier for others to share. :)

Thanks,
Paul Breneman
www.ControlPascal.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Jon Foster
On 04/19/2017 06:01 AM, Paul Breneman wrote:

> On 04/18/2017 07:38 AM, Paul Breneman wrote:
>> On 04/17/2017 08:42 PM, Jon Foster wrote:
>> ...
>>> You have to copy the app to "/data/tmp" as that is usually the only
>>> place on Android with a Linux file system that all users have access to.
>>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>>> IDE" makes this easier, assuming you have a compatible Android version,
>>> since it provides the Linux file system space, term emulator and easy
>>> access.
>>>
>>> This was what I thought Paul was looking to do. FreeVision might work
>>> depending on a number of variables... but I'm not familiar with it. Most
>>> Android terminal apps would provide some kind of VT100 like emulation so
>>> you may have to force FreeVision to output for that emulation. If it
>>> tries to use a "termcap" through normal means it probably will crash.
>>>
>>
>> Thanks Jon *very* much for the details that you shared!  I hope to get
>> time to get back into this soon and I'm sure that your notes will help.
>
> Well, I tried a bit this morning but have failed so far.
>
> With GNURoot Debian it comes up as Debian version 8.1 but I upgraded to
> 8.7 using the instructions near the bottom of this page:
>   http://turbocontrol.com/gnuroot.htm
>
> The 2.6.0 ppcarm itself fails to run with: Illegal instruction
>
> I also posted a new zip (not yet on web page) and tried that:
> HelloWorld-fpc-3.0.2.arm-linux-041917.zip
>
> The 3.0.2 ppcarm itself fails with: Segmentation fault
>
> Thanks in advance for *any* suggestions.  As soon as I get this working I
> hope to create a new wiki page so it is easier for others to share. :)
>
> Thanks,
> Paul Breneman
> www.ControlPascal.com
I don't know anything about your environment but a few possibilities spring
to mind:

1. Newer version of Android which requires a PIC/PIE binary and you aren't
running one or maybe even the inverse. Although I think this normally gives
an error about "PIE" being needed, at least in the Android 5+ case.

2. An ABI mismatch.

3. Running on an FPU-less device with a compiler that wasn't built with
emulation. I can't imagine what the compiler would need with an FPU though.

4. The ppcarm binary was built with a set of ARM instructions your device
doesn't support. They've added many extensions to the core ARM instruction
set over the years and different chip foundries can choose which they want
to include or not.

5. Bad RAM?

Since FPC is completely self contained I can't imagine anything in the
actual Linux install would be a problem. I'm certain they are using the
Android kernel and not doing something like UML, but I don't know anything
about the GNUroot project. I used someone else's Linux installer once,
originally titled "Lil' Debbie". They had to change their name for obvious
reasons. I couldn't find a VNC client that worked well enough to use it
though, even though my Iconia tablet sports a standard USB A connector and
it had no trouble with a stock keyboard and mouse. I don't think the VNC
clients I tried were expecting real input hardware. :-)

--
Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Jon Foster
On 04/19/2017 06:48 PM, Jon Foster wrote:

> On 04/19/2017 06:01 AM, Paul Breneman wrote:
>> On 04/18/2017 07:38 AM, Paul Breneman wrote:
>>> On 04/17/2017 08:42 PM, Jon Foster wrote:
>>> ...
>>>> You have to copy the app to "/data/tmp" as that is usually the only
>>>> place on Android with a Linux file system that all users have access to.
>>>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>>>> IDE" makes this easier, assuming you have a compatible Android version,
>>>> since it provides the Linux file system space, term emulator and easy
>>>> access.
>>>>
>>>> This was what I thought Paul was looking to do. FreeVision might work
>>>> depending on a number of variables... but I'm not familiar with it. Most
>>>> Android terminal apps would provide some kind of VT100 like emulation so
>>>> you may have to force FreeVision to output for that emulation. If it
>>>> tries to use a "termcap" through normal means it probably will crash.
>>>>
>>>
>>> Thanks Jon *very* much for the details that you shared!  I hope to get
>>> time to get back into this soon and I'm sure that your notes will help.
>>
>> Well, I tried a bit this morning but have failed so far.
>>
>> With GNURoot Debian it comes up as Debian version 8.1 but I upgraded to
>> 8.7 using the instructions near the bottom of this page:
>>   http://turbocontrol.com/gnuroot.htm
>>
>> The 2.6.0 ppcarm itself fails to run with: Illegal instruction
>>
>> I also posted a new zip (not yet on web page) and tried that:
>> HelloWorld-fpc-3.0.2.arm-linux-041917.zip
>>
>> The 3.0.2 ppcarm itself fails with: Segmentation fault
>>
>> Thanks in advance for *any* suggestions.  As soon as I get this working
>> I hope to create a new wiki page so it is easier for others to share. :)
>>
>> Thanks,
>> Paul Breneman
>> www.ControlPascal.com
> I don't know anything about your environment but a few possibilities
> spring to mind:
>
> 1. Newer version of Android which requires a PIC/PIE binary and you
> aren't running one or maybe even the inverse. Although I think this
> normally gives an error about "PIE" being needed, at least in the Android
> 5+ case.
>
> 2. An ABI mismatch.
>
> 3. Running on an FPU-less device with a compiler that wasn't built with
> emulation. I can't imagine what the compiler would need with an FPU though.
>
> 4. The ppcarm binary was built with a set of ARM instructions your device
> doesn't support. They've added many extensions to the core ARM
> instruction set over the years and different chip foundries can choose
> which they want to include or not.
>
> 5. Bad RAM?
>
> Since FPC is completely self contained I can't imagine anything in the
> actual Linux install would be a problem. I'm certain they are using the
> Android kernel and not doing something like UML, but I don't know
> anything about the GNUroot project. I used someone else's Linux installer
> once, originally titled "Lil' Debbie". They had to change their name for
> obvious reasons. I couldn't find a VNC client that worked well enough to
> use it though, even though my Iconia tablet sports a standard USB A
> connector and it had no trouble with a stock keyboard and mouse. I don't
> think the VNC clients I tried were expecting real input hardware. :-)
>
One other thing to try is: If you install PascalGUI or Pascal Develop do
their compilers run?

Might reveal some clue.

--
Jon Foster
JF Possibilities, Inc.
[hidden email]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
In reply to this post by Jon Foster
On 04/19/2017 09:48 PM, Jon Foster wrote:

> On 04/19/2017 06:01 AM, Paul Breneman wrote:
>> On 04/18/2017 07:38 AM, Paul Breneman wrote:
>>> On 04/17/2017 08:42 PM, Jon Foster wrote:
>>> ...
>>>> You have to copy the app to "/data/tmp" as that is usually the only
>>>> place on Android with a Linux file system that all users have access
>>>> to.
>>>> You can't look in there so you kind of have to fly blind. :-) "Terminal
>>>> IDE" makes this easier, assuming you have a compatible Android version,
>>>> since it provides the Linux file system space, term emulator and easy
>>>> access.
>>>>
>>>> This was what I thought Paul was looking to do. FreeVision might work
>>>> depending on a number of variables... but I'm not familiar with it.
>>>> Most
>>>> Android terminal apps would provide some kind of VT100 like
>>>> emulation so
>>>> you may have to force FreeVision to output for that emulation. If it
>>>> tries to use a "termcap" through normal means it probably will crash.
>>>>
>>>
>>> Thanks Jon *very* much for the details that you shared!  I hope to get
>>> time to get back into this soon and I'm sure that your notes will help.
>>
>> Well, I tried a bit this morning but have failed so far.
>>
>> With GNURoot Debian it comes up as Debian version 8.1 but I upgraded
>> to 8.7 using the instructions near the bottom of this page:
>>   http://turbocontrol.com/gnuroot.htm
>>
>> The 2.6.0 ppcarm itself fails to run with: Illegal instruction
>>
>> I also posted a new zip (not yet on web page) and tried that:
>> HelloWorld-fpc-3.0.2.arm-linux-041917.zip
>>
>> The 3.0.2 ppcarm itself fails with: Segmentation fault
>>
>> Thanks in advance for *any* suggestions.  As soon as I get this
>> working I hope to create a new wiki page so it is easier for others to
>> share. :)
>>
>> Thanks,
>> Paul Breneman
>> www.ControlPascal.com
> I don't know anything about your environment but a few possibilities
> spring to mind:
>
> 1. Newer version of Android which requires a PIC/PIE binary and you
> aren't running one or maybe even the inverse. Although I think this
> normally gives an error about "PIE" being needed, at least in the
> Android 5+ case.
>
> 2. An ABI mismatch.
>
> 3. Running on an FPU-less device with a compiler that wasn't built with
> emulation. I can't imagine what the compiler would need with an FPU though.
>
> 4. The ppcarm binary was built with a set of ARM instructions your
> device doesn't support. They've added many extensions to the core ARM
> instruction set over the years and different chip foundries can choose
> which they want to include or not.
>
> 5. Bad RAM?
>
> Since FPC is completely self contained I can't imagine anything in the
> actual Linux install would be a problem. I'm certain they are using the
> Android kernel and not doing something like UML, but I don't know
> anything about the GNUroot project. I used someone else's Linux
> installer once, originally titled "Lil' Debbie". They had to change
> their name for obvious reasons. I couldn't find a VNC client that worked
> well enough to use it though, even though my Iconia tablet sports a
> standard USB A connector and it had no trouble with a stock keyboard and
> mouse. I don't think the VNC clients I tried were expecting real input
> hardware. :-)
>

I'm using a Nexus 7 tablet with Android 6.0.1.  GNURoot provides a
chroot with Debian?  It has been *three* years since I did this before
and things worked then so I don't know what might have changed so ppcarm
doesn't even run now.

Android?
GNURoot?
ppcarm?

I'm trying the *most simple* thing, so no x11 or VNC needed.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fpc code for Java class and Android.

Paul Breneman
On 04/19/2017 10:49 PM, Paul Breneman wrote:

> I'm using a Nexus 7 tablet with Android 6.0.1.  GNURoot provides a
> chroot with Debian?  It has been *three* years since I did this before
> and things worked then so I don't know what might have changed so ppcarm
> doesn't even run now.
>
> Android?
> GNURoot?
> ppcarm?
>
> I'm trying the *most simple* thing, so no x11 or VNC needed.

Actually, the FPC 2.6.0 *ppcarm* worked three years ago but not now.
What can cause it to have an *Illegal instruction* error?

There is a *simple* procedure near the bottom of this page:
   http://turbocontrol.com/gnuroot.htm

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
12
Loading...