[M3devel] Re: porting m3 on intel mac

j k jayk123 at hotmail.com
Sun Jan 21 00:26:12 CET 2007


Gcc on Mac OS X has this great "arch" flag.
They support four values for it and you can pass any number of them on the 
command line:

ROUGHLY:

echo int main() { printf("hello\n"; return 0;} > hello.c
gcc -arch ppc -arch i386 -arch pp64 -arch x86_64 hello.c
otool a.out
=> quad fat

(this is from memory)

ld has a similar flag.

Sometimes I gather gcc is looping, calling tools multiple times, or multiple 
tools, sometimes maybe the tools have their own loops. I think it is more 
gcc looping.
I've always wanted compilers/lnkers to work this way. :)
It eliminates or hides one axis in the two dimensional cross build matrix. 
(and really, each back end should be a .lib/.dll/.so, nicely integrated so 
you have one front end per host, n backends per host, not some big n x m 
matrix...)

Of course when you have, say, syntax or type errors, it is a waste to 
attempt more than one build at a time.

- Jay

>From: Antony Hosking <hosking at cs.purdue.edu>
>To: Darko <darko at darko.org>
>CC: m3devel at elegosoft.com, Renzo Orsini <orsini at dsi.unive.it>
>Subject: Re: [M3devel] Re: porting m3 on intel mac
>Date: Sat, 20 Jan 2007 18:13:16 -0500
>
>The ftp site ftp://ftp.cs.purdue.edu/pub/hosking/I386_DARWIN now  contains 
>up-to-date bootstrap files.  I just built using the command  "do-cm3-std.sh 
>buildship" without problems.
>
>On 20/01/2007, at 5:49 PM, Darko wrote:
>
>>No worries. I'm not familiar at all with those scripts. The problem  you 
>>are having may be to do with not having the latest source, but  it most 
>>probably has to do with the version of gcc that is active  on your 
>>machine. C files are not compiled by cm3 but rather call  gcc directly. I 
>>can't remember which version of gcc is the correct  one, but mine 
>>currently is i686-apple-darwin8-gcc-4.0.1; also I  can't remember the 
>>command line for changing gcc versions. Tony may  be able to help re the 
>>correct version if 4.0.1 doesn't work. You  may need to install the latest 
>>XCode from http:// developer.apple.com if you don't have 4.01.
>>
>>I've cc'd the list because they're actually very helpful and my  knowledge 
>>is limited...
>>
>>- Darko
>>
>>
>>On 21/01/2007, at 6:58 AM, Renzo Orsini wrote:
>>
>>>First of all, thank you very much for your immediate help!
>>>
>>>I downloaded the files and replaced the corresponding /usr/local/ cm3/bin 
>>>files,
>>>modified cm3.cfg by replacing INSTALL_ROOT = "/usr/local/cm3- i386/" with 
>>>INSTALL_ROOT = "/usr/local/cm3/"
>>>then in the full source (last version, 5.4.0) I did: scripts/do- 
>>>cm3-core.sh buildship
>>>this is the result:
>>>
>>>  root#./do-cm3-core.sh buildship
>>>CM3C =
>>>/Users/orsini/cm3/cm3-src-all-5.4.0/scripts/pkgmap.sh -c "cm3 - build  
>>>-DROOT='/Users/orsini/cm3/cm3-src-all-5.4.0'  && cm3 -ship - 
>>>DROOT='/Users/orsini/cm3/cm3-src-all-5.4.0' " m3gc-simple m3core  libm3 
>>>patternmatching m3middle m3linker m3front m3quake m3cc cm3  m3scanner 
>>>m3tools m3cgcat m3cggen m3bundle bitvector digraph  parseparams 
>>>realgeometry set slisp sortedtableextras table-list  tempfiles
>>>=== package /Users/orsini/cm3/cm3-src-all-5.4.0/m3-libs/m3gc- simple ===
>>>+++ cm3 -build  -DROOT='/Users/orsini/cm3/cm3-src-all-5.4.0'  &&  cm3 
>>>-ship -DROOT='/Users/orsini/cm3/cm3-src-all-5.4.0'  +++
>>>--- building in I386_DARWIN ---
>>>
>>>new source -> compiling RTVM.c
>>>new source -> compiling sysdeps.c
>>>new source -> compiling accept.c
>>>../src/runtime/I386_DARWIN/accept.c: In function 'm3_accept':
>>>../src/runtime/I386_DARWIN/accept.c:13: warning: pointer targets  in 
>>>passing argument 3 of 'accept' differ in signedness
>>>new source -> compiling bind.c
>>>new source -> compiling close.c
>>>new source -> compiling connect.c
>>>new source -> compiling dup.c
>>>new source -> compiling dup2.c
>>>new source -> compiling gethostbyaddr.c
>>>new source -> compiling gethostbyname.c
>>>new source -> compiling getpeername.c
>>>../src/runtime/I386_DARWIN/getpeername.c: In function  'm3_getpeername':
>>>../src/runtime/I386_DARWIN/getpeername.c:13: warning: pointer  targets in 
>>>passing argument 3 of 'getpeername' differ in signedness
>>>new source -> compiling getsockname.c
>>>../src/runtime/I386_DARWIN/getsockname.c: In function  'm3_getsockname':
>>>../src/runtime/I386_DARWIN/getsockname.c:13: warning: pointer  targets in 
>>>passing argument 3 of 'getsockname' differ in signedness
>>>new source -> compiling listen.c
>>>new source -> compiling read.c
>>>new source -> compiling recv.c
>>>new source -> compiling recvfrom.c
>>>../src/runtime/I386_DARWIN/recvfrom.c: In function 'm3_recvfrom':
>>>../src/runtime/I386_DARWIN/recvfrom.c:15: warning: pointer targets  in 
>>>passing argument 6 of 'recvfrom' differ in signedness
>>>new source -> compiling select.c
>>>new source -> compiling send.c
>>>new source -> compiling sendto.c
>>>new source -> compiling shutdown.c
>>>new source -> compiling socket.c
>>>new source -> compiling write.c
>>>-> archiving libm3gcdefs.a
>>>ld: common symbols not allowed with MH_DYLIB output format with  the 
>>>-multi_module option
>>>sysdeps.o definition of common _RTCSRC_FinishVM (size 16)
>>>sysdeps.o definition of common _RTHeapRep_Fault (size 16)
>>>/usr/bin/libtool: internal link edit command failed
>>>--- shipping from I386_DARWIN ---
>>>
>>>. => /usr/local/cm3/pkg/m3gc-simple/I386_DARWIN
>>>   .M3EXPORTS        libm3gcdefs.5.2.dylib"/Users/orsini/cm3/cm3- 
>>>src-all-5.4.0/m3-libs/m3gc-simple/I386_DARWIN/.M3SHIP", line 3:  quake 
>>>runtime error: unable to copy "libm3gcdefs.5.2.dylib" to "/ 
>>>usr/local/cm3/pkg/m3gc-simple/I386_DARWIN/libm3gcdefs.5.2.dylib":  
>>>errno=2
>>>
>>>--procedure--  -line-  -file---
>>>install_file       --  <builtin>
>>>                     3  /Users/orsini/cm3/cm3-src-all-5.4.0/m3-libs/ 
>>>m3gc-simple/I386_DARWIN/.M3SHIP
>>>
>>>Fatal Error: package build failed
>>>*** execution of  failed ***
>>>
>>>======
>>>
>>>
>>>I noticed that not all the .c files in .../m3-libs/m3gc-simple/src/ 
>>>runtime/I386_DARWIN/ where compiled, but I do not know if this is  a 
>>>normal behaviour.
>>>
>>>Thanks in advance for your time and patience!
>>>
>>>Cordially
>>>
>>>Renzo Orsini
>>>
>>>
>>>On Jan 20, 2007, at 19:02, Darko wrote:
>>>
>>>>Have a look here: ftp://ftp.cs.purdue.edu/pub/hosking/m3/ I386_DARWIN/
>>>>
>>>>There you'll find the bits you need for Mac Intel. Replace your  
>>>>existing cm3, cmcg and cm3.cfg with the ones there, then you can  
>>>>compile the basic libraries you need like m3core and libm3, but  make 
>>>>sure you have the latest sources.
>>>>
>>>>I think they're the latest but Tony may have something more to  say 
>>>>about that.
>>>>
>>>>Darko.
>>>>
>>>>
>>>>
>>>>On 21/01/2007, at 1:41 AM, Olaf Wagner wrote:
>>>>
>>>>>On Sat, Jan 20, 2007 at 03:05:55PM +0100, Renzo Orsini wrote:
>>>>>>Hello,
>>>>>>
>>>>>>I  installed cm3-min-POSIX-PPC_DARWIN-5.4.0.tgz on an intel  mac, then
>>>>>>tried to a compile a Hello world program, but the compilation  failed
>>>>>>with the following message:
>>>>>>
>>>>>>pborsini:~/ProveModula3 orsini$ cm3
>>>>>>--- building in PPC_DARWIN ---
>>>>>>
>>>>>>new source -> compiling Main.m3
>>>>>>"../Main.m3", line 4: warning: potentially unhandled exception:  
>>>>>>IO.Error
>>>>>>1 warning encountered
>>>>>>Main.ms:12:no such instruction: `mflr r0'
>>>>>>Main.ms:13:no such instruction: `stmw r30,-8(r1)'
>>>>>>Main.ms:14:no such instruction: `stw r0,8(r1)'
>>>>>>Main.ms:15:no such instruction: `stwu r1,-96(r1)'
>>>>>>Main.ms:16:no such instruction: `mr r30,r1'
>>>>>>Main.ms:17:no such instruction: `bcl 20,31,"L00000000001$pb"'
>>>>>>...
>>>>>>....
>>>>>>
>>>>>>So I suppose there is PPC code to assemble and the Rosetta  emulator
>>>>>>for PPC on intel macs cannot do anything for this!
>>>>>>
>>>>>>Since I would like to port the Fibonacci language for databases,
>>>>>>which is written in Modula-3, if I understand well the situation I
>>>>>>should port the Modula-3 compiler by cross compiling it on a  PPC mac,
>>>>>>or something like that.
>>>>>>
>>>>>>I am asking you if you know about some effort of porting  Modula-3 on
>>>>>>intel macs, or at least if you let me know if this operation is
>>>>>>possible (and also reasonably feasible in terms of time and
>>>>>>expertise, given my teaching duties and my difficulties with
>>>>>>assembler languages!), and, if so, if you can point me to the  correct
>>>>>>documentation to start with. Of course I will be very glad to give
>>>>>>back to the community the result if I succeed!
>>>>>>
>>>>>>Thank you very much for your attention.
>>>>>>
>>>>>>Cordially
>>>>>>
>>>>>>Renzo Orsini
>>>>>>Associate Professor
>>>>>>Dipartimento di Informatica
>>>>>>Universita' Ca' Foscari di Venezia
>>>>>
>>>>>Well, I wouldn't have thought that you were even able to install
>>>>>the cm3-min-POSIX-PPC_DARWIN-5.4.0.tgz system on an Intel machine;
>>>>>it's surely not supposed to run on one. It shouldn't be too
>>>>>difficult to get a port of the latest CM3 for Darwin on Intel
>>>>>processors; I even think somebody was already working on it,
>>>>>but I don't really remember who, so I forward your mail to
>>>>>the m3devel list, in case others have already started such an
>>>>>effort.
>>>>>
>>>>>Olaf
>>>>>--
>>>>>elego Software Solutions GmbH                           HRB 77719
>>>>>Olaf Wagner                            E-Mail: wagner(at)elego.de
>>>>>Ohmstraße 9                               Tel: +49 30 40 04 19 29
>>>>>10179 Berlin                              Fax: +49 30 23 45 86 95
>>>>>Cranachstraße 7                           Tel: +49 30 85 58 01 81
>>>>>12157 Berlin                              Fax: +49 30 85 58 01 88
>>>>>  ------------------> WWW: http://www.elego-software-solutions.com
>>>>>_______________________________________________
>>>>>M3devel mailing list
>>>>>M3devel at elegosoft.com
>>>>>https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
>>>
>>
>>
>>_______________________________________________
>>M3devel mailing list
>>M3devel at elegosoft.com
>>https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
>
>Antony Hosking                | Associate Professor
>Dept of Computer Sciences     | Office: (765) 494-6001
>Purdue University             | Mobile: (765) 427-5484
>250 N. University Street      | hosking at cs.purdue.edu
>West Lafayette, IN 47907-2066 | http://www.cs.purdue.edu/~hosking
>   _--_|\
>  /      \
>  \_.--._/    )
>        v    /
>
>
>
>_______________________________________________
>M3devel mailing list
>M3devel at elegosoft.com
>https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel

_________________________________________________________________
Get in the mood for Valentine's Day. View photos, recipes and more on your 
Live.com page. 
http://www.live.com/?addTemplate=ValentinesDay&ocid=T001MSN30A0701




More information about the M3devel mailing list