Recent

Author Topic: Can't get 32 bit packages installed  (Read 7742 times)

geraldholdsworth

  • Sr. Member
  • ****
  • Posts: 286
Can't get 32 bit packages installed
« on: January 06, 2021, 12:19:19 pm »
Hi all,

First of all, I know pretty much nothing about Linux and have only recently begun to use it. Even then, I mostly use it for compiling my project for Linux (I mainly use macOS and Windows).

So, I've installed Linux Mint Cinnamon (version 20) 64 bit on Oracle VirtualBox on my Mac (host OS is High Sierra), and installed Lazarus 2.0.10 64 bit (plus the appropriate FPC packages...3.2.0, I think). On my three Lazarus installs (the host OS, macOS, another VB install, Windows, and Linux) I'm trying to cross compile so I get 64 bit and 32 bit binaries of my project, on all three platforms. OK for macOS and Windows, but not for Linux.

I've followed the guide here but whenever I try (under Project options, Config and Target, Target OS: Linux, Target CPU: i386, eveything else left default for Release) it complains 'Compiler "/usr/bin/fpc" does not support target i386-linux'.

I have managed to find out how to be in Terminal as root, but that still didn't help.

Thanks in advance,

Gerald.

dbannon

  • Hero Member
  • *****
  • Posts: 3723
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Can't get 32 bit packages installed
« Reply #1 on: January 06, 2021, 01:21:29 pm »
Please type the following command to see if you have whats needed -

which ppcross386 <enter>

which i386-linux-ld <enter>

which i386-linux-as <enter>

The first one is the actual compiler, fpc is just a command that chooses the right compiler for the job you are doing.  If ppcross32 is not found, then we need to see which step in those instructions has gone wrong.

D

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

geraldholdsworth

  • Sr. Member
  • ****
  • Posts: 286
Re: Can't get 32 bit packages installed
« Reply #2 on: January 06, 2021, 02:09:46 pm »
Hi,

The first command returns nothing, while the second two return:
/usr/bin/i386-linux-ld and /usr/bin/i386-linux-as
I actually had to manually create those two as the commands given did not do it for me automatically.

Cheers,

Gerald.

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Can't get 32 bit packages installed
« Reply #3 on: January 06, 2021, 03:05:11 pm »
I actually had to manually create those two as the commands given did not do it for me automatically.

