controls.lpr(731,15) Error: Error while linking in laz4android3.4 lazarus / 43-Android ---------------------------------------------------------------------- Bandy · 2025-07-05 17:47 I get controls.lpr(731,15) Error: Error while linking in laz4android3.4 when trying to build a simple app that shows a simple message after installing laz4android and LAMW Version 0.8.6.4 with LAMW manager. Please help! ---------------------------------------------------------------------- dseligo · 2025-07-05 20:23 Copy all messages and put them here, sometimes there is error above final error, which could shed some light on a problem. How did you install LAMW? Did everything worked out without problems? For what chipset are you building for? Did you try to open some demoes that come with LAMW? Did you create regular form (you should use jForm)? Check controls.lpr, what is around line 731. ---------------------------------------------------------------------- tetrastes · 2025-07-05 20:59 Rename controls.lpr, as there is controls.pp unit in LCL. EDIT: corrected typo control.pp -> controls.pp. ---------------------------------------------------------------------- dseligo · 2025-07-05 21:07 Quote from: tetrastes on July 05, 2025, 10:59:53 pmRename controls.lpr, as there is control.pp unit in LCL. That's not the problem: 'controls' <> 'control' ---------------------------------------------------------------------- tetrastes · 2025-07-05 21:11 Sorry, it's typo, the LCL unit is controls.pp. ---------------------------------------------------------------------- dseligo · 2025-07-05 21:32 Quote from: tetrastes on July 05, 2025, 11:11:18 pmSorry, it's typo, the LCL unit is controls.pp. OK, but that still isn't a problem. LAMW doesn't use Lazarus' controls. ---------------------------------------------------------------------- tetrastes · 2025-07-05 22:55 Then sorry for noise. I trusted too much to "write once, compile everywhere". ---------------------------------------------------------------------- nobody.00 · 2025-07-06 00:47 Hello, The lamw install doesn´t use laz4android, look for lamw4windows on Start menu! No, o LAMW  no use LCL. My sugestion, is try create a new lamw project and report us . We stay here to help you! ---------------------------------------------------------------------- Bandy · 2025-07-06 09:38 All the messages: Messages, Hints: 2 Verbose: Selected chip architecture: armeabi-v7a Verbose: Taking libraries from folder: C:\Users\Andy\Desktop\Android\AppLAMWProject1\libs\armeabi-v7a Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\Users\ Andy\Desktop\Android\AppLAMWProject1\obj\controls\controls.o" Note: Duplicate unit "controls" in "LCLBase 3.4", ppu="C:\laz4android3.4\lcl\units\arm-android\controls.ppu", source="C:\laz4android3.4\lcl\controls.pp" Project: Executing command before: Success before build... Compile Project, OS: android, CPU: arm, Target: C:\Users\Andy\Desktop\ Android\AppLAMWProject1\libs\armeabi-v7a\libcontrols.so: Exit code 1, Errors: 1 C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -lc C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -llog C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -ldl C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -ljnigraphics C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -lc controls.lpr(731,15) Error: Error while linking I installed LAMW with LAMW Manager. Everything worked out without problems. Chipset is mt6853 on Samsung Galaxy A32 5G smartphone. I didn't open some demoes that come with LAMW. I opened a new project (LAMW [GUI] Android App]) and I used that form from the new project. Around line 731 is: begin        gApp:= jApp.Create(nil); 730  gApp.Title:= 'LAMW GUI JNI Android Bridges Library'; 731  gjAppName:= 'org.lamw.applamwproject1';        gjClassName:= 'org/lamw/applamwproject1/Controls';        gApp.AppName:=gjAppName;        gApp.ClassName:=gjClassName;        gApp.Initialize;        gApp.CreateForm(TAndroidModule1, AndroidModule1); end. ---------------------------------------------------------------------- tetrastes · 2025-07-06 09:50 Quote from: Bandy on July 06, 2025, 11:38:14 amNote: Duplicate unit "controls" in "controls", orphaned ppu "C:\Users\Andy\Desktop\Android\ AppLAMWProject1\obj\controls\controls.o" Note: Duplicate unit "controls" in "LCLBase 3.4", ppu="C:\laz4android3.4\lcl\units\arm-android\controls.ppu", source="C:\laz4android3.4\lcl\controls.pp" Well well... And what about not usung LCL..? ---------------------------------------------------------------------- dseligo · 2025-07-06 12:11 Quote from: Bandy on July 06, 2025, 11:38:14 amC:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -lc C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -llog C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -ldl C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -ljnigraphics C:\laz4android3.4\fpc\3.2.2\bin\i386-win32\arm-linux-androideabi- ld.bfd.exe: cannot find -lc controls.lpr(731,15) Error: Error while linking This could be something with the wrong path. How are paths set in Project Options, Compiler Options, Paths (Other Unit Files and Libraries)? Also check Custom Options in Project Options, Compiler Options (-FDC). Check that paths actually exists. QuoteChipset is mt6853 on Samsung Galaxy A32 5G smartphone. I didn't open some demoes that come with LAMW. Try to open and compile some demoes that came with LAMW, to see if the problem is in your setup or in your app. Also try to change Build Chipset (Project Options, [LAMW] Android Project Options, Build, Chipset). I usually build for Aarch64. Try to change this option for your test app and also for demo apps you try. ---------------------------------------------------------------------- dseligo · 2025-07-06 12:12 Quote from: tetrastes on July 06, 2025, 11:50:48 amQuote from: Bandy on July 06, 2025, 11:38:14 amNote: Duplicate unit "controls" in "controls", orphaned ppu "C:\Users\Andy\Desktop\Android\AppLAMWProject 1\obj\controls\controls.o" Note: Duplicate unit "controls" in "LCLBase 3.4", ppu="C:\laz4android3.4\lcl\units\arm-android\controls.ppu", source="C:\laz4android3.4\lcl\controls.pp" Well well... And what about not usung LCL..? Do you actually use LAMW? ---------------------------------------------------------------------- tetrastes · 2025-07-06 13:58 No, I don't, so I trust you that LAMW don't use LCL. But OP's project (due to dependency on laz4android) obviously does, which leads to duplicate units. Is that normal for LAMW project? I'll install LAMW, out of curiosity. ---------------------------------------------------------------------- Thaddy · 2025-07-06 14:21 It is not that difficult: LAMW does use the LCL but it DOES NOT use the default visual components. You need the LAMW versions. ---------------------------------------------------------------------- nobody.00 · 2025-07-07 03:26 Hello, usually the lamw_manager install is enough and work very well The error reported, is a missing library on linkage Check your settings in menu -> Tools -> [LAMW] Android Module Wizard -> Paths Settings [JDK,SDK ,NDK,... ] My sugestion, is use a lazarus building by LAMW Manager About LAMW Demos, try this adjust: https://github.com/dosza/LAMWManager-win#cannot-build-lamw-demos ---------------------------------------------------------------------- cdbc · 2025-07-07 06:10 Hi How about NOT calling your project 'Controls.lpr', but something else... 'Controlling.lpr' perhaps... Regards Benny ---------------------------------------------------------------------- dseligo · 2025-07-07 08:09 Quote from: cdbc on July 07, 2025, 08:10:47 amHi How about NOT calling your project 'Controls.lpr', but something else... 'Controlling.lpr' perhaps... Regards Benny IMHO, it is not the problem, this will put TS on the wrong track to solve his problem. Do you use LAMW? LAMW creates projects this with name controls.lpr, TS didn't choose this name. ---------------------------------------------------------------------- tetrastes · 2025-07-07 10:09 So, I installed LAMW using LAMW Manager v0.3.1.9 (released Feb 23 2025). It installed Lazarus 3.8 (in folder lazarus-trunk  ) and fpc 3.2.0 (). Nevertheless, it successfully builds LAMW examples for Aarch64 and ARMv7a+VFPv3 "chipsets". About LCL: LAMW depends on LCLBase (at least regandroidbridge.pas from tfpandroidbridge_pack package uses LResources), so while your lpr name is controls, you'll get the "Duplicate unit" notes, though it doesn't prevent to link, as LCL's controls.pp is not used. As for OP's problem. It seems that he messed options a) and b) installing LAMW (as @nobody.00 noted): https://github.com/jmpessoa/laz androidmodulewizard/tree/master?tab=readme-ov-file#getting-started Quote1. Get Lazarus for Android Option a) Laz4Android 2.2.2 (Windows) All cross-android compilers already installed! arm-android/aarch64-android/i386-android/x86_64-android/jvm-android hint: Install here: "C:\laz4android2.2.2" (not "Program Files" !!!) How to: Install Laz4Android2.2.2 Install LAMW Download LAMW and unzip it in some folder recommended folder: "C:\laz4android2.2.2\components" Packages installations order/sequence: tfpandroidbridge_pack.lpk (in "..../android_bridges" folder) lazandroidwizardpack.lpk (in ""..../android_wizard" folder) amw_ide_tools.lpk (in "..../ide_tools" folder) Go to "2. Infrastructure Setup". Option b) LAMW Manager All in One! LAMW Manage produces a complete Lazarus for Android environment by automating the step "2. Infrastructure Setup"! LAMW Manager Installer for Linux LAMW Manager Installer for Windows ---------------------------------------------------------------------- Bandy · 2025-07-07 12:00 I changed in my test app to Arch64, still the same error. Project Options, Compiler Options, Paths Other Unit Files: $(ProjOutDir) and Libraries: C:\lamw_manager\LAMW\android-ndk- r28b\toolchains\llvm\prebuilt\windows\sysroot\usr\lib\aarch64-linux- android\22\ [doesn't actually exists; actually exists: C:\lamw_manager\LAMW\android-ndk- r28b\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64- linux-android\22];C:\lamw_manager\LAMW\android- ndk-r28b\toolchains\aarch64-linux- android-4.9\prebuilt\windows\lib\gcc\aarch64-linux-android\4.9.x\ [doesn't actually exist] Custom Options in Project Options, Compiler Options (-FDC): -Xd -XPaarch64-linux-android- -FDC:\lamw_manager\LAMW\android- ndk-r28b\toolchains\aarch64-linux-android-4.9\prebuilt\windows\bin (does not actually exists) I don't know where demo apps are located. ---------------------------------------------------------------------- Bandy · 2025-07-07 12:02 This are my settings in menu -> Tools -> [LAMW] Android Module Wizard -> Paths Settings [JDK,SDK ,NDK,... ] in attachment. ---------------------------------------------------------------------- tetrastes · 2025-07-07 13:45 As I understand it, if you installed using LAMW Manager, you must use Lazarus installed by it, not laz4android. Try to find this: ---------------------------------------------------------------------- Bandy · 2025-07-07 17:04 Yes, I have LAMW4Windows. I started LAMW4Windows and it shows this, see attachment. I selected: Create a new recommended backend. It's OK? What's the difference between laz4android and LAMW? If I want to create Android apps, what should I use? ---------------------------------------------------------------------- tetrastes · 2025-07-07 17:20 Quote from: Bandy on July 07, 2025, 06:54:55 pmYes, I have LAMW4Windows. I started LAMW4Windows and it shows this, see attachment. I selected: Create a new recommended backend. It's OK? If error is removed, it's OK. In any case you can change it later, or choose debugger on per-project basis. Quote from: Bandy on July 07, 2025, 06:54:55 pmWhat's the difference between laz4android and LAMW? If I want to create Android apps, what should I use? laz4android is installer of lazarus with cross-compilers for android. LAMW is lazarus components for RAD of android apps. You should use lazarus+crosscompilers+LAMW(+sdk,ndk..). There several options to get this: https://github.com/jmpessoa/lazandr oidmodulewizard/tree/master?tab=readme-ov-file#getting-started. The easiest one is Option b) LAMW Manager. ---------------------------------------------------------------------- Bandy · 2025-07-07 17:34 Yes, error is removed when I selected: Create a new recommended backend. ---------------------------------------------------------------------- Bandy · 2025-07-07 17:37 How to create a simple apps that shows a simple 'Hello world' message? What should I start: laz4android or LAMW4Windows? ---------------------------------------------------------------------- tetrastes · 2025-07-07 17:42 As laz4android doesn't work, try LAMW4Windows. ---------------------------------------------------------------------- Bandy · 2025-07-07 18:18 When I try to ad a jButton to the form AndroidModule1 in LAMW4Windows it shows message from attachment. ---------------------------------------------------------------------- tetrastes · 2025-07-07 18:55 Try to open Project options and click OK button. I don't know why, but it helped me. ---------------------------------------------------------------------- Bandy · 2025-07-08 07:40 Clicking OK in Project Options works: I succeeded adding a jButton. Trying to Build (Shift+F9) and Compile (Ctrl+F9) my Hello World app now works ok, I'm guessing. These Messages are in attachment. Please confirm that is OK. But I can't Run (F9) my app, this command is greyed. Why, please? ---------------------------------------------------------------------- tetrastes · 2025-07-08 10:04 I installed LAMW yesterday, so I only can advice you to read documentation https://github.com/jmpessoa/lazandroidmodulewizard/tree/ master?tab=readme-ov-file#3-using-lamw. Quote3.2.5) Configure you phone device to debug mode/developer options and plug it to the computer usb port 3.2.6) From Lazarus IDE select "Run" -> "[LAMW] Build Apk and Run" ---------------------------------------------------------------------- Bandy · 2025-07-09 08:41 I configured my phone to debug mode/developer options and pluged it to my computer usb port. In LAMW4Windows, I selected "Run" -> "[LAMW] Build Apk and Run" but got Fatal: [Exception] Failed: Cannot run APK! These are all my Messages: Messages, Hints: 2 Verbose: Selected chip architecture: armeabi-v7a Verbose: Taking libraries from folder: C:\Users\Andy\Desktop\Android\AppLAMWProject2\libs\armeabi-v7a Verbose: Found library: libcontrols.so Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\Users\ Andy\Desktop\Android\AppLAMWProject2\obj\controls\controls.o" Note: Duplicate unit "controls" in "LCLBase 3.8", ppu="C:\lamw_manager\LAMW\LAMW4Windows\lazarus_trunk\lcl\units\arm- android\controls.ppu", source="C:\lamw_manager\LAMW\LAMW4Windows\lazar us_trunk\lcl\controls.pp" Project: Executing command before: Success before build... Compile Project, OS: android, CPU: arm, Target: C:\Users\Andy\Desktop\ Android\AppLAMWProject2\libs\armeabi-v7a\libcontrols.so: Success Project: Executing command after: Success after build... Building APK (Gradle)... : Success Starting APK (Gradle)... : FAILURE: Build failed with an exception., Errors: 1 Fatal: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':installDebug'. > com.android.builder.testing.api.DeviceException: No online devices found. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.5/userguid e/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 8s 34 actionable tasks: 1 executed, 33 up-to-date Exception, Errors: 1 Fatal: [Exception] Failed: Cannot run APK! ---------------------------------------------------------------------- dseligo · 2025-07-09 09:44 Quote from: Bandy on July 09, 2025, 10:41:42 am> com.android.builder.testing.api.DeviceException: No online devices found. This is your problem. Maybe you didn't accept connection on the phone after connecting it to the computer. You can check available devices with 'adb' tool in command line like this (it should be one entry below text 'List of devices attached'): \sdk\platform-tools\adb devices Until you don't have your device listed here, you won't be able to upload apk to the phone. Try different cable. After you succeed to connect your phone to your computer, you can also use Wifi to connect to your phone. But it must be connected via USB cable first to start server on the phone: \sdk\platform-tools\adb tcpip 5555 After that you can connect to the phone with this command (change IP address to that of your phone): \sdk\platform-tools\adb connect 192.168.1.123 Another thing. After you succeed in connecting your phone, you might want to change architecture from armeabi-v7a to Aarch64. ---------------------------------------------------------------------- Bandy · 2025-07-09 12:53 I didn't accepted connection on the phone after connecting it to the computer. My device is listed in 'List of devices attached', see attachment. Now I have a working Hello World app for armeabi-v7a. Thank you, dseligo, you're a HERO!!! Why do you recommend changing architecture from armeabi-v7a to Aarch64 and where do I make this modification? LAMW4Windows will work if I update Windows 10 to Windows 11? ---------------------------------------------------------------------- dseligo · 2025-07-09 13:25 Quote from: Bandy on July 09, 2025, 02:53:02 pmI didn't accepted connection on the phone after connecting it to the computer. My device is listed in 'List of devices attached', see attachment. Now I have a working Hello World app for armeabi-v7a. Thank you, dseligo, you're a HERO!!! Great, glad it worked. QuoteWhy do you recommend changing architecture from armeabi-v7a to Aarch64 and where do I make this modification? I recently had one project and armeabi-v7a didn't work on my Phone (Galaxy S23). If it's working for you, you don't have to change it (armeabi-v7a is 32-bit, and Aarch is 64-bit, and different instruction set). You change architecture in Project Options, [LAMW] Android Project Options, Build. You have Chipset setting there. After change do 'Clean up and Build' in Lazarus. QuoteLAMW4Windows will work if I update Windows 10 to Windows 11? I guess it will. I have Windows 11, I installed it with FPCUPdeluxe. P.S.: Added where chipset is changed. ---------------------------------------------------------------------- dseligo · 2025-07-09 13:31 Quote from: Bandy on July 07, 2025, 02:00:11 pmI don't know where demo apps are located. I want to answer you to this, because there are many demos and they are really useful. Some of them need some tweaking to work (mostly change architecture). I have them in: \fpc-lazarus\ccr\lamw\demos\GUI ---------------------------------------------------------------------- Guser979 · 2025-07-09 21:22 About the error " Error while linking :" Don't forget to export the configuration that's working for you now. It may be helpful: Go to Menu: Project > Project Options > Compiler Options > Paths And the "Export" button Example: Open a LAMW demo Go to Menu: Project\Project Options\Compiler Options\Paths\ And the "Import" button Go to Menu: Project > Project Options > [LAMW] Android Project Options And make sure the Target SDK Version is correct and Make sure the Chipset is correct. Make sure the demo's JNI folder contains the following files: \jni\after_build.sh \jni\before_build.bat \jni\before_build.sh \jni\after_build.bat If they don't exist, you can copy them from any JNI folder where a compilation was successful. Then, Compile. If no errors occur, you can try building and running the APK. Note 1: Some errors may occur related to AndroidManifest.xml (very old, etc.), in which case you will need to update this file to meet the new requirements. Note 2: It may also be necessary to convert to a suitable theme. Go to: Menu: Tools > [LAMW] Android Module Wizard > Convert the project to AppCompat Theme This conversion may cause an error. Usually, simply close the project and reopen it,  and making sure the theme is correct. Go to: Menu: Project > Project Options > [LAMW] Android Project Options A compatible theme should appear in the Application tab. ---------------------------------------------------------------------- Bandy · 2025-07-10 10:55 Now... about Write Once, Compile Anywhere. I have an app for Windows written in Lazarus IDE v4.0 for Windows. How can I just compile it for Android? ---------------------------------------------------------------------- tetrastes · 2025-07-11 09:50 You can't. Except your program is for command line and you don't use any OS specific stuff. ---------------------------------------------------------------------- Bandy · 2025-07-12 09:05 And what does Write Once, Compile Anywhere mean? ---------------------------------------------------------------------- Martin_fr · 2025-07-12 09:44 Quote from: Bandy on July 12, 2025, 11:05:41 amAnd what does Write Once, Compile Anywhere mean? It means, that it is possible to write code (i.e. "some code") that compiles "anywhere" (on all FPC supported targets). It does not mean, that any or every code written will do that. Obviously, e.g. code directly using Android only features wont compile on the Amiga (and less obvious cases also exists...). Yes, I am aware that this answer is not helpful. But since you are pushing this question (which doesn't solve your problem), well this is the answer (or rather "an answer"). As for your original question(s): Sorry, I don't have any Android background myself. So I can't answer that.