Recent

Author Topic: Running a program compiled by Lazarus in another linux  (Read 8339 times)

nullpointer

  • New Member
  • *
  • Posts: 35
  • impossible is nothing
    • tauhidslab
Running a program compiled by Lazarus in another linux
« 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?
« Last Edit: July 04, 2017, 08:47:22 am by nullpointer »

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Running a program compiled by Lazarus in another linux
« Reply #1 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
« Last Edit: July 04, 2017, 09:23:07 am by Thaddy »
Specialize a type, not a var.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Running a program compiled by Lazarus in another linux
« Reply #2 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

nullpointer

  • New Member
  • *
  • Posts: 35
  • impossible is nothing
    • tauhidslab
Re: Running a program compiled by Lazarus in another linux
« Reply #3 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.

nullpointer

  • New Member
  • *
  • Posts: 35
  • impossible is nothing
    • tauhidslab
Re: Running a program compiled by Lazarus in another linux
« Reply #4 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

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Running a program compiled by Lazarus in another linux
« Reply #5 on: July 05, 2017, 06:50:00 am »
 :D Nice to meet you here.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Running a program compiled by Lazarus in another linux
« Reply #6 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

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Running a program compiled by Lazarus in another linux
« Reply #7 on: July 05, 2017, 12:04:37 pm »
Marco, he tried to run a 64bit compiled executable on a 32 bit platform...
Specialize a type, not a var.

nullpointer

  • New Member
  • *
  • Posts: 35
  • impossible is nothing
    • tauhidslab
Re: Running a program compiled by Lazarus in another linux
« Reply #8 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.  %)

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Running a program compiled by Lazarus in another linux
« Reply #9 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.
« Last Edit: July 06, 2017, 09:57:34 am by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018