Recent

Author Topic: Running Ubuntu 64 bit but trying to target 32?  (Read 13602 times)

jdredd

  • New Member
  • *
  • Posts: 23
Running Ubuntu 64 bit but trying to target 32?
« on: March 10, 2011, 05:20:43 pm »
I have a system that runs Ubuntu 64 bit. So when I compile things, only works on 64bit machines.

I did some searching, but couldn't come up with a full answer on what all needs done to target 32bit (i386) ?

I can switch to that target, but when I do fpc -i , i have no i386 targets.. only 64bit ones.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #1 on: March 11, 2011, 04:47:22 am »
When your cross target is a different architecture (instead of just OS), you need to build the cross compiler. Read the wiki for a how-to. For i386-linux target, you also need to build binutils' cross linker (only the assembler currently exists internally in the compiler).

jdredd

  • New Member
  • *
  • Posts: 23
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #2 on: March 11, 2011, 06:17:35 am »
ya, i found that a bit ago.. it seemed like things were almost there.. in the codetyphoon launcher, it showed 32bit FPC was available... but not 32bit lazarus... and i couldn't launch it anymore...

been messing around trying to reinstall again, and still being a pain :(

jdredd

  • New Member
  • *
  • Posts: 23
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #3 on: March 11, 2011, 09:54:47 pm »
was using codetyphoon to do all this, but something didnt seem quite right.

just used apt-get to get fpc and lazarus.

its installed and runs.

in the help document

http://wiki.freepascal.org/Cross_compiling

it has this section

    * Compile FPC:

bash $ make all CPU_TARGET=i386


it doesn't say what folder to go to. And folders I tried, didn't work.

Blaazen

  • Hero Member
  • *****
  • Posts: 3238
  • POKE 54296,15
    • Eye-Candy Controls
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #4 on: March 11, 2011, 10:22:38 pm »
It must be folder where you have fpc sources (i.e. where is makefile).
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

jdredd

  • New Member
  • *
  • Posts: 23
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #5 on: March 11, 2011, 11:24:59 pm »
i looked for one earlier, but could not find one that did what it was suppose to do.

there seems to be multiple different ways to install FPC and Lazarus over the years.

Ive done it from codetyphoon, apt-get, downloading svn's ... but things don't seem to go right. Kind of a headache. I got it so FPC was in there and had a ppc for i386 and x86_64
 but lazarus couldn't find things so couldn't compile anything. Always missing units?

With the latest Ubuntu... what is the current "recommended" way to get FPC 64bit/32bit for linux installed and then Lazarus for it installed.

--- Edit ---

I went through and located and removed all instances of FPC and Lazarus that was installed by the different methods... stuff was just everywhere.

Thus why I need a step by step on how to "properly" do it, as i think some older posts out there, isn't the proper way anymore. ?
« Last Edit: March 11, 2011, 11:43:38 pm by jdredd »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #6 on: March 12, 2011, 06:45:25 am »
Prerequisites: ld from binutils compiled with x86_64 to i386 cross linking
  • Install your 64-bit FPC and Lazarus as usual (i.e. from your repo). You should have FPC sources somewhere. I don't really remember, /usr/share/fpc perhaps, it should (at least) consist of these folders: compiler, ide, rtl, packages
  • Now open your terminal and go to that folder
  • Type make all CPU_TARGET=i386, if everything went OK, now call make cross_install CPU_TARGET=i386 INSTALL_PREFIX=<fpc base dir, usually /usr>. Make sure it's the directory where your 64-bit FPC exists
  • Make ppcross386 symlink in <fpc base dir>/bin directory (you can check with ls -l to ppcx64 to see that it's also a symlink to <fpc base dir>/lib/fpc/<fpc version>/ppcx64
  • Open Lazarus, Build LCL for i386, use the configure build Lazarus dialog
  • Done

jdredd

  • New Member
  • *
  • Posts: 23
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #7 on: March 12, 2011, 08:25:32 am »
Prerequisites: ld from binutils compiled with x86_64 to i386 cross linking
  • Install your 64-bit FPC and Lazarus as usual (i.e. from your repo). You should have FPC sources somewhere. I don't really remember, /usr/share/fpc perhaps, it should (at least) consist of these folders: compiler, ide, rtl, packages
  • Now open your terminal and go to that folder
  • Type make all CPU_TARGET=i386, if everything went OK, now call make cross_install CPU_TARGET=i386 INSTALL_PREFIX=<fpc base dir, usually /usr>. Make sure it's the directory where your 64-bit FPC exists
  • Make ppcross386 symlink in <fpc base dir>/bin directory (you can check with ls -l to ppcx64 to see that it's also a symlink to <fpc base dir>/lib/fpc/<fpc version>/ppcx64
  • Open Lazarus, Build LCL for i386, use the configure build Lazarus dialog
  • Done

Thanks for the help, it got a bit further.. I am not sure trying to use CodeTyphoon is my best route or not.

The make cross_install CPU_TARGET=i386 INSTALL_PREFIX=<fpc base dir, usually /usr>
would not work for me. i get this

"make: *** No rule to make target 'cross_install'. Stop. "

from the wiki I did do the  bash $ su -c "make install CPU_TARGET=i386"

and that worked it seemed... when i loaded codetyphon, it now showed FPC 64bit and 32bit.
i have a ppc386 executable now that runs.

in Lazarus i built the LCL with i386 target... and no errors. and in my test project i put the target to i386. It compiled and ran. But it still seems to build it as a 64bit app.

When i do "file project1." it shows it being a x86-64 .

If CodeTyphoon is not the way to go, i can attempt to clear it all out again.

If go that route, got any tips on how to get these things both installed and compiled properly? I still struggle with linux, plus when i keep finding different instructions for this process, it throws me for a loop  :(

Sternas Stefanos

  • Full Member
  • ***
  • Posts: 170
  • Ex Pilot, M.Sc, Ph.D
    • http://www.pilotlogic.com
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #8 on: March 12, 2011, 08:54:40 am »
My suggestion is to use VirtualBox emulation to
build 32bit linux applications on 64bit linux System

We don't start CodeTyphon cross build ability for linux yet...
CodeTyphon Architect and Programmer

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #9 on: March 12, 2011, 09:52:30 am »
Quote
The make cross_install CPU_TARGET=i386 INSTALL_PREFIX=<fpc base dir, usually /usr>
would not work for me. i get this

"make: *** No rule to make target 'cross_install'. Stop. "
Sorry, it should be crossinstall (no underscore)

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #10 on: March 12, 2011, 01:03:06 pm »
  • Make ppcross386 symlink in <fpc base dir>/bin directory (you can check with ls -l to ppcx64 to see that it's also a symlink to <fpc base dir>/lib/fpc/<fpc version>/ppcx64

How made this?
Now i have the executable ppcross386 in /usr/lib/fpc/2.5.1/

I must write
Code: [Select]
ln -s /usr/lib/fpc/2.5.1/ppcross386 /usr/bin/fpc
It's correct?

Thanks, Mario

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Running Ubuntu 64 bit but trying to target 32?
« Reply #11 on: March 12, 2011, 06:41:15 pm »
Quote
I must write

ln -s /usr/lib/fpc/2.5.1/ppcross386 /usr/bin/fpc

It's correct?
No:
Code: [Select]
ln -s /usr/lib/fpc/2.5.1/ppcross386 /usr/bin/ppcross386Your fpc is a true binary. It's a driver program responsible to execute the correct ppcXXX based on given -P argument.

 

TinyPortal © 2005-2018