Core 300 Mac build issues

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Core 300 Mac build issues

Postby pHySiQuE » Sat Apr 28, 2012 4:22 pm

I'm planning to release a commercial product this summer and need to compile Newton on Mac. Here is what I am doing:

1. Include the following files in main header file:
"coreLibrary_300/source/newton/Newton.h"
"coreLibrary_300/source/core/dg.h"
"coreLibrary_300/source/physics/dgPhysics.h"

2. Add all .cpp files into the project from the following locations:
"coreLibrary_300/source/newton"
"coreLibrary_300/source/meshUtil"
"coreLibrary_300/source/core"
"coreLibrary_300/source/physics"

Here are the errors Xcode 4.3.1 produces:
Screen Shot 2012-04-28 at 1.26.08 PM.png
Screen Shot 2012-04-28 at 1.26.08 PM.png (145.39 KiB) Viewed 5938 times

And a bunch more in dgtypes.h:
Screen Shot 2012-04-28 at 1.35.06 PM.png
Screen Shot 2012-04-28 at 1.35.06 PM.png (50.14 KiB) Viewed 5936 times

Thanks in advance for your help.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Core 300 Mac build issues

Postby Julio Jerez » Sun Apr 29, 2012 7:37 am

xcode use GCC, however the LLVM coplere option is a just in tome compeil taht coripokle to byte code, and link on target machine.
the problem with tha is that apple never opdated it the front end and it parse older intrindisics.

can you try GCC option but no LLVM, oteh wodet you will

teh oteh solution is to detect a MADRO when you coiplie usin that option an dmake a conditional statement similar to what I did whan I was usin VS 6 for SSE and BS 2008 for AVX

Code: Select all
   #if (_MSC_VER >= 1600)
      // VS 2010 or better supports AVX instruction
      #ifdef DG_BUILD_SIMD_CODE
         #define DG_BUILD_SIMD_256_CODE
      #endif
   #endif



you can add someting like this
Code: Select all
   #ifdef MAC_BUILD
                 #ifndef LLVM
                  #ifdef DG_BUILD_SIMD_CODE
             #define DG_BUILD_SIMD_256_CODE
   #endif
   #endif


I do not know what the macro for LLMV is in xcode, but if ther is no one you can add one to that project configuration.
basically LLVN is not mean to use intrisics.
they claim the JIT translator and linker can do a better job, the reality is that LLVM run abpout 50% slower that hand optimized code using intrisics.
I would no recomned it for hieg performce code.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Core 300 Mac build issues

Postby pHySiQuE » Sun Apr 29, 2012 3:36 pm

Julio Jerez wrote:xcode use GCC, however the LLVM coplere option is a just in tome compeil taht coripokle to byte code, and link on target machine.
the problem with tha is that apple never opdated it the front end and it parse older intrindisics.

can you try GCC option but no LLVM, oteh wodet you will

Apparently Xcode 4.3 only supports the LLVM compiler.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Core 300 Mac build issues

Postby pHySiQuE » Mon Apr 30, 2012 6:20 am

I changed the top of "dgSimd_128.h" to this:
Code: Select all
#ifndef __DG_SIMD_INSTRUCTION_H__
#define __DG_SIMD_INSTRUCTION_H__

#include "dgStdafx.h"
#include "dgTypes.h"

//Undefine the SIMD build on Mac:
#ifdef OS_MACOS
#undef DG_BUILD_SIMD_CODE
#endif

#ifdef DG_BUILD_SIMD_CODE


Now I get errors all over the place complaining about "DG_MSC_VECTOR_AVX_ALIGMENT". Where is this symbol defined? I can't find it defined anywhere.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Core 300 Mac build issues

Postby Bird » Mon Apr 30, 2012 6:57 am

Looks like it's defined as nothing for non-windows platforms in core/dgTypes.h at line 197.

-Bird
Last edited by Bird on Mon Apr 30, 2012 12:16 pm, edited 2 times in total.
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Core 300 Mac build issues

Postby Bird » Mon Apr 30, 2012 12:02 pm

I was able to compile coreLibrary_300 using today's SVN 1853 and Xcode 3.2.4

In Xcode:
-----------

add Preprocessor Macro "_MAC_VER"
drag and drop physics, meshUtil, newton, and core folders into the Xcode source group
remove "physics/dgVehicleConstraint.h" and "dgVehicleConstraint.cpp"
in line 102 of dgCollisionInstance.cpp change "_ASSERT" to "_ASSERTE"