You shouldn't have to manually create anything: if which gives you nothing it means that it's not there, as it does here (since I don't have 32bit binutils here). You can make double sure by trying to find any as (or ld) in your computer with:
Code: [Select]
find / -iname "*-as" 2> /dev/nullMake sure to redirect errors, since there will be quite a lot of them due to unreachable directories (unless you're root, o.c.)

In my case that outputs (logically enough):
Code: [Select]
/usr/bin/x86_64-linux-gnu-as
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

geraldholdsworth

  • Sr. Member
  • ****
  • Posts: 286
Re: Can't get 32 bit packages installed
« Reply #4 on: January 06, 2021, 05:31:47 pm »
I get:
Code: [Select]
/usr/bin/x86_64-linux-gnu-as
/usr/bin/i386-linux-as

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12172
  • Debugger - SynEdit - and more
    • wiki
Re: Can't get 32 bit packages installed
« Reply #5 on: January 06, 2021, 06:02:56 pm »
First of all, I know pretty much nothing about Linux and have only recently begun to use it. Even then, I mostly use it for compiling my project for Linux (I mainly use macOS and Windows).

You are coming from Mac. On Mac (afaik) fpc is by default installed in such a way that it can build 64 and 32 bit binaries.

On the other Platforms this in not the case.
That gives 2 options.

- You have 2 independent fpc installs (rather tricky on linux).
- You use a cross compiler

On Windows there are installers for cross compilers. Once the cross compiler is installed you can change the "target" settings for the project.

If you use 2 independent fpc then you need to change compiler in Tools >Options.


I am not sure, if there is an installer for a cross compiler on linux.
If there is => good.

If not...
You could install an independent 32 bit fpc, but then the 2 fpc will have a fight for /etc/fpc.cfg
That can be solved, but needs a bit of knowlegde.

You can build a cross compiler yourself.

You can try fpcupdeluxe (I have not used it myself, but many people seem to think it is really good).

MarkMLl

  • Hero Member
  • *****
  • Posts: 8545
Re: Can't get 32 bit packages installed
« Reply #6 on: January 06, 2021, 06:03:33 pm »
The first command returns nothing, while the second two return:
/usr/bin/i386-linux-ld and /usr/bin/i386-linux-as
I actually had to manually create those two as the commands given did not do it for me automatically.

Create them /how/ exactly? You've not done something terminally lackwitted like symlinking a 64-bit to a 32-bit assembler have you?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

geraldholdsworth

  • Sr. Member
  • ****
  • Posts: 286
Re: Can't get 32 bit packages installed
« Reply #7 on: January 06, 2021, 07:21:53 pm »
Create them /how/ exactly? You've not done something terminally lackwitted like symlinking a 64-bit to a 32-bit assembler have you?
I created them in the text editor, exactly as they are shown on the page, then saved them to the location specified.

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Can't get 32 bit packages installed
« Reply #8 on: January 06, 2021, 09:20:13 pm »
I get:
Code: [Select]
/usr/bin/x86_64-linux-gnu-as
/usr/bin/i386-linux-as

Try this:
Code: [Select]
ls -l /usr/bin/i386-linux-asif it tells you something like:
Code: [Select]
lrwxrwxrwx 1 root root 19 jun 18  2020 /usr/bin/i386-linux-as -> x86_64-linux-gnu-asthen you did what Mark so delicately termed "something terminally lackwitted" ... though I don't think that's the case here ;)

If what you did was to create create both scripts (as the wiki says to do) then try
Code: [Select]
as --target-helpand see if the option --32 is supported (you might have to scroll up the view a little: there are quite some target-specific options: Shift+PgUp is your friend for that)

Conversely, for ld try:
Code: [Select]
ld -VIt should give something like:
Code: Bash  [Select][+][-]
  1. $ ld -V
  2. GNU ld (GNU Binutils for Ubuntu) 2.30
  3.   Emulaciones admitidas:
  4.    elf_x86_64
  5.    elf32_x86_64
  6.    elf_i386
  7.    elf_iamcu
  8.    i386linux
  9.    elf_l1om
  10.    elf_k1om
  11.    i386pep
  12.    i386pe
All those lines with "i386" mean that ld is capable of generating 32bit targets (o.c. if it finds 32bit static libs and objects).
« Last Edit: January 06, 2021, 09:22:58 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8545
Re: Can't get 32 bit packages installed
« Reply #9 on: January 06, 2021, 09:40:55 pm »
...what Mark so delicately termed "something terminally lackwitted" ... though I don't think that's the case here ;)

I was certainly /hoping/ it wasn't the case, but it appeared to be a possibility that nobody'd considered in earlier messages.

And, of course, is the sort of trap that probably all of us here fell into when Linux (and unix in general) was much less mature, and Google wasn't ready with faux-documentation.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

geraldholdsworth

  • Sr. Member
  • ****
  • Posts: 286
