LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 05-29-2019, 03:15 PM   #1
sr_ls_boy
Member
 
Registered: Apr 2015
Posts: 103

Rep: Reputation: Disabled
Cross Compiling with Meson


I need the 32-bit version of GLIB. With the tool chain build from LFS-multilib, the meson build fails. I have built other 32-bit packages with meson. So, this
one must have some build scripts which elude me. At the bottom of my post you'll find my configure line and my cross-file definitions for feeding to meson
during configure.

The crux of the matter is that indeed the compiler commands get executed correctly, e.g., with the -m32 gcc command switch but the link fails.
Quote:
gcc -o glib/libglib.so << numerous object files >> \
-Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libglib-2.0.so.0\
-Wl,-z,nodelete -Wl,-Bsymbolic-functions /usr/lib32/libpcre.so -Wl,--end-group -pthread
/usr/bin/ld: /usr/lib32/libpcre.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
A couple of things. I don't know why meson configured to try and link in a shared file. 'libpcre.a' exists in /usr/lib32. libpcre.so links to libpcre.so.1.2.11, which is type
ELF 32-bit LSB shared object, Intel 80386. Meson, actually just writes out a file of commands in compile_commands.json. Ninja prints them as well. I replaced libpcre.so
from the command above with libpcre.a. I got back : Architecture of i386 input file is incompatible with i386:x86-64. So, the linker thinks I want to link a 64-bit library but
the *.o files are all the wrong type. The fix was to use the LD flag "-m elf_i386".
I put that in the cross-file definitions file but configure failed. Specifically, it's the line c_link_args = [-m elf_i386]. Prepending LDFLAGS="-m elf_i386" didn't work either. I'm
missing something. But this is a new build system that we'll have to deal with.
______________________________________________________________
My configure line, edited for readability.
Quote:
CC="gcc -m32" CXX="g++ -m32" \
meson \
-Dhost=i686-pc-linux-gnu \
--cross-file glib.cross \
build32
My cross-file that is fed to meson on the configure line.
Quote:
[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'

[properties]
c_args = ['-m32' , '-Dhost=i686-pc-linux-gnu']
c_link_args = []
cpp_args = ['-m32' , '-Dhost=i686-pc-linux-gnu']
cpp_link_args = []

[binaries]
c = 'gcc'
cpp = 'g++'
ar = 'ar'
strip = 'strip'
pkgconfig = 'pkg-config'
windres = 'windres'
 
Old 05-29-2019, 03:21 PM   #2
sr_ls_boy
Member
 
Registered: Apr 2015
Posts: 103

Original Poster
Rep: Reputation: Disabled
Glib's page on cross-compiling.
Meson's page on cross-compiling.
 
Old 05-29-2019, 09:43 PM   #3
emmett1
Member
 
Registered: Nov 2017
Location: Malaysia
Distribution: Venom Linux
Posts: 47

Rep: Reputation: Disabled
You need patch glib to make multilib support.
Check here to see how i build 32bit glib
https://github.com/venomlinux/ports/...ltilib/glib-32
 
1 members found this post helpful.
Old 05-30-2019, 03:52 AM   #4
sr_ls_boy
Member
 
Registered: Apr 2015
Posts: 103

Original Poster
Rep: Reputation: Disabled
Thanks for that! WOW!

I thought that it might be GLIB. Other meson based
packages that I ran into compiled fine with 32-bit.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Which package should provide ninja and meson? Lennie Linux From Scratch 6 12-29-2017 02:01 AM
LXer: GNOME 3.28 Desktop Environment Gets Third Development Snapshot, More Meson Ports LXer Syndicated Linux News 0 12-17-2017 04:56 AM
[SOLVED] Meson sr_ls_boy Linux From Scratch 4 10-07-2017 05:52 AM
LXer: The Road to GTK+ 4 Continues, New Milestone Adds Initial OS X and Meson Support LXer Syndicated Linux News 0 05-24-2017 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration