Since Apple do not support GCC 4.6 or GCC 4.7, I just switched to MacPorts' build of GCC 4.6/4.7. However, I had a problem to build my code in "Universal" architecture.
Traditionally, I'd do g++ -arch i386 -arch x86_64 ...
to compile my binary for at least i386/x86_64 architecture. I did some search, and realised that -arch option is only supported by apple's compilers. So of course it didn't work with the Macports'. The best I could do is use -m32
/-m64
options to specify an architecture I want. However, this will only produce a binary eitherr in i386 or x86_64 format. What I really want is get a binary file in both architecture (Universal) just as been done with the original GCC compilers.
Is this not supported or a known problem? I have tried the whole night looking for answers on Google, but I haven't get anything useful. So I just start doubt if I am the only one had this problem and I have missed something really important to get it work? Really appreciate if anyone can give me some suggestions.
BTW. I have installed gcc46 +universal
variants, but it didn't produce anything really universal except compiling separate binaries for each architecture.
Xing.