Recent

Author Topic: Crosscompiling in linux x86_64 - Help please!  (Read 5152 times)

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Crosscompiling in linux x86_64 - Help please!
« on: October 31, 2016, 05:02:35 pm »
I built fpc and lazarus from source, and can crosscompile to either:
Linux 64-bit and Windows 64-bit

or

Linux 32-bit and Windows 32-bit.
But not both.
I know I'm missing something obvious, but being a linux beginner, I know not what.

Currently, my fpc -i outputs:
Compiler CPU target: x86_64
and my make info outputs:
fpc ...... /usr/bin/ppcx64

I have executed the make all and crosscompile CPU_TARGET=i386 for linux and win32, also CPU_TARGET= x86_64 and the libraries are there for fpc.

I just can't get all the linux 32-bit/64-bit and Windows 32-bit and 64-bit targets to work.  It's SOO close, but I'm missing something simple, I'm sure.
My current configuration compiles linux x64 and Windows x64 with no problems.

FPC.......... /usr/bin/ppcx64
But.. When I try to compile for linux32 for example, I get the error:
Compile Project, Mode: Linux32, CPU: i386, Target: crossall_linux32: Exit code 256, Errors: 1
/usr/bin/ld: skipping incompatible //usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible //usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib//libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib//libpthread.a when searching for -lpthread
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: skipping incompatible //usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible //usr/lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib//libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib//libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
crossall.lpr(20,1) Error: Error while linking

I have no idea how to fix it.

I also have no idea what output/config files to show in order to diagnose my problem, so I'm hoping for an information request as a reply.

==edit== more info:
My Linux OS is 'tahr Puppy', which is an Ubuntu-compatible distro.  It's running on an x86_64 system.
The only Ubuntu Lazarus distribution was an older version, so I downloaded the Laz 1.6RC2 and fpc 3.0.0 sources, and compiled them.
« Last Edit: October 31, 2016, 05:13:30 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling in linux x86_64 - Help please!
« Reply #1 on: October 31, 2016, 05:41:49 pm »
But.. When I try to compile for linux32 for example, I get the error:
Compile Project, Mode: Linux32, CPU: i386, Target: crossall_linux32: Exit code 256, Errors: 1
/usr/bin/ld: skipping incompatible //usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible //usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib//libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib//libpthread.a when searching for -lpthread
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: skipping incompatible //usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible //usr/lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib//libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib//libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
crossall.lpr(20,1) Error: Error while linking

I have no idea how to fix it.
You need the 32-bit libraries and have -Fl option points to directory containing those libraries. In archlinux derivatives, there are multilib packages that install them. I don't know about other distros.

Handoko

  • Hero Member
  • *****
  • Posts: 5524
  • My goal: build my own game engine using Lazarus
Re: Crosscompiling in linux x86_64 - Help please!
« Reply #2 on: October 31, 2016, 06:09:40 pm »
The 32-bit libraries package name for Ubuntu 64-bit is libc6-dev-x32.

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Crosscompiling in linux x86_64 - Help please!
« Reply #3 on: October 31, 2016, 07:23:21 pm »
The 32-bit libraries package name for Ubuntu 64-bit is libc6-dev-x32.
Installed, but didn't fix it.

I think it's something more obvious and simple.

Imagine you are a windows user that is ignorant of the simplest thing when installing fpc/lazarus under linux.  Who can compile via source only because of simple wiki instructions.

Imagine you know next-to-nothing about configuring the fpc and lazarus cfg files.  When installing fpc, I chose /usr as the first option, for instance.

That's where I am.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Crosscompiling in linux x86_64 - Help please!
« Reply #4 on: November 01, 2016, 02:04:20 pm »
I now have a project that succesfully compiles to:
Linux 64bit
Windows 64bit
Windows 32bit

It fails when compiling to Linux 32bit with:

Compile Project, Mode: Linux32, CPU: i386, Target: crossall_linux32: Exit code 256, Errors: 1
/usr/bin/ld: skipping incompatible //usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible //usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib//libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib//libpthread.a when searching for -lpthread
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: skipping incompatible //usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible //usr/lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib//libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib//libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
crossall.lpr(20,1) Error: Error while linking


Any suggestions?
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling in linux x86_64 - Help please!
« Reply #5 on: November 01, 2016, 02:30:59 pm »
Any suggestions?
Read carefully my instruction and follow it precisely.

 

TinyPortal © 2005-2018