Re: Can't get 32 bit packages installed
« Reply #10 on: January 06, 2021, 11:29:13 pm »
Try this:
Code: [Select]
ls -l /usr/bin/i386-linux-asif it tells you something like:
Code: [Select]
lrwxrwxrwx 1 root root 19 jun 18  2020 /usr/bin/i386-linux-as -> x86_64-linux-gnu-as
I get:
Code: [Select]
-rwxrwxrwx 1 root root 23 Jan  2 18:54 /usr/bin/i386-linux-asSo it does look like I've done what Mark had suggested.
Code: [Select]
as --target-help
returns:
Code: [Select]
  -Qy, -Qn                ignored
  -V                      print assembler version number
  -k                      ignored
  -n                      Do not optimise code alignment
  -q                      quieten some warnings
  -s ignored
  --32/--64/--x32         generate 32bit/64bit/x32 code
  --divide ignored
  -march=CPU[,+EXTENSION...]
                          generate code for CPU and EXTENSION, CPU is one of:
                           generic32, generic64, i386, i486, i586, i686,
                           pentium, pentiumpro, pentiumii, pentiumiii, pentium4,
                           prescott, nocona, core, core2, corei7, l1om, k1om,
                           iamcu, k6, k6_2, athlon, opteron, k8, amdfam10,
                           bdver1, bdver2, bdver3, bdver4, znver1, znver2,
                           btver1, btver2
                          EXTENSION is combination of:
                           8087, 287, 387, 687, cmov, fxsr, mmx, sse, sse2,
                           sse3, ssse3, sse4.1, sse4.2, sse4, avx, avx2,
                           avx512f, avx512cd, avx512er, avx512pf, avx512dq,
                           avx512bw, avx512vl, vmx, vmfunc, smx, xsave,
                           xsaveopt, xsavec, xsaves, aes, pclmul, fsgsbase,
                           rdrnd, f16c, bmi2, fma, fma4, xop, lwp, movbe, cx16,
                           ept, lzcnt, hle, rtm, invpcid, clflush, nop, syscall,
                           rdtscp, 3dnow, 3dnowa, padlock, svme, sse4a, abm,
                           bmi, tbm, adx, rdseed, prfchw, smap, mpx, sha,
                           clflushopt, prefetchwt1, se1, clwb, avx512ifma,
                           avx512vbmi, avx512_4fmaps, avx512_4vnniw,
                           avx512_vpopcntdq, avx512_vbmi2, avx512_vnni,
                           avx512_bitalg, clzero, mwaitx, ospke, rdpid, ptwrite,
                           ibt, shstk, gfni, vaes, vpclmulqdq, wbnoinvd,
                           pconfig, waitpkg, cldemote, movdiri, movdir64b,
                           avx512_bf16, avx512_vp2intersect, enqcmd, rdpru,
                           mcommit, no87, no287, no387, no687, nocmov, nofxsr,
                           nommx, nosse, nosse2, nosse3, nossse3, nosse4.1,
                           nosse4.2, nosse4, noavx, noavx2, noavx512f,
                           noavx512cd, noavx512er, noavx512pf, noavx512dq,
                           noavx512bw, noavx512vl, noavx512ifma, noavx512vbmi,
                           noavx512_4fmaps, noavx512_4vnniw, noavx512_vpopcntdq,
                           noavx512_vbmi2, noavx512_vnni, noavx512_bitalg,
                           noibt, noshstk, nomovdiri, nomovdir64b,
                           noavx512_bf16, noavx512_vp2intersect, noenqcmd
  -mtune=CPU              optimise for CPU, CPU is one of:
                           generic32, generic64, i8086, i186, i286, i386, i486,
                           i586, i686, pentium, pentiumpro, pentiumii,
                           pentiumiii, pentium4, prescott, nocona, core, core2,
                           corei7, l1om, k1om, iamcu, k6, k6_2, athlon, opteron,
                           k8, amdfam10, bdver1, bdver2, bdver3, bdver4, znver1,
                           znver2, btver1, btver2
  -msse2avx               encode SSE instructions with VEX prefix
  -msse-check=[none|error|warning] (default: warning)
                          check SSE instructions
  -moperand-check=[none|error|warning] (default: warning)
                          check operand combinations for validity
  -mavxscalar=[128|256] (default: 128)
                          encode scalar AVX instructions with specific vector
                           length
  -mvexwig=[0|1] (default: 0)
                          encode VEX instructions with specific VEX.W value
                           for VEX.W bit ignored instructions
  -mevexlig=[128|256|512] (default: 128)
                          encode scalar EVEX instructions with specific vector
                           length
  -mevexwig=[0|1] (default: 0)
                          encode EVEX instructions with specific EVEX.W value
                           for EVEX.W bit ignored instructions
  -mevexrcig=[rne|rd|ru|rz] (default: rne)
                          encode EVEX instructions with specific EVEX.RC value
                           for SAE-only ignored instructions
  -mmnemonic=[att|intel] (default: att)
                          use AT&T/Intel mnemonic
  -msyntax=[att|intel] (default: att)
                          use AT&T/Intel syntax
  -mindex-reg             support pseudo index registers
  -mnaked-reg             don't require `%' prefix for registers
  -madd-bnd-prefix        add BND prefix for all valid branches
  -mshared                disable branch optimisation for shared code
  -mx86-used-note=[no|yes] (default: no)
                          generate x86 used ISA and feature properties
  -momit-lock-prefix=[no|yes] (default: no)
                          strip all lock prefixes
  -mfence-as-lock-add=[no|yes] (default: no)
                          encode lfence, mfence and sfence as
                           lock addl $0x0, (%{re}sp)
  -mrelax-relocations=[no|yes] (default: yes)
                          generate relax relocations
  -malign-branch-boundary=NUM (default: 0)
                          align branches within NUM byte boundary
  -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)
                          TYPE is combination of jcc, fused, jmp, call, ret,
                           indirect
                          specify types of branches to align
  -malign-branch-prefix-size=NUM (default: 5)
                          align branches with NUM prefixes per instruction
  -mbranches-within-32B-boundaries
                          align branches within 32 byte boundary
  -mamd64                 accept only AMD64 ISA [default]
  -mintel64               accept only Intel64 ISA
Code: [Select]
ld -V
gives:
Code: [Select]
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   elf_iamcu
   elf_l1om
   elf_k1om
   i386pep
   i386pe

dbannon

  • Hero Member
  • *****
  • Posts: 3723
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Can't get 32 bit packages installed
« Reply #11 on: January 06, 2021, 11:38:40 pm »
Hi geraldholdsworth, welcome back !

That looks pretty much as I expected, no reason to think you have made a syn link.  I should have asked you to cat out those two files just to be sure. An apparently insignificant error can be quite important.

ls   -l  /usr/bin/i386-linux-* <enter>

cat /usr/bin/i386-linux-as <enter>

cat /usr/bin/i386-linux-ld <enter>


Assuming they are OK, then I think you need to try rebuilding the compiler and then retry installing it. You will need to watch very carefull for error messages, you do see a lot of lines that are not all that bad but look pretty much the same as an error, especially to an inexperienced eye. Sad but true.

But lets see content of those two files first.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Can't get 32 bit packages installed
« Reply #12 on: January 07, 2021, 04:45:03 am »
So it does look like I've done what Mark had suggested.

No, no, look the crucial difference: in my example ls lists a symlink from one file to the other (note the "->") while yours lists a normal executable script, as was expected, and all the rest is OK :)

Follow Davo's (dbannon's) instructions above and let's hope it now works.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

geraldholdsworth

  • Sr. Member
  • ****
  • Posts: 286
Re: Can't get 32 bit packages installed
« Reply #13 on: January 07, 2021, 09:37:04 am »
Hi geraldholdsworth, welcome back !
Hi Davo,
Results are:
ls   -l  /usr/bin/i386-linux-* <enter>
Code: [Select]
-rwxrwxrwx 1 root root 23 Jan  2 18:54 /usr/bin/i386-linux-as
-rwxrwxrwx 1 root root 32 Jan  2 18:54 /usr/bin/i386-linux-ld
cat /usr/bin/i386-linux-as <enter>
Code: [Select]
#!/bin/bash
as --32 $@
cat /usr/bin/i386-linux-ld <enter>
Code: [Select]
#!/bin/bash
ld -A elf32-i386 $@

I have thought about doing a complete uninstall and reinstall. I originally installed all three DEB packages found on the downloads section.

Cheers,

Gerald.

dbannon

  • Hero Member
  • *****
  • Posts: 3723
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Can't get 32 bit packages installed
« Reply #14 on: January 07, 2021, 12:02:10 pm »
No mate, a full reinstall will probably give exactly the same issue.

Now, those two little file have both correct permissions and content.

I need you to re run the command to build the 32bit compiler -  Now, here I assume you have fpc installed from debs (downloaded from the Lazarus site) ? and I'm guessing that its fpc320, I am unsure of exactly the name of the dir in /usr/share/fpcsrc  so you will need to look before using in place of <version>
Code: Bash  [Select][+][-]
  1. $ cd /usr/share/fpcsrc/<version>
  2. $ sudo make clean all CPU_TARGET=i386
  3.  
Thats should make the compiler for us, it will take a few seconds to minutes depending on your system. Stop now and have a look at the text dumped on the screen, anything look like an error ?  if not, the next one

Code: Bash  [Select][+][-]
  1.  $ sudo make crossinstall CPU_TARGET=i386 INSTALL_PREFIX=/usr

After that, you should be able to see /usr/bin/ppcross386   

Code: Bash  [Select][+][-]
  1. ls -la /usr/bin/ppcross386

It might be a symlink. If its not there, scroll back and really check over those lines of text, there must be an indication of what went wrong in there.  Maybe take a scrape and post it here ?

Anyway, we will get there !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018