* * *

Author Topic: [SOLVED] libraries-not-found-errors when cross-compiling 32 bit GUI application  (Read 1734 times)

WayneSherman

  • New member
  • *
  • Posts: 49
You can try this.
You can point fpcupdeluxe towards your own system 32bit library.
In your case: /lib32

Note that newer Ubuntu versions (since 12.04?) using Multiarch use different paths for 64-bit and 32-bit libraries.
See here: https://wiki.ubuntu.com/MultiarchSpec

On Ubuntu 18.04 I have:

64-bit Libraries:
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu


32-bit Libraries:
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
« Last Edit: October 23, 2018, 04:45:57 pm by WayneSherman »

WayneSherman

  • New member
  • *
  • Posts: 49
You can try this
...
After setting these locations, you can build the cross-compiler again.

Is it necessary to rebuild the cross-compiler, or can fpc.cfg be modified to point to the systems 32-bit libraries?

I have these library paths in my fpcupdeluxe fpc.cfg file:

Code: [Select]
# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/7
#endif

# searchpath for libraries
-Fl/home/user/fpcupdeluxe2/fpc/lib/$FPCTARGET

# library search path
-Fl/usr/lib/$FPCTARGET;/usr/lib/$FPCTARGET-gnu;/lib/$FPCTARGET;/lib/$FPCTARGET-gnu;/usr/lib/gcc/x86_64-linux-gnu/7.3.0

DonAlfredo

  • Hero Member
  • *****
  • Posts: 994
Your fpc.cfg does not look like anything that has been generated by fpcupdeluxe !
You have now touched the limits of what fpcupdeluxe can do for you.

In order to work under all these different conditions, fpcupdeluxe generates and maintains its own fpc.cfg for its own FPC. Naturally, changing these settings by hand is allowed, but can or will disturb fpcupdeluxe.

Again, fpcupdeluxe can help you. But not under all conditions.
Please stick to the instructions I wrote earlier.
Point towards the libs, wherever they are.
Point towards the bins, wherever they are.
Run again.

WayneSherman

  • New member
  • *
  • Posts: 49
Your fpc.cfg does not look like anything that has been generated by fpcupdeluxe !

I think those lines were taken directly from an unedited fpc.cfg.  Please stand-by, testing again...

WayneSherman

  • New member
  • *
  • Posts: 49
Your fpc.cfg does not look like anything that has been generated by fpcupdeluxe !

Just confirmed, those fpc.cfg lines were created by fpcupdeluxe.

I tested again:
Code: [Select]
#tested on Xubuntu 18.04 64-bit (starting from a minimal OS install)

#install fpcupdeluxe dependencies
sudo apt install -y libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libxtst-dev libatk1.0-dev libghc-x11-dev freeglut3 freeglut3-dev
sudo apt install -y git subversion make build-essential gdb zip unzip unrar wget

#install dependencies for a 32-bit executable built with Lazarus
sudo apt install libgtk2.0-0:i386 libx11-6:i386 libgdk-pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386

#use latest fpcupdeluxe to build Laz/fpc stable/stable and crosscompiler i386/linux
https://github.com/newpascal/fpcupdeluxe/releases/tag/1.6.2e

#Open Lazarus and perform a "Clean up and Build" of a minimal application (empty form) with i386 target CPU
#Errors:
  Compile Project, CPU: i386, Target: project1: Exit code 256, Errors: 1
  /lib/i386-linux-gnu//libmount.so.1: undefined reference to `getrandom@GLIBC_2.25'
  /usr/lib/i386-linux-gnu//libgio-2.0.so.0: undefined reference to `g_build_filename_valist'
  /lib/i386-linux-gnu//libbsd.so.0: undefined reference to `__explicit_bzero_chk@GLIBC_2.25'
  project1.lpr(20,1) Error: Error while linking

Then I uninstall the 32-bit libraries:
Code: [Select]
sudo apt purge libgtk2.0-0:i386 libx11-6:i386 libgdk-pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386
sudo apt autoremove

Now doing a "Clean up and build" succeeds.

Unmodified fpc.cfg from fpcupdeluxe is attached.

Hartmut

  • Full Member
  • ***
  • Posts: 210
Thanks a lot to all for your answers and that you want to help me.

But I have difficulties to understand what you mean, because I'm an absolute beginner on Linux and on cross-compiling.

I'd recommend using a separate fpc.cfg and a completely separate directory structure independent from the installed OS that contains the libraries you need for cross-compilation.
I thought I did this by using fpcupdeluxe to create a separate Lazarus installation with its own fpc.cfg and its own library folder <install_folder>/cross/lib/i386-linux/
What else must I do?

In setup+ , you can choose your os and cpu in "Custom tools location ..."
And enter your location where to find the bins and the libs.
In setup+ , I first set "Search options" to custom and then enter the lib-Path in "Libraries" and the bin-Path in "Tools"?
But which lib-Path must I use? You recommended /lib32, but WayneSherman wrote that they are in /lib/i386-linux-gnu and /usr/lib/i386-linux-gnu. What must I use?
And which bin-Path must I use? I don't know it. Please, how can I find this out?

Sorry, that for me things are very difficult because everything is new and unknown for me.
Thanks again for your help.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 994
@Hartmut

There is a separate forum thread about fpcupdeluxe
http://forum.lazarus.freepascal.org/index.php/topic,34645.0.html

It is best if you post fpcupdeluxe related questions there !

To answer your question.
Fpcupdeluxe is a tool to help you install FPC and Lazarus if (but not limited to):
1) other methods fail.
2) you need something special like easy cross-compiling.
In your case: just use the standard settings and let fpcupdeluxe do its thing.
In most cases, this will work.

If not, post your question with details.

benohb

  • Full Member
  • ***
  • Posts: 164
I think ..you  can not  install package libgtk2.0-dev:i386 and libgtk2.0-dev In the same device
It is the hell of a conflict between
packages
« Last Edit: October 24, 2018, 12:49:43 am by benohb »

WayneSherman

  • New member
  • *
  • Posts: 49
I think ..you  can not  install package libgtk2.0-dev:i386 and libgtk2.0-dev In the same device
It is the hell of a conflict between packages

As far as I know, libgtk2.0-dev:i386 is not being installed, the non dev version is: libgtk2.0-0:i386

The idea of multiarch is that different directories are used for different CPU architectures:

libgtk2.0-dev (64-bit) library files (.so and .a) get installed into /usr/lib/x86_64-linux-gnu/
https://packages.ubuntu.com/bionic/amd64/libgtk2.0-dev/filelist

libgtk2.0-0:i386 library files (.so) get installed into /usr/lib/i386-linux-gnu/
https://packages.ubuntu.com/bionic/i386/libgtk2.0-0/filelist
« Last Edit: October 24, 2018, 01:17:49 am by WayneSherman »

Hartmut

  • Full Member
  • ***
  • Posts: 210
There is a separate forum thread about fpcupdeluxe http://forum.lazarus.freepascal.org/index.php/topic,34645.0.html
It is best if you post fpcupdeluxe related questions there !

This topic was continued (as requested by DonAlfredo) in https://forum.lazarus.freepascal.org/index.php/topic,34645.msg300126.html#msg300126 and was solved in https://forum.lazarus.freepascal.org/index.php/topic,34645.msg301060.html#msg301060

Now I can cross-compile and run 32-bit programs on a 64-bit Ubuntu 18.04 with Lazarus 1.8.4.

Thanks a lot again to all who helped me.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus