LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-01-2021, 02:48 AM   #1
av2zeal
Member
 
Registered: Jul 2008
Distribution: Slackware64
Posts: 56

Rep: Reputation: 1
Cross-compile 32bit meson project from multilib'd system


Apologies if I got any terminology wrong.
I run Slackware64-current and have multilib deployed.
I have a program that I'm attempting to build that uses meson/ninja. I found the SBo meson template here. I successfully adapted it and built a 64-bit binary/package. However, I'm not sure what flags or setting that I need to change to build a 32-bit library. I attempted to change the CFLAGS and CXXFLAGS from "-O2 -fPIC" for the 64-bit build to "-O2 -march=i686 -mtune=i686", but it throws an error:
/meson.build:1:0: ERROR: Compiler ccache cc can not compile programs. Followed by:
A full log can be found at /tmp/SBo/MangoHud-0.6.1/build32/meson-logs/meson-log.txt
That log file has the following in it:
Main binary: /usr/bin/python3
Build Options: -Dprefix=/usr -Dinfodir=/usr/info -Dlibdir=/usr/lib -Dlocalstatedir=/var -Dmandir=/usr/man -Dsysconfdir=/etc -Dbuildtype=release
Python system: Linux
The Meson build system
Version: 0.56.2
Source dir: /tmp/SBo/MangoHud-0.6.1
Build dir: /tmp/SBo/MangoHud-0.6.1/build32
Build type: native build
Project name: MangoHud
Project version: v0.6.1
None of 'CC' are defined in the environment, not changing global flags.
Using 'CFLAGS' from environment with value: '-O2 -march=i686 -mtune=i686'
Using 'LDFLAGS' from environment with value: '-L/usr/lib'
None of 'CPPFLAGS' are defined in the environment, not changing global flags.
None of 'CC_LD' are defined in the environment, not changing global flags.
Sanity testing C compiler: ccache cc
Is cross compiler: False.
None of 'CC_LD' are defined in the environment, not changing global flags.
Sanity check compiler command line: ccache cc /tmp/SBo/MangoHud-0.6.1/build32/meson-private/sanitycheckc.c -o /tmp/SBo/MangoHud-0.6.1/build32/meson-private/s>
Sanity check compile stdout:

-----
Sanity check compile stderr:
cc1: error: CPU you selected does not support x86-64 instruction set

-----

../meson.build:1:0: ERROR: Compiler ccache cc can not compile programs.

As far as I can tell, I need to pass cross-compiler=yes and cpu=x86 somehow?
But when searching this, it seems that I need to build a cross-compiler file?
Am I over-complicating this?
Is the solution as simple as some missing flags?
 
Old 04-01-2021, 07:45 AM   #2
BrunoLafleur
Member
 
Registered: Apr 2020
Location: France
Distribution: Slackware
Posts: 399

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
The flag that is missing is -m32.

Try to add it to your CFLAGS, CXXFLAGS and LDFLAGS arguments.
 
Old 04-01-2021, 09:37 AM   #3
av2zeal
Member
 
Registered: Jul 2008
Distribution: Slackware64
Posts: 56

Original Poster
Rep: Reputation: 1
So simple! I knew I was overlooking something easy. Everything compiled as expected. Thank you Bruno!
 
  


Reply



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
Cross Compiling with Meson sr_ls_boy Linux From Scratch 3 05-30-2019 03:52 AM
Can't compile 32bit program in multilib Slack64 scheepster Slackware 3 05-27-2011 06:39 PM
Fedora 13 32bit and then Linux Mint 32bit and then Ubuntu 10.04 32bit ciao303 Linux - Newbie 3 08-09-2010 11:03 PM
[SOLVED] Broffice not compile on Slack64(multilib or no multilib);SlackBuild afreitascs Slackware 4 06-14-2010 07:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:06 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