PhysX-3.3 build failed for Mac osX64

Hey everyone,

I’m trying to build PhysX 3.3 for Mac OS X with 64 bit to include the libraries into another project. I have OS X Yosemite 10.10 and Xcode 7.0. Just opening and building the Xcode project provided in the compiler folder gave me several errors, so I decided to build it via the Makefiles with GNU Make 3.81 provided in the same folder structure. It seems that my compiler (I’m using clang 600) is rather strict and sees things as errors, where other compilers would be more forthcoming.

I encountered the following errors:

  • "This macro is a reserved identifier" concerning variables beginning with an underscore and a capital letter, as they would be reserved for compiler identifiers, I think.
  • "unused typedef 'PxCompileTimeAssert_Dummy' [-Werror,-Wunused-local-typedef]" concerning the definition of PX_COMPILE_TIME_ASSERT which is used in several other files, where this error is issued during compilation. I managed to turn this error off setting cppflags

But now I get an error I don’t see myself bypassing just so easily:
Some header definitions begin with a double underscore: __ . This is usually reserved for any compiler generated definitions, I found out, and, as clang is rather strict, i throws the following error:

In file included from ./…/…/PhysX/src/GrbEvents.cpp:14:
./…/…/PhysX/src/GrbSceneEventDescs.h:15:9: error: macro name is a reserved identifier
[-Werror,-Wreserved-id-macro]
#define GRB_SCENE_EVENT_DESCS_H
^
In file included from ./…/…/PhysX/src/GrbEvents.cpp:14:
In file included from ./…/…/PhysX/src/GrbSceneEventDescs.h:38:
./…/…/PhysX/src/GrbStackAllocator.h:15:9: error: macro name is a reserved identifier
[-Werror,-Wreserved-id-macro]
#define GRB_STACK_ALLOC_H
^
2 errors generated.
make: *** [build/PhysX_debug/PhysX/src/GrbEvents.cpp.o] Error 1
Annas-MacBook-Pro:make_osx64 Anna$ make debug
building …/…/…/Lib/osx64/libPhysX3CookingDEBUG.a complete!
PhysX: compiling debug ./…/…/PhysX/src/GrbEvents.cpp…
In file included from ./…/…/PhysX/src/GrbEvents.cpp:14:
./…/…/PhysX/src/GrbSceneEventDescs.h:15:9: error: macro name is a reserved identifier
[-Werror,-Wreserved-id-macro]
#define GRB_SCENE_EVENT_DESCS_H
^
In file included from ./…/…/PhysX/src/GrbEvents.cpp:14:
In file included from ./…/…/PhysX/src/GrbSceneEventDescs.h:38:
./…/…/PhysX/src/GrbStackAllocator.h:15:9: error: macro name is a reserved identifier
[-Werror,-Wreserved-id-macro]
#define GRB_STACK_ALLOC_H
^
2 errors generated.
make: *** [build/PhysX_debug/PhysX/src/GrbEvents.cpp.o] Error 1
Annas-MacBook-Pro:make_osx64 Anna$ make debug
building …/…/…/Lib/osx64/libPhysX3CookingDEBUG.a complete!
PhysX: compiling debug ./…/…/PhysX/src/GrbEvents.cpp…
In file included from ./…/…/PhysX/src/GrbEvents.cpp:14:
./…/…/PhysX/src/GrbSceneEventDescs.h:15:9: error: macro name is a reserved identifier
[-Werror,-Wreserved-id-macro]
#define GRB_SCENE_EVENT_DESCS_H
^
In file included from ./…/…/PhysX/src/GrbEvents.cpp:14:
In file included from ./…/…/PhysX/src/GrbSceneEventDescs.h:38:
./…/…/PhysX/src/GrbStackAllocator.h:15:9: error: macro name is a reserved identifier
[-Werror,-Wreserved-id-macro]
#define GRB_STACK_ALLOC_H

Does anyone know, what I have to do, to finally get PhysX to properly build?

Hi,
Did you manage to solve this issue? id be interested in your solution if you did!

I encountered this problem too… would anyone be so kind to share the solution? Thanks! :)

I fixed it by replacing all “-Werror” with “-Wno-reserved-id-macro” in samples.xcodeproj in xcode 7.2.

I looked at physx source and a recent change was made to the #define. This will not yet be released but will make the next release of 3.3.x. Please replace

#ifndef GRB_STACK_ALLOC_H
#define GRB_STACK_ALLOC_H

with

#ifndef GRB_STACK_ALLOC_H
#define GRB_STACK_ALLOC_H

Does this solve your problem?

Cheers,

Gorodn

In my case I was trying to make PhysX work with Cinder engine ( GitHub - BanTheRewind/Cinder-Physx: Nvidia Physx implementation for Cinder ).

Adding following to “Other C Flags” for each configuration on each target helped me (but original samples are still not working for me):

-Wno-reserved-id-macro
-Wno-unused-local-typedefs

@gyeoman Before doing that I’ve tried your recommendation and made replaces to whole project but there much more errors appeared.