NVIDIAGameWorks / PhysX-3.4

NVIDIA PhysX SDK 3.4
https://www.nvidia.com/
2.35k stars 274 forks source link

Extremely big Android and Mac binaries. #48

Open GregSlazinski opened 6 years ago

GregSlazinski commented 6 years ago

I'm using my own compilation toolchain, because the included one IMO is overly complicated (requires cygwin,..) whereas my solution just requires NDK installed + running one BAT file.

However in my compilation results I'm getting very big physx binaries. Arm32 - libPhysX.a 123 MB Arm64 - libPhysX.a 177 MB

Is this the expected behavior?

I've already excluded KinematicCharacterController, PVD, Serialization.

1) Rename "PhysX_3.4" folder to "PhysX" (see #47) 2) Extract attached ZIP file to the root of the repository NVIDIAGameWorks/PhysX-3.4 3) Edit "Android/build.bat" to specify correct path to the "ndk-build" on your computer 4) Run the BAT file

Feel free to modify/integrate the files into the SDK if you wish.

Android.zip

AlesBorovicka commented 6 years ago

Hi, the size you mention is expected for debug and checked configurations, for profile and release the size is roughly 10MB.

GregSlazinski commented 6 years ago

Hi and thanks for your reply, however I'm compiling in Release mode for Android, yet I'm having 100+MB files. You can check the attachment from the previous post.

Application.mk APP_OPTIM := release Android.mk LOCAL_CPPFLAGS := -O3 -DPX_PHYSX_STATIC_LIB -DPX_COOKING -DPX_SUPPORT_PVD=0 -DNDEBUG

Also when I compile for Mac platform, using the official "xcode_osx64\PhysX.xcodeproj" I'm having the exact same problem, compiling with Release gives me: PhysX/Lib/osx64/*.a static libraries total size of 151 MB PhysX/Lib/ios64/*.a static libraries total size of 149 MB

AlesBorovicka commented 6 years ago

The compiler options look good, could it be some stripping that our toolchain does?

As for osx, the PhysX lib seems to be roughly 45MB.

GregSlazinski commented 6 years ago

How are you getting 45 MB? 1) Download PhysX repository 2) open "PhysX_3.4/Source/compiler/xcode_osx64/PhysX.xcodeproj" 3) compile in Release mode. 4) get 151 MB total of static libraries results Are you not getting the same results as I am?

Please see screenshot screen shot 2017-11-10 at 20 23 34

AlesBorovicka commented 6 years ago

Yes, I get the same, but you need only libPhysX3, libPhysX3Common, libPhysX3Cooking, then if needed also Extensions and Vehicle. Lowlevel, scenequery and simulation controller are part of libPhysX3 which does have the size of 45MB as I wrote.

GregSlazinski commented 6 years ago

It doesn't work for me like you say.

If I link all libraries (Image 1) links OK. 1

But if I disable just 1 library "libLowLevel.a" (Image 2)

2

then I get linker errors (Image 3)

3

Also as you can see, the tutorials bundled with PhysX SDK also link to all of the libraries (including lowlevel*.a) And when I remove one of the lowlevel.a from the linker list, then I get linker errors as well. 4

So the conclusion is that all *.a are in fact needed, and the 150MB I think is kind of an overkill.

AlesBorovicka commented 6 years ago

Hmm that does not look correct. In 3.3 we released just binary packages and only the PhysX libraries were shipped and required for build. It looks like something is broken here, you should not require the lowlevel libraries for your application, PhysX library should contain the lowlevel libs. Let me investigate this issue and fix it. This looks like osx/ios issue only most likely.