473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Cross Compilation

Hi Everyone,

I want to make executable for 32-bit machine by using Makefile on 64-bit machine.
Currently I am having gcc4.2.1 on my box.


Thanks.
Sep 24 '08 #1
5 2175
arnaudk
424 256MB
Look at reference for gcc compiler flags, paying particular attention to the section "Target Options".
Sep 24 '08 #2
Look at reference for gcc compiler flags, paying particular attention to the section "Target Options".
-b machine how can I find the value for machine?

how can I configure cross compiler? As in the link given by you tell about
For example, if a cross-compiler was configured with `configure arm-elf', meaning to compile for an arm processor with elf binaries, then you would specify -b arm-elf to run that cross compiler

I want to make executable for 32-bit machine.

can you guide me on how to write gcc command in Makefile for cross compilation.

Thanks for your response.
Sep 24 '08 #3
arnaudk
424 256MB
You'll need to install a version of gcc for each target machine type to use it as a cross compiler, see installation instructions. There are some exceptions. For example, if your gcc is installed on a 64-bit intel machine, and you simply want to compile for a 32-bit intel machine, then you can use intel hardware options such as -m32. The same applies to other hardware platforms. Have a good look through the manual and use google.
Sep 24 '08 #4
You'll need to install a version of gcc for each target machine type to use it as a cross compiler, see installation instructions. There are some exceptions. For example, if your gcc is installed on a 64-bit intel machine, and you simply want to compile for a 32-bit intel machine, then you can use intel hardware options such as -m32. The same applies to other hardware platforms. Have a good look through the manual and use google.
my target machine is having gcc3.2.2 and my local machine is gcc4.2.1. Do I need to install gcc3.2.2 on my local box?

how can I find option (-b) for the target machine?

CCWebBrowser: $(OBJs)

$(GCC) -m32 -o CCWebBrowser.linux $(OBJs) $(LSSLLIBs) $(LICULIBs)

If I give target as above then it creates executable but for 64-bit.
Sep 24 '08 #5
arnaudk
424 256MB
The compiler version on your target machine doesn't matter because you're not going to use it when you run the program there.

You need to specify -m32 for the dependencies as well. You can do this easily by changing the line which looks something like GCC = g++ into something like GCC = g++ -m32. Make sure you do a full rebuild. Note also that you'll need to link in 32bit versions of any libraries you use as well...

I think it may be easier just to configure a version of gcc tailored to targeted platform as per the installation instructions. Then to compile your code for your target machine change the line to GCC = <target-platform>-g++
Sep 24 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: darkhack | last post by:
Hello. I am looking for a GUI API that is cross platform and works with Windows, Mac, and Linux. I was hoping for something free and open source. You see, I have yet to find anything that fits...
1
by: Han-Wen Nienhuys | last post by:
Hello, I have a small patch for Python SVN that makes it possible to cross-compile python on Unix to various other Unix targets. I have successfully built a binary for FreeBSD on Linux. The...
6
by: greek_bill | last post by:
Hi, I'm interested in developing an application that needs to run on more than one operating system. Naturally, a lot of the code will be shared between the various OSs, with OS specific...
1
by: ac.c.2k7 | last post by:
Hi All, While doing the cross compilation of pkg_config for directFB for MIPS target from i86 platform, i am getting the following error. "checking for extra flags to get ANSI library...
1
by: Otacon22 | last post by:
Hi all, I want to create a robot with a router board based on processor atheros 2.6, called "fonera". I have installed a version of linux, Openwrt and python and i want to use it for some...
3
by: Squat'n Dive | last post by:
Does anyone have an idea why -fno-strict-aliasing is turned off when cross compiling? in configure generated for 2.4.4: case $GCC in yes) # Python violates C99 rules, by casting between...
0
by: psrathore | last post by:
I am passing a bunch of parameters to my stored proc. The following query uses a few of those parameters alongwith a column value from the outer table using cross apply. I get a compilation error...
3
by: cervello_in_vacanza | last post by:
Hi everyone, I would like to know a way to produce a .EXE file compiling with gcc from within a Linux machine. Is it just a flag question or do I need any specific library? Thank you in...
1
by: Roumen Petrov | last post by:
Hi list members, It seems to me that this is discussed many times in the past but without progress. As I understand in general there is no objections and preferred cross-compilation has to be...
1
by: akaley | last post by:
Hi all, I tried to cross compile the java files from 1.5 to 1.3 in JDK 1.5 environment by using the below command javac -target 1.3 *.java. But it showing an error message Like cross...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.