Lazarus

Free Pascal => Unix => Topic started by: nullpointer on July 04, 2017, 08:27:30 am

Title: Running a program compiled by Lazarus in another linux
Post by: nullpointer on July 04, 2017, 08:27:30 am
I tried to make a simple application using lazarus in linux (Ubuntu 16.04).
After compile it, I try to run the compiled app in another linux machine but the app cannot run.
I've tried using chmod + x appname command but nothing happen. the App can only run on ubuntu 16.04.
what the problem?
Title: Re: Running a program compiled by Lazarus in another linux
Post by: Thaddy on July 04, 2017, 08:53:33 am
Try this simple program and see if that will run on both machines. If it does, you have a dependency issue and probably have to install some libraries on the other machine or link statically.
Save and compile it from a console as: fpc -CX -XXs test.pas run as ./test
Code: Pascal  [Select][+][-]
  1. program test;
  2. // program without external dependencies
  3. begin
  4.   writeln('test');
  5.   readln;
  6. end.

Also:
- has the second machine a compatible processor? i.e. you can't run arm code on an intel
- has the second machine the same bitness? you can't run 64 bit code on a 32 bit installation
Title: Re: Running a program compiled by Lazarus in another linux
Post by: Handoko on July 04, 2017, 10:08:42 am
To check your application setting for machine compatibility (as what Thaddy said), do this:
Lazarus main menu > Project > Project Options > Config and Target
Title: Re: Running a program compiled by Lazarus in another linux
Post by: nullpointer on July 05, 2017, 01:52:53 am
Try this simple program and see if that will run on both machines. If it does, you have a dependency issue and probably have to install some libraries on the other machine or link statically.
Save and compile it from a console as: fpc -CX -XXs test.pas run as ./test
Code: Pascal  [Select][+][-]
  1. program test;
  2. // program without external dependencies
  3. begin
  4.   writeln('test');
  5.   readln;
  6. end.

Also:
- has the second machine a compatible processor? i.e. you can't run arm code on an intel
- has the second machine the same bitness? you can't run 64 bit code on a 32 bit installation

thank you thaddy.
i think, it may i compiled on 64 bit and run it on 32 bit.
Title: Re: Running a program compiled by Lazarus in another linux
Post by: nullpointer on July 05, 2017, 01:54:09 am
To check your application setting for machine compatibility (as what Thaddy said), do this:
Lazarus main menu > Project > Project Options > Config and Target

terima kasih solusinya mas bro.
salam kenal.  :D
Title: Re: Running a program compiled by Lazarus in another linux
Post by: Handoko on July 05, 2017, 06:50:00 am
 :D Nice to meet you here.
Title: Re: Running a program compiled by Lazarus in another linux
Post by: marcov on July 05, 2017, 11:56:20 am
ldd ./appname

and

file appname

can give you some info. Specially if you compare it with binaries that come with the distribution
Title: Re: Running a program compiled by Lazarus in another linux
Post by: Thaddy on July 05, 2017, 12:04:37 pm
Marco, he tried to run a 64bit compiled executable on a 32 bit platform...
Title: Re: Running a program compiled by Lazarus in another linux
Post by: nullpointer on July 06, 2017, 08:59:23 am
Why in windows there is no difference between 32 and 64.
app that are compiled on a 32 bit can also run on 64 bits.  %)
Title: Re: Running a program compiled by Lazarus in another linux
Post by: Thaddy on July 06, 2017, 09:52:26 am
But not the other way around. 64 bit won't run on 32 bit.
In linux this is the same, but on most systems you have to install multi-arch to run 32 bit code on 64 bit linux.
sudo apt-get install multiarch-support for debians like ubuntu.

Alternatvely you can install a chrooted minimal 32 bit subsystem, but that's more complex.
TinyPortal © 2005-2018