Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-29-2014, 01:43 PM   #1
Registered: Aug 2013
Distribution: Fedora 20 jam, SME Server
Posts: 32

Rep: Reputation: 1
Cannot figure out 32 bit on 64 bit crosscompilation

Can someone explain me what packages I need and how I crosscompile?
I just can't seem to find the solution.

I would like to compile a 32 bit version of a program on my x86_64 bit Fedora Linux.
When I put -m32 on the end of the configuration command for configuring code so I can build it, it does nothing.
I have an Intel core i5 processor.
Old 07-29-2014, 02:48 PM   #2
Senior Member
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
First of all, you need all the 32 bit libs that the application you are compiling needs to build and link to. I deal in c++ more, so I will give an example for that, but it should be the same for C.

$ g++ -m32 foo.cpp -o foo.bin -L /usr/lib -march=i586
$ file foo.bin
foo.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, not stripped
As long as I have the headers and libs in /usr/lib, that command will work. If I do not, then it will fail; so make sure you have explicitly installed the 32bit versions of what you need to compile against.

You might also need to output 32bit-versions of the object code that your compilation creates; it kind of depends on how complex the build is.

** Look in the GCC man page to see the different CPU types you can set -march to. It's a long man page so do I search for 'corei7' or 'pentium' and that should take you to the right section.

Last edited by notKlaatu; 07-29-2014 at 07:35 PM.


32bit, 64bit, crosscompile, program

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
•Red Hat Enterprise Linux 5 (UL6+) (32-bit. 64 bit supported in 32-bit mode) download oylf1985 Linux - Newbie 13 04-08-2019 12:55 PM
Can't find 32 bit libs to run 32 bit prog on 64 bit CentOS homer_3 Linux - Distributions 2 09-30-2013 08:45 PM
[SOLVED] Installing 32 bit RPMs on 64 bit Linux conflicts with 64 bit packages gheibia Linux - Server 1 08-18-2011 01:33 AM
How to figure out 64 or 32 bit siawash Ubuntu 7 04-11-2011 04:13 PM
64 bit or 32 bit Ubuntu 10.04 in a multiple boot with windows 64 and 32 bit ? james2b Linux - General 7 09-22-2010 04:12 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:03 AM.

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