in Newton:
-----------

Make changes from pHySiQuE at top of "dgSimd_128.h"

#ifdef _MAC_VER
#undef DG_BUILD_SIMD_CODE
#endif

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Core 300 Mac build issues

Postby pHySiQuE » Mon Apr 30, 2012 1:22 pm

Bird, I followed your directions with Xcode 4.3.2, using both the LLVM-GCC and LLVM compilers, and just get a lot of errors.

It appears that due to Apple's adoption of LLVM, Newton 300 is not presently a cross-platform library. Will this be addressed, or should I be using Newton 200?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Core 300 Mac build issues

Postby Julio Jerez » Mon Apr 30, 2012 1:58 pm

Like I said LLVM compilers does not support any intrinsic code.

You will need to set a command line define that set DG_BUILD_SIMD_CODE
This is what is does now
Code: Select all
#if !(defined (__USE_DOUBLE_PRECISION__) || defined (__ppc__))
   #define DG_BUILD_SIMD_CODE
#endif

You can do this somethomg like this
Code: Select all
#if !(defined (__USE_DOUBLE_PRECISION__) || defined (__ppc__) || defined (__LLVM__))
   #define DG_BUILD_SIMD_CODE
#endif

Or whatever the define for LLVM is.
This is no Newton3002 this is for any project anywhere that uses intrinsic functions. Including Netwon200
But like I said I will not use LLMV you are crippling you product to run a 3.4 at best that what could go with hand optimize code using intrinsic.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Core 300 Mac build issues

Postby Julio Jerez » Mon Apr 30, 2012 2:09 pm

I thoink is LLVM does support older SSE but no SSE 3
in the simd_128 class try comemting these defines,
// #define DG_SSE_3
// #define DG_SSE_4

and it will use simple sse

in GCC the defaul if -sse
I have to set -sse3 to get then to compile.
almost avery machine out there support -SSE3 teh only on ethat do no are Pention3 and older pentium 4, all apple intel do support SSE4

maybe there is a way to see a GCC swith to pasts m_sse3

these are the option I use for linux
CPU_FLAGS = -O3 -fpic -msse -msse4.1 -mfpmath=sse
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Core 300 Mac build issues

Postby pHySiQuE » Mon Apr 30, 2012 4:10 pm

Screen Shot 2012-04-30 at 1.09.43 PM.png
Screen Shot 2012-04-30 at 1.09.43 PM.png (177.85 KiB) Viewed 5865 times
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Core 300 Mac build issues

Postby Julio Jerez » Tue May 01, 2012 6:57 am

I will try to make the xcode project this week end.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Core 300 Mac build issues

Postby pHySiQuE » Wed May 02, 2012 2:05 pm

Thank you. I will decide between core 300 and core 200 for the final product on Monday.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Core 300 Mac build issues

Postby Julio Jerez » Sun May 06, 2012 10:43 am

Ok I added teh xcode project.
I have to install xcode 3.25 because xcode 4.1 required OS10.7 with I do not have (I do no knwo why Apple make people buy an OS each time the make a new editro for xcode, go figure)

Anyway with some small changes I have it building for all versions of GCC starting with GCC 4.0
It also build LLVM code for both CGG 4.2 and the Apple Version 1.6

the code also univesal binaries, so it should also run on older G5's and G4's IMacs.
I did not tested yet, I I have time today I will build the sandboxDemos and check it in, but it should runs.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Core 300 Mac build issues

Postby Bird » Sun May 06, 2012 11:20 am

I did not tested yet, I I have time today I will build the sandboxDemos and check it in, but it should runs.

Thanks! I've been waiting patiently for the return of XCode support. :)

Core 300 compiled cleanly here using Xcode 3.2.4, but the demosSandbox Xcode 3.2.5 project looks like it's out of date and does not compile.

I have to install xcode 3.25 because xcode 4.1 required OS10.7 with I do not have (I do no knwo why Apple make people buy an OS each time the make a new editro for xcode, go figure)

I've been testing out Premake http://industriousone.com/premake ... it's come a long way since I first looked at it. The latest Premake beta 4.4 will allow you to generate an Xcode4 project without having to upgrade to OSX 10.7

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Core 300 Mac build issues

Postby Julio Jerez » Sun May 06, 2012 11:41 am

Bird wrote:Core 300 compiled cleanly here using Xcode 3.2.4, but the demosSandbox Xcode 3.2.5 project looks like it's out of date and does not compile.

I have to remake that project. I am hoping if goes without problems.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron