Recent

Author Topic: program distribution problems and raspberry programs  (Read 1752 times)

young_nandy

  • New Member
  • *
  • Posts: 41
program distribution problems and raspberry programs
« on: July 21, 2022, 03:33:27 am »
Hello,

I want to ask a few questions:

1. What types of files other than (exe) should I bring when I want to distribute a program that is connected to the database to the customer's computer?

2. when I created the Lazarus program on Raspberry which was installed on VirtualBox on Windows OS (https://www.raspberrypi.com/software/raspberry-pi-desktop/). Can it automatically be used / distributed on raspberries installed on the raspberry hardware itself? or is there a certain conversion?

3. when I make a program with lazarus on linux (eg fedora), can the source code be compiled on lazarus installed on raspberry (ubuntu OS, note: the OS is the same as linux).

Yours faithfully,

yudianto


Handoko

  • Hero Member
  • *****
  • Posts: 5458
  • My goal: build my own game engine using Lazarus
Re: program distribution problems and raspberry programs
« Reply #1 on: July 21, 2022, 04:51:46 am »
1. What types of files other than (exe) should I bring when I want to distribute a program that is connected to the database to the customer's computer?

That depends on what database the program uses. For example, I have a program that uses Firebird, I need to include the *.fdb files. And I have program that uses TDBF, the database files I need to include are *.dbf and *.dbt. But actually those dbf and dbt files are not required, because I wrote the code to auto-generate those missing files.

Also, some databases require the installation of server program and/or client library. You really need to read their distribution instruction. This is the short guide:

https://wiki.lazarus.freepascal.org/Databases

3. when I make a program with lazarus on linux (eg fedora), can the source code be compiled on lazarus installed on raspberry (ubuntu OS, note: the OS is the same as linux).

Do you not know "Lazarus/FPC - write once compile anywhere" ? That's true. But to be able to write source code that is cross-platform, it has many requirements:
- Do not use any OS/hardware/platform specific API, commands, behaviors
- If it uses any 3rd party library, make sure it is installed on the target system
- Understand where and how files being store on the target platform
- Able to deal with the display and font issues
- You may need to use compiler conditional directive
« Last Edit: July 21, 2022, 04:54:22 am by Handoko »

af0815

  • Hero Member
  • *****
  • Posts: 1392
Re: program distribution problems and raspberry programs
« Reply #2 on: July 21, 2022, 07:03:47 am »
No problem to crosscompile a program from win to RasPi and Linux. But you must have the correct layout for the needed libs for each target. And eg. all targets can use connections to a MS SQL server. No problem and working for ages.

I have only on one RasPi a installation of Lazazarus, but i have only needed for thest with the I/Os. Bevcause this can only be done on a real device.
regards
Andreas

PascalDragon

  • Hero Member
  • *****
  • Posts: 6035
  • Compiler Developer
Re: program distribution problems and raspberry programs
« Reply #3 on: July 21, 2022, 08:49:02 am »
2. when I created the Lazarus program on Raspberry which was installed on VirtualBox on Windows OS (https://www.raspberrypi.com/software/raspberry-pi-desktop/). Can it automatically be used / distributed on raspberries installed on the raspberry hardware itself? or is there a certain conversion?

The Raspberry Pi Desktop is an x86 variant of the OS used for the Raspberry Pi hardware. So no you can't just use a binary from there to run on the Pi as you need to compile your application for arm-linux or aarch64-linux instead of i386-linux or x86_64-linux.

young_nandy

  • New Member
  • *
  • Posts: 41
Re: program distribution problems and raspberry programs
« Reply #4 on: July 21, 2022, 11:58:31 am »
2. when I created the Lazarus program on Raspberry which was installed on VirtualBox on Windows OS (https://www.raspberrypi.com/software/raspberry-pi-desktop/). Can it automatically be used / distributed on raspberries installed on the raspberry hardware itself? or is there a certain conversion?

The Raspberry Pi Desktop is an x86 variant of the OS used for the Raspberry Pi hardware. So no you can't just use a binary from there to run on the Pi as you need to compile your application for arm-linux or aarch64-linux instead of i386-linux or x86_64-linux.


it's very inconvenient to have to compile again. by the way thanks for the information.

Yours faithfully

Yudianto

young_nandy

  • New Member
  • *
  • Posts: 41
Re: program distribution problems and raspberry programs
« Reply #5 on: July 21, 2022, 12:00:55 pm »
1. What types of files other than (exe) should I bring when I want to distribute a program that is connected to the database to the customer's computer?

That depends on what database the program uses. For example, I have a program that uses Firebird, I need to include the *.fdb files. And I have program that uses TDBF, the database files I need to include are *.dbf and *.dbt. But actually those dbf and dbt files are not required, because I wrote the code to auto-generate those missing files.

Also, some databases require the installation of server program and/or client library. You really need to read their distribution instruction. This is the short guide:

https://wiki.lazarus.freepascal.org/Databases

3. when I make a program with lazarus on linux (eg fedora), can the source code be compiled on lazarus installed on raspberry (ubuntu OS, note: the OS is the same as linux).

Do you not know "Lazarus/FPC - write once compile anywhere" ? That's true. But to be able to write source code that is cross-platform, it has many requirements:
- Do not use any OS/hardware/platform specific API, commands, behaviors
- If it uses any 3rd party library, make sure it is installed on the target system
- Understand where and how files being store on the target platform
- Able to deal with the display and font issues
- You may need to use compiler conditional directive


I mean for case number 1, the resulting files from lazarus are not from the database. for example like in delphi, besides the exe file there is also a file with the DCU type that must be included.

Yours faithfully,

Yudianto

young_nandy

  • New Member
  • *
  • Posts: 41
Re: program distribution problems and raspberry programs
« Reply #6 on: July 21, 2022, 12:05:14 pm »
No problem to crosscompile a program from win to RasPi and Linux. But you must have the correct layout for the needed libs for each target. And eg. all targets can use connections to a MS SQL server. No problem and working for ages.

I have only on one RasPi a installation of Lazazarus, but i have only needed for thest with the I/Os. Bevcause this can only be done on a real device.


Thank you for the information.

Yours faithfully

yudianto

af0815

  • Hero Member
  • *****
  • Posts: 1392
Re: program distribution problems and raspberry programs
« Reply #7 on: July 21, 2022, 12:31:28 pm »
I mean for case number 1, the resulting files from lazarus are not from the database. for example like in delphi, besides the exe file there is also a file with the DCU type that must be included.
BTW: Lazarus IS NOT Delphi. Lazarus is based on FPC. And you should know, FPC have a FCL and Lazarus extend/use this in its LCL. So the internal structure is different and can use the FPC feature of compiling and crosscompiling on/to many platforms.
regards
Andreas

PascalDragon

  • Hero Member
  • *****
  • Posts: 6035
  • Compiler Developer
Re: program distribution problems and raspberry programs
« Reply #8 on: July 21, 2022, 01:44:28 pm »
it's very inconvenient to have to compile again. by the way thanks for the information.

That's how it is. You can't expect a i386-win32 program to suddenly be a x86_64-win64 or i386-linux program either. You could however set up your toolchain once correctly and then you can compile correctly from your source system.

I mean for case number 1, the resulting files from lazarus are not from the database. for example like in delphi, besides the exe file there is also a file with the DCU type that must be included.

The DCU is the compiled unit file (the FPC equivalent is the pair of PPU and O file). You don't need those if you compile from source (only for closed source components) or when you distribute it as binary, cause the compiled unit is only required by the compiler not the compiled program.

young_nandy

  • New Member
  • *
  • Posts: 41
Re: program distribution problems and raspberry programs
« Reply #9 on: July 22, 2022, 01:06:26 am »
I mean for case number 1, the resulting files from lazarus are not from the database. for example like in delphi, besides the exe file there is also a file with the DCU type that must be included.
BTW: Lazarus IS NOT Delphi. Lazarus is based on FPC. And you should know, FPC have a FCL and Lazarus extend/use this in its LCL. So the internal structure is different and can use the FPC feature of compiling and crosscompiling on/to many platforms.


Thank You. I know about this problem. I just show an example in Delphi only.

Yours faithfully

yudianto

young_nandy

  • New Member
  • *
  • Posts: 41
Re: program distribution problems and raspberry programs
« Reply #10 on: July 22, 2022, 01:11:47 am »
it's very inconvenient to have to compile again. by the way thanks for the information.

That's how it is. You can't expect a i386-win32 program to suddenly be a x86_64-win64 or i386-linux program either. You could however set up your toolchain once correctly and then you can compile correctly from your source system.

I mean for case number 1, the resulting files from lazarus are not from the database. for example like in delphi, besides the exe file there is also a file with the DCU type that must be included.

The DCU is the compiled unit file (the FPC equivalent is the pair of PPU and O file). You don't need those if you compile from source (only for closed source components) or when you distribute it as binary, cause the compiled unit is only required by the compiler not the compiled program.


sorry, does that mean I only need the exe files and library files for database connection only, if I'm going to distribute a program?

Yours faithfully,

Yudianto

PascalDragon

  • Hero Member
  • *****
  • Posts: 6035
  • Compiler Developer
Re: program distribution problems and raspberry programs
« Reply #11 on: July 22, 2022, 08:53:50 am »
sorry, does that mean I only need the exe files and library files for database connection only, if I'm going to distribute a program?

Correct. DCU files are not required for the application to work correctly. You also don't need any RES files as they become part of the program binary.

young_nandy

  • New Member
  • *
  • Posts: 41
Re: program distribution problems and raspberry programs (solved)
« Reply #12 on: July 23, 2022, 02:38:12 pm »
thanks to all who have provided answers.

Yours faithfully

yudianto

 

TinyPortal © 2005-2018