Hi Göran,


On Thu, Sep 26, 2013 at 12:21 AM, Göran Krampe <goran@krampe.se> wrote:

Hey!

(nice to meet at ESUG btw)

On 08/15/2013 08:06 PM, Guillermo Polito wrote:
So, after digging a bit I've got some results and conclusions:

- The CMake configurations were using gcc to compile, which in mac is
llvm-gcc
- Xcode uses clang compiler, not gcc (and some different compiling flags
also)
- I've played changing the configuration to use clang compiler

Mmmmm... this is all slightly confusing, so many combos of compilers here (I am a Mac n00b), this is what I have (or more?):

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

gcc-4.2 --version
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)

llvm-gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

llvm-gcc-4.2 --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

clang --version
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

(I removed some copyright notices from the above)

setGlobalOptions: maker

    super setGlobalOptions: maker.
    maker set: 'CMAKE_C_COMPILER' to: 'clang'.
    maker set: 'CMAKE_CXX_COMPILER' to: 'clang'.

AFAICT "clang" is the same as "gcc", no? See my printouts above. The only difference seem to be the added prefix/include-dir config.

No; very different.  I'm not an expert but I think essentially clang is Apple's C compiler that uses the LLVM backend, and gcc is good old gcc.  Right now Cog doesn't run if compiled with clang.  Only gcc will do.  No time to debug this right now, and annoyingly clang compiles all static functions with a non-standard calling convention which means one can;t call these functions in gdb, hence lots of debugging functions aren't available without either a) turning off the optimization or b) changing the VM source so they're not static.  I prefer a). If anyone knows of a flag to do this *please* let me know asap.

 

And to make it work as in gcc I added the following also (in some
plugins such as mp3plugin there are functions with return type and
return statements with no values specified).

compilerFlagsRelease

    ^super compilerFlagsRelease, #( '-Wno-return-type' )

Aaaah!! Perfect. I just went through this yesterday and also failed at the mpeg3plugin.

And it compiled with the following results in the tinyBenchmarks:

'510723192 bytecodes/sec; -142407 sends/sec'
>
Which is, in the bytecode part, pretty much close to what we expect, and
in the sends, looks buggy :).
But the overall performance using the image is far better

Ok, I will try to get the build to use gcc-4.2 (the non LLVM gcc) and compare it to the clang (=gcc) VM.

regards, Göran

PS. I am on Mountain Lion and have Xcode 5 installed + CLI tools + brew apple-gcc4.2.



--
best,
Eliot