Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-other / 2020-05

how to force make.exe to work without binutils in windows

11 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mgr. Janusz Chmiel

I do not know, if does make sense to compile PPCJVM for WIndows frou latest stable trunk, if there was An change in its source code between Dec 2017 and now.
The following command do not work from Windows, because Make need binutils installed. BUt I can not run Linux commands from WSL in A combination with Windows executable at The same time.

When I type The following command
make all FPC=c:\fpc\bin\i386\ppcjvm.exe JVM=1
Make refuses to run without binutils installed. Overide binutils some special option some time also do not work.
So please, which command can I type to compile PPCJVM from Windwos for Windows?
Or it do not make sense, since PPCJVM source code did not change from 2017 Dec month?
Thank you very much for yours answer.

Reply by email

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel

I would like to announce, that Pandroid package for WIndows have been released.
Now, it is Lazarus compatible package. Developer can have benefit with new technique for building resulting code. RTL are compiled as a standalone .jar library. Resulting code is very fast especially when interacting with bass.so library but not only limited for this task. Android29 Pascal api headers are included. When error occurs in code, Cursor correctly jump to The line with error. Because it is Lazarus package, compilation process run after pressing SHIFT+F9.
It is possible to include native libraryes support by adding .jar file with compiled Java classes and library.
Very memory efficient strategy. Some units have been collected to resulting .apk so it is no more part of .dex file.
You can find The project here:

https://github.com/zeljkoc/PandroidPackage.git
I want to allow so much programmers as possible to have benefit with this new release. Zeljuko, you are The right fellow and thank you for yours complex work on this project.

I will make free Pascal application for seniors to train their brain by making some word based tasks. I do not see at all, but yours bundle and Pascal programming language with its structured form and with its simplicity allow Me to code very useful apps. I have benefit with yours GUI libraryes, which are simple to use and are very efficient GUI toolkit. So very weell done.

Reply by email

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel

I Am wondering, how to construct The series of Pascal statements which will have The same effect like in Java.
wakeLock.acquire ();

The command
wakeLock.newWakeLock (1, '"Migration');
Work perfectly.
But
wakeLock.acquire (

                          );

Causes error when compiling.
I Am using AndroidR15
APi headers for Pascal.

Any advices will be welcomed. I do not know how to construct Pascal equivalent of Java commands when intereacting with APi functions.

Reply by email

Jonas Maebe
to Mgr. Janusz Chmiel: I do not know, if does make sense to compile PPCJVM for WIndows frou latest stable trunk,…
Mgr. Janusz Chmiel wrote
I do not know, if does make sense to compile PPCJVM for WIndows frou latest stable trunk, if there was An change in its source code between Dec 2017 and now.

There have been some changes, but no new features have been added. There have been no major bugfixes either.

The following command do not work from Windows, because Make need binutils installed. BUt I can not run Linux commands from WSL in A combination with Windows executable at The same time.

You don't need to use WSL to compile FPC under Windows (for JVM or for any other target).

When I type The following command make all FPC=c:\fpc\bin\i386\ppcjvm.exe JVM=1 Make refuses to run without binutils installed. Overide binutils some special option some time also do not work.

FPC should come with the necessary binutils, so just running that command in a regular cmd window should work.

Jonas

Reply by email

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel: I Am wondering, how to construct The series of Pascal statements which will have The same…

It seems to Me, that Android APi functions do not contain standalone procedure to activate Wakelock when other than Java or Kotlin language have been used.

May be, that somebody very experienced would try to develop new function or command to PPCJVM or to The Android RTL.
Thank you very much for yours thinkink. Or may be, that I Am doing errors. And that I do not understand The Pascal API headers as I should to activate Wakelock.

Reply by email

Jonas Maebe
to Mgr. Janusz Chmiel: I Am wondering, how to construct The series of Pascal statements which will have The same…
Mgr. Janusz Chmiel wrote 14 lines
I Am wondering, how to construct The series of Pascal statements which will have The same effect like in Java. wakeLock.acquire (); The command wakeLock.newWakeLock (1, '"Migration'); Work perfectly. But wakeLock.acquire ( ); Causes error when compiling. I Am using AndroidR15 APi headers for Pascal.

The AOPowerManager.WakeLock inner class declaration is indeed incomplete in the Pascal translation: it's missing all of the method declarations. It must be a bug in the javapp program (maybe because the constructor of that class is private).

You should be able to work around it by placing this declaration in your own program or unit source file. It should override the incomplete declaration from the androidr15 unit.

type
  AOPowerManager = class external 'android.os' name 'PowerManager'
(JLObject)
  public
    type
      InnerWakeLock = class;
      Arr1InnerWakeLock = array of InnerWakeLock;
      Arr2InnerWakeLock = array of Arr1InnerWakeLock;
      Arr3InnerWakeLock = array of Arr2InnerWakeLock;
      InnerWakeLock = class external 'android.os' name 'WakeLock'
        procedure acquire; overload; virtual;
        procedure acquire(timeout: jlong); overload; virtual;
        function isHeld: boolean; overload; virtual;
        procedure release; overload; virtual;
        procedure release(flags: jint); overload; virtual;
        procedure setReferenceCounted(value: boolean); overload; virtual;
        procedure setWorkSource(ws: AOWorkSource); overload; virtual;
        function toString(): JLString; overload; virtual;
      end;
  public
    const
      PARTIAL_WAKE_LOCK = 1;
      FULL_WAKE_LOCK = 26;
      SCREEN_BRIGHT_WAKE_LOCK = 10;
      SCREEN_DIM_WAKE_LOCK = 6;
      ACQUIRE_CAUSES_WAKEUP = 268435456;
      ON_AFTER_RELEASE = 536870912;
  public
    function newWakeLock(para1: jint; para2: JLString):
AOPowerManager.InnerWakeLock; overload; virtual;
    procedure userActivity(para1: jlong; para2: jboolean); overload;
virtual;
    procedure goToSleep(para1: jlong); overload; virtual;
    function isScreenOn(): jboolean; overload; virtual;
    procedure reboot(para1: JLString); overload; virtual;
  end;

Jonas

Reply by email

Mgr. Janusz Chmiel
to Jonas Maebe

Oh yes. YOu aare really The expert.
Constructing correct Android APi pascal headers is extremely complex work. And without work of MR Swianovicz there would not be new Android APi headers. Develop fully automated solution is rather extremely heavy programmers task. And using Borland Delphi equivalents is may not possible thanks to differences between Free Pascal compiler and Delphi original compiler.
There are some attempts on Github to provide Android APi functions based on JNI.
Thank you very much for yours advice. I have thought, that my code is non functioning and yours code should help Me.
I Am also aware, that ANdroid kernel contain routines which will suspend Wifi chip automatically when phone screen is turned off even if I will use full Wakelock. It will not turn it completely off, but it will turn it in to less sensitive level so if there is 1 or 2 wifi bars signal strenght and phone is turned of for several minutes, it will be too less to receive 128 KB/S MP3 live stream. The work around is to use ping command in Termux but if is it possible to use equivalent directly from Pascal source, it is interesting question for thinkink.
Thank you very much for yours professional answer.

Reply by email

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel

How much time would take The most experienced programmers from us to create really complete Pascal headers for ANdroid APi functions. I Am aware, that it is impossible to provide evey new APi function when GOogle will introduce some. But there should be An compromise solution.
Generate rather two or one really complete Android APi functions for Pascal than making too much with issues inside it.
For example. Generate Android 16 and 29 or 28.

The question is, if PPCJVM contain all necessary constructs and commands or data types list to reach this goal.
I think, that if MR Maebe, MR Bart and MR Swianovicz could cooperate together on this complex task, there could be fully completed Android Pascal header files for Android 16 and Android 28 or 29.
Sure. There is also simple solution. Using PPCJVM only to create apps without Android APi functions calls and use. But this would be sad. In this case, app can only receive input from virtual keyboard or from Physical and can work with files. But no sound, if somebody will not use some external .so library from Pascal source.
I Am sure, that there are more than 3 professionals here, who would be able to create those Android APi pascal headers which will be completed. I think, that starting with Android 16 would be A good idea, becuase there are no so much coe like in Android R28 or 29.
It is sad, that GOogle did not release automated solution. I think, that even Java or Kotlin programmers would be very engry, if somebody of them would be forced to find complex solutions to generate Android APi headers for his project himselves.
Thank you very much for yours thinkink.

Reply by email

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel

Even Lamw Android mmodule wizard do not contain standalone fully functioning Android pascal header files. Sure, it is robust project, where Mr Pessoa nd his cooperators have shown that their Pascal and object programming knowledge is brilliant and I can not measure myself with so big experts. But I have decided to rather give it up all power management features. Official GOogle engineers do not like this approach. So I will rather try to use battery optimisations dialog window and I will try to enable manual app driving and I will enable run in background, which will enforce Android core to refresh app in background automatically. I will watch my little radio player, what it will do.

Reply by email

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel

Unfortunately, not only live Internet radio players are designed to play in background. GPS navigation apps which gives people voice instructions how to travel and when The phone screen have been turned off is The next example. So what if somebody would try to develop such apps by using PPCJVM, Android JVM target. Somebody would like to develop for Android? I have found out, that simply using manage application startups and run in background system setting will really not solve this programmers issue. Simply adding some permissions to androidmanifest.xml without A corresponding code is also not a functioning solution.

So what should we had to do to solve this problem? Simply do not panic. Use even incomplete Android Pascal Api header files. Here is The code example.
Add
<uses-permission
android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> to The androidmanifest.xml

And add The following lines to yours Pascal code.
To The variables declaration source code part)
         pm: AOPowerManager;
intent: ACIntent;
And to The relevant other source code part
pm:= AOPowerManager(getSystemService(ACContext.POWER_SERVICE)) ;
  if (AOBuild.InnerVERSION.fSDK_INT >= AOBuild.InnerVERSION_CODES.M) then
begin
  if (not pm.isIgnoringBatteryOptimizations(getPackageName())) then begin
  // Prompt the user to disable battery optimization
  intent := ACIntent.create;
  intent.setAction(APSettings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
  startActivity(intent);
  end;
    end;

In this case, you will have 100 % insurance that yours app will never stop run in background.
It is for ANdroid 7 and newer.

Reply by email