f



Compile to 64-bit on 32-bit OS

Apparently my Mac Mini will run 64-bit code transparently even thought I'm
on a 32-bit OS. What I want to know is, how can I compile my code to
64-bit?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?u
0
usenet116 (1778)
12/1/2007 2:32:30 PM
comp.sys.mac.misc 7155 articles. 1 followers. Post Follow

5 Replies
909 Views

Similar Articles

[PageSpeed] 14

In article <13l2sktancigaa7@corp.supernews.com>,
 Jon Harrop <usenet@jdh30.plus.com> wrote:

> Apparently my Mac Mini will run 64-bit code transparently even thought I'm
> on a 32-bit OS. What I want to know is, how can I compile my code to
> 64-bit?

You get Intel's Just released C++ Compiler Update with the newer 64bit 
Libraries......
0
You68 (84)
12/1/2007 5:51:00 PM
Jon Harrop <usenet@jdh30.plus.com> wrote:

> Apparently my Mac Mini will run 64-bit code transparently even thought I'm
> on a 32-bit OS. What I want to know is, how can I compile my code to
> 64-bit?

You might have more useful answers to questions like this in a
programming newsgroup. I've included comp.sys.mac.programmer.help in the
discussion and you might like to set followups there.

Which Mac Mini model (processor type) and operating system do you have?

My understanding is that the only Mac Mini model capable of running
64-bit code is the current generation with an Intel Core 2 Duo
processor. If you have an older model, it can only run 32-bit code.

An application can be built with both 64-bit and 32-bit variants inside
the same bundle, and the operating system will select the appropriate
one based on the hardware platform. This might be confusing you into
thinking you are running 64-bit code.

Mac OS X 10.4 (Tiger) is able to support running 64-bit code (only on a
64-bit processor) in some limited ways, e.g. UNIX processes but not
Cocoa GUI processes.

Mac OS X 10.5 (Leopard) is able to support running 64-bit code (only on
a 64-bit processor) in many more ways, including Cocoa GUI processes
(but not including some parts of the Carbon API).

I assume you are using Xcode. Which version?

You might be able to _build_ a 64-bit application on a 32-bit computer,
but you won't be able to run or debug it, so it is of dubious benefit
unless you have a 64-bit computer nearby to test with (in which case it
may be easier to build the code on that computer).

-- 
David Empson
dempson@actrix.gen.nz
0
dempson (3825)
12/1/2007 11:23:42 PM
["Followup-To:" header set to comp.sys.mac.programmer.help.]
On Sun, 2 Dec 2007 12:23:42 +1300, David Empson <dempson@actrix.gen.nz> wrote:
> Jon Harrop <usenet@jdh30.plus.com> wrote:
>
>> Apparently my Mac Mini will run 64-bit code transparently even thought I'm
>> on a 32-bit OS. What I want to know is, how can I compile my code to
>> 64-bit?
>
> You might have more useful answers to questions like this in a
> programming newsgroup. I've included comp.sys.mac.programmer.help in the
> discussion and you might like to set followups there.

The portable way to compile 64bit code with GCC is to use the -m64
option. AFAICT this will generate 64bit only code on a Mac, not a fat,
er, universal object file. I don't know if it is possible to compile
such a file on a 32bit only machine (older PPC and pre Core 2 machines).

See also lipo for manipulation of universal binaries.

A bientot
Paul
-- 
Paul Floyd                 http://paulf.free.fr
0
Paul
12/2/2007 2:56:55 PM
On 02 Dec 2007 14:56:55 GMT, Paul Floyd wrote:
> ["Followup-To:" header set to comp.sys.mac.programmer.help.]
> On Sun, 2 Dec 2007 12:23:42 +1300, David Empson <dempson@actrix.gen.nz> wrote:
>> Jon Harrop <usenet@jdh30.plus.com> wrote:
>>
>>> Apparently my Mac Mini will run 64-bit code transparently even thought I'm
>>> on a 32-bit OS. What I want to know is, how can I compile my code to
>>> 64-bit?
>>
>> You might have more useful answers to questions like this in a
>> programming newsgroup. I've included comp.sys.mac.programmer.help in the
>> discussion and you might like to set followups there.

> The portable way to compile 64bit code with GCC is to use the -m64
> option. AFAICT this will generate 64bit only code on a Mac, not a fat,
> er, universal object file. I don't know if it is possible to compile
> such a file on a 32bit only machine (older PPC and pre Core 2 machines).

> See also lipo for manipulation of universal binaries.

<http://developer.apple.com/documentation/Darwin/Conceptual/64bitPorting/>


-- 
Dave Seaman
Oral Arguments in Mumia Abu-Jamal Case heard May 17
U.S. Court of Appeals, Third Circuit
<http://www.abu-jamal-news.com/>
0
Dave
12/2/2007 5:22:17 PM
On 2007-12-02 14:56:55 +0000, Paul Floyd <root@127.0.0.1> said:

> ["Followup-To:" header set to comp.sys.mac.programmer.help.]
> On Sun, 2 Dec 2007 12:23:42 +1300, David Empson <dempson@actrix.gen.nz> wrote:
>> Jon Harrop <usenet@jdh30.plus.com> wrote:
>> 
>>> Apparently my Mac Mini will run 64-bit code transparently even thought I'm
>>> on a 32-bit OS. What I want to know is, how can I compile my code to
>>> 64-bit?
>> 
>> You might have more useful answers to questions like this in a
>> programming newsgroup. I've included comp.sys.mac.programmer.help in the
>> discussion and you might like to set followups there.
> 
> The portable way to compile 64bit code with GCC is to use the -m64
> option. AFAICT this will generate 64bit only code on a Mac, not a fat,
> er, universal object file. I don't know if it is possible to compile
> such a file on a 32bit only machine (older PPC and pre Core 2 machines).

It is, though I'd expect the linker will need to be able to find the 
64-bit libraries on your machine. My PowerBook's Leopard install seems 
to have them...

$ gcc -m64 test.c
$ file a.out
a.out: Mach-O 64-bit executable ppc64
$ ./a.out
-bash: ./a.out: Bad CPU type in executable

Cheers,

Chris

0
Chris
12/2/2007 5:33:58 PM
Reply: