Open robertosfield opened 4 months ago
I just tried to use the Omnversere SDK download but it required me to register and create an account. I've attempted to do both but the later left the last button to actually create the account greyed out despite filling in all the required details??!
There's the source code, which is what Nvidia recommend using, and a vcpkg port. I used the former as the latter makes some vcpkg-specific adjustments and I didn't want this library to be married to an unofficial distribution. On my Windows machine, Nvidia's scripts just worked, although I needed to change a setting after the fact to dynamically link to the C runtime as none of the presets supported that out of the box whereas it's the default for the VSG and the project the library's being created for.
I'm not hugely surprised that Nvidia's scripts don't work reliably on every Linux machine - if it were easy, there'd probably be a physx5-devel
package available via apt
, and there isn't. There's an AUR package for PhysX 4, so the build script for that and patches it has might point you in the right direction, even though Arch isn't Ubuntu-based: https://aur.archlinux.org/packages/physx. There is a readme that says Ubuntu 22.04 should work with GCC 11 or Clang 14, though, so maybe making those specific versions available will work. https://github.com/NVIDIA-Omniverse/PhysX/blob/main/physx/documentation/platformreadme/linux/README_LINUX.md
Thanks for the link. Haven't found anything helpful so far, it's a bit of script shell game. I tried uninstallib clang-15 and installing clang-14 but the OS couldn't find all the required dependencies.
I then tried symbolic link between cl;ang-15 and clang so we could run clang-15 using the name clang, I get a bit further but now PhysX is complaining that -lstdc++ is not available... it's a game a whack a mole.
The commit I just pushed makes this work with PhysX from vcpkg if you set the new PHYSX_FROM_VCPKG
CMake option. Despite people's typical assumption, vcpkg works on not-Windows, too.
I have attempted to install OmmniVerse on Linux but there isn't any clear path to finding PhysX within it let alone using it as a 3rd party dependency.
I then when back to trying to get PhysX github repo to compile and got further, I had to hack the CMakeLists.txt to get things to compile and installed in my ~/Install directory alongside all the other libs I build and install locally in my home account, but vsgPhsX isn't happy yet, even if I set CMAKE_INSTALL_PREFIX to my ~/Install directory.
PhysX put most of it's headers directly into ~/Install/include rather than within a PhysX directory like any normal library would do. NVidia seem to like spraying their sent everywhere rather than fitting in discretely and working how the rest of open source world tries to manage itself.
I see that you needed to implement your own vsgPhsX/cmake/FindPhysX5.cmake, perhaps this needs to evolve further to handle how PhysX installs itself under Linux.
$ cmake . -DCMAKE_INSTALL_PREFIX=~/Install
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Vulkan: /home/robert/3rdParty/VulkanSDK/1.3.268.0/x86_64/lib/libvulkan.so (Required is at least version "1.1.70.0")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /bin/pkg-config (found version "0.29.2")
-- Checking for module 'xcb'
-- Found xcb, version 1.14
-- Reading 'vsg_...' macros from /home/robert/Install/lib/cmake/vsg/vsgMacros.cmake - look there for documentation
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find PhysX5 (missing: PhysX5_PhysX_LIBRARY
PhysX5_PhysXCommon_LIBRARY PhysX5_PhysXExtensions_LIBRARY
PhysX5_PhysXFoundation_LIBRARY) (found suitable version "5.3.1", minimum
required is "5.0.0")
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/FindPhysX5.cmake:122 (find_package_handle_standard_args)
CMakeLists.txt:20 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/robert/Dev/vsgPhysX/CMakeFiles/CMakeOutput.log".
~~~ sh
This is what PhysX wrote to the console when I ran it's install target:
~~~ sh
Install the project...
-- Install configuration: "release"
-- Installing: /home/robert/Install/include/foundation/unix/neon/PxUnixNeonAoS.h
-- Installing: /home/robert/Install/include/foundation/unix/neon/PxUnixNeonInlineAoS.h
-- Installing: /home/robert/Install/include/foundation/unix/sse2/PxUnixSse2AoS.h
-- Installing: /home/robert/Install/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h
-- Installing: /home/robert/Install/include/foundation/unix/PxUnixMathIntrinsics.h
-- Installing: /home/robert/Install/include/foundation/unix/PxUnixIntrinsics.h
-- Installing: /home/robert/Install/include/foundation/unix/PxUnixAoS.h
-- Installing: /home/robert/Install/include/foundation/unix/PxUnixInlineAoS.h
-- Installing: /home/robert/Install/include/foundation/unix/PxUnixTrigConstants.h
-- Installing: /home/robert/Install/include/foundation/unix/PxUnixFPU.h
-- Installing: /home/robert/Install/include/foundation/PxFoundation.h
-- Installing: /home/robert/Install/include/foundation/PxAssert.h
-- Installing: /home/robert/Install/include/foundation/PxFoundationConfig.h
-- Installing: /home/robert/Install/include/foundation/PxMathUtils.h
-- Installing: /home/robert/Install/include/foundation/Px.h
-- Installing: /home/robert/Install/include/foundation/PxAlignedMalloc.h
-- Installing: /home/robert/Install/include/foundation/PxAllocatorCallback.h
-- Installing: /home/robert/Install/include/foundation/PxProfiler.h
-- Installing: /home/robert/Install/include/foundation/PxAoS.h
-- Installing: /home/robert/Install/include/foundation/PxAlloca.h
-- Installing: /home/robert/Install/include/foundation/PxAllocator.h
-- Installing: /home/robert/Install/include/foundation/PxArray.h
-- Installing: /home/robert/Install/include/foundation/PxAtomic.h
-- Installing: /home/robert/Install/include/foundation/PxBasicTemplates.h
-- Installing: /home/robert/Install/include/foundation/PxBitMap.h
-- Installing: /home/robert/Install/include/foundation/PxBitAndData.h
-- Installing: /home/robert/Install/include/foundation/PxBitUtils.h
-- Installing: /home/robert/Install/include/foundation/PxBounds3.h
-- Installing: /home/robert/Install/include/foundation/PxBroadcast.h
-- Installing: /home/robert/Install/include/foundation/PxErrorCallback.h
-- Installing: /home/robert/Install/include/foundation/PxErrors.h
-- Installing: /home/robert/Install/include/foundation/PxFlags.h
-- Installing: /home/robert/Install/include/foundation/PxFPU.h
-- Installing: /home/robert/Install/include/foundation/PxInlineAoS.h
-- Installing: /home/robert/Install/include/foundation/PxIntrinsics.h
-- Installing: /home/robert/Install/include/foundation/PxHash.h
-- Installing: /home/robert/Install/include/foundation/PxHashInternals.h
-- Installing: /home/robert/Install/include/foundation/PxHashMap.h
-- Installing: /home/robert/Install/include/foundation/PxHashSet.h
-- Installing: /home/robert/Install/include/foundation/PxInlineAllocator.h
-- Installing: /home/robert/Install/include/foundation/PxInlineArray.h
-- Installing: /home/robert/Install/include/foundation/PxPinnedArray.h
-- Installing: /home/robert/Install/include/foundation/PxMathIntrinsics.h
-- Installing: /home/robert/Install/include/foundation/PxMutex.h
-- Installing: /home/robert/Install/include/foundation/PxIO.h
-- Installing: /home/robert/Install/include/foundation/PxMat33.h
-- Installing: /home/robert/Install/include/foundation/PxMat34.h
-- Installing: /home/robert/Install/include/foundation/PxMat44.h
-- Installing: /home/robert/Install/include/foundation/PxMath.h
-- Installing: /home/robert/Install/include/foundation/PxMemory.h
-- Installing: /home/robert/Install/include/foundation/PxPlane.h
-- Installing: /home/robert/Install/include/foundation/PxPool.h
-- Installing: /home/robert/Install/include/foundation/PxPreprocessor.h
-- Installing: /home/robert/Install/include/foundation/PxQuat.h
-- Installing: /home/robert/Install/include/foundation/PxPhysicsVersion.h
-- Installing: /home/robert/Install/include/foundation/PxSortInternals.h
-- Installing: /home/robert/Install/include/foundation/PxSimpleTypes.h
-- Installing: /home/robert/Install/include/foundation/PxSList.h
-- Installing: /home/robert/Install/include/foundation/PxSocket.h
-- Installing: /home/robert/Install/include/foundation/PxSort.h
-- Installing: /home/robert/Install/include/foundation/PxStrideIterator.h
-- Installing: /home/robert/Install/include/foundation/PxString.h
-- Installing: /home/robert/Install/include/foundation/PxSync.h
-- Installing: /home/robert/Install/include/foundation/PxTempAllocator.h
-- Installing: /home/robert/Install/include/foundation/PxThread.h
-- Installing: /home/robert/Install/include/foundation/PxTransform.h
-- Installing: /home/robert/Install/include/foundation/PxTime.h
-- Installing: /home/robert/Install/include/foundation/PxUnionCast.h
-- Installing: /home/robert/Install/include/foundation/PxUserAllocated.h
-- Installing: /home/robert/Install/include/foundation/PxUtilities.h
-- Installing: /home/robert/Install/include/foundation/PxVec2.h
-- Installing: /home/robert/Install/include/foundation/PxVec3.h
-- Installing: /home/robert/Install/include/foundation/PxVec4.h
-- Installing: /home/robert/Install/include/foundation/PxVecMath.h
-- Installing: /home/robert/Install/include/foundation/PxVecMathAoSScalar.h
-- Installing: /home/robert/Install/include/foundation/PxVecMathAoSScalarInline.h
-- Installing: /home/robert/Install/include/foundation/PxVecMathSSE.h
-- Installing: /home/robert/Install/include/foundation/PxVecQuat.h
-- Installing: /home/robert/Install/include/foundation/PxVecTransform.h
-- Installing: /home/robert/Install/include/foundation/PxSIMDHelpers.h
-- Installing: /home/robert/Install/include/gpu/PxGpu.h
-- Installing: /home/robert/Install/include/gpu/PxPhysicsGpu.h
-- Installing: /home/robert/Install/include/cudamanager/PxCudaContextManager.h
-- Installing: /home/robert/Install/include/cudamanager/PxCudaContext.h
-- Installing: /home/robert/Install/include/cudamanager/PxCudaTypes.h
-- Installing: /home/robert/Install/include/PxActor.h
-- Installing: /home/robert/Install/include/PxActorData.h
-- Installing: /home/robert/Install/include/PxAggregate.h
-- Installing: /home/robert/Install/include/PxArticulationFlag.h
-- Installing: /home/robert/Install/include/PxArticulationJointReducedCoordinate.h
-- Installing: /home/robert/Install/include/PxArticulationLink.h
-- Installing: /home/robert/Install/include/PxArticulationReducedCoordinate.h
-- Installing: /home/robert/Install/include/PxArticulationTendon.h
-- Installing: /home/robert/Install/include/PxArticulationTendonData.h
-- Installing: /home/robert/Install/include/PxAttachment.h
-- Installing: /home/robert/Install/include/PxBroadPhase.h
-- Installing: /home/robert/Install/include/PxClient.h
-- Installing: /home/robert/Install/include/PxConeLimitedConstraint.h
-- Installing: /home/robert/Install/include/PxConstraint.h
-- Installing: /home/robert/Install/include/PxConstraintDesc.h
-- Installing: /home/robert/Install/include/PxContact.h
-- Installing: /home/robert/Install/include/PxContactModifyCallback.h
-- Installing: /home/robert/Install/include/PxDeletionListener.h
-- Installing: /home/robert/Install/include/PxFEMParameter.h
-- Installing: /home/robert/Install/include/PxFEMClothFlags.h
-- Installing: /home/robert/Install/include/PxFiltering.h
-- Installing: /home/robert/Install/include/PxForceMode.h
-- Installing: /home/robert/Install/include/PxHairSystemFlag.h
-- Installing: /home/robert/Install/include/PxImmediateMode.h
-- Installing: /home/robert/Install/include/PxLockedData.h
-- Installing: /home/robert/Install/include/PxNodeIndex.h
-- Installing: /home/robert/Install/include/PxParticleBuffer.h
-- Installing: /home/robert/Install/include/PxParticleGpu.h
-- Installing: /home/robert/Install/include/PxParticleSolverType.h
-- Installing: /home/robert/Install/include/PxParticleSystem.h
-- Installing: /home/robert/Install/include/PxParticleSystemFlag.h
-- Installing: /home/robert/Install/include/PxPBDParticleSystem.h
-- Installing: /home/robert/Install/include/PxPhysics.h
-- Installing: /home/robert/Install/include/PxPhysicsAPI.h
-- Installing: /home/robert/Install/include/PxPhysicsSerialization.h
-- Installing: /home/robert/Install/include/PxPhysXConfig.h
-- Installing: /home/robert/Install/include/PxPruningStructure.h
-- Installing: /home/robert/Install/include/PxQueryFiltering.h
-- Installing: /home/robert/Install/include/PxQueryReport.h
-- Installing: /home/robert/Install/include/PxRigidActor.h
-- Installing: /home/robert/Install/include/PxRigidBody.h
-- Installing: /home/robert/Install/include/PxRigidDynamic.h
-- Installing: /home/robert/Install/include/PxRigidStatic.h
-- Installing: /home/robert/Install/include/PxScene.h
-- Installing: /home/robert/Install/include/PxSceneDesc.h
-- Installing: /home/robert/Install/include/PxSceneLock.h
-- Installing: /home/robert/Install/include/PxSceneQueryDesc.h
-- Installing: /home/robert/Install/include/PxSceneQuerySystem.h
-- Installing: /home/robert/Install/include/PxShape.h
-- Installing: /home/robert/Install/include/PxSimulationEventCallback.h
-- Installing: /home/robert/Install/include/PxSimulationStatistics.h
-- Installing: /home/robert/Install/include/PxSoftBody.h
-- Installing: /home/robert/Install/include/PxSoftBodyFlag.h
-- Installing: /home/robert/Install/include/PxSparseGridParams.h
-- Installing: /home/robert/Install/include/PxVisualizationParameter.h
-- Installing: /home/robert/Install/include/PxIsosurfaceExtraction.h
-- Installing: /home/robert/Install/include/PxSmoothing.h
-- Installing: /home/robert/Install/include/PxAnisotropy.h
-- Installing: /home/robert/Install/include/PxParticleNeighborhoodProvider.h
-- Installing: /home/robert/Install/include/PxArrayConverter.h
-- Installing: /home/robert/Install/include/PxLineStripSkinning.h
-- Installing: /home/robert/Install/include/PxSDFBuilder.h
-- Installing: /home/robert/Install/include/PxBaseMaterial.h
-- Installing: /home/robert/Install/include/PxFEMMaterial.h
-- Installing: /home/robert/Install/include/PxFEMSoftBodyMaterial.h
-- Installing: /home/robert/Install/include/PxFEMClothMaterial.h
-- Installing: /home/robert/Install/include/PxParticleMaterial.h
-- Installing: /home/robert/Install/include/PxPBDMaterial.h
-- Installing: /home/robert/Install/include/PxFLIPMaterial.h
-- Installing: /home/robert/Install/include/PxMPMMaterial.h
-- Installing: /home/robert/Install/include/PxMaterial.h
-- Installing: /home/robert/Install/include/common/PxBase.h
-- Installing: /home/robert/Install/include/common/PxCollection.h
-- Installing: /home/robert/Install/include/common/PxCoreUtilityTypes.h
-- Installing: /home/robert/Install/include/common/PxInsertionCallback.h
-- Installing: /home/robert/Install/include/common/PxMetaData.h
-- Installing: /home/robert/Install/include/common/PxMetaDataFlags.h
-- Installing: /home/robert/Install/include/common/PxPhysXCommonConfig.h
-- Installing: /home/robert/Install/include/common/PxProfileZone.h
-- Installing: /home/robert/Install/include/common/PxRenderBuffer.h
-- Installing: /home/robert/Install/include/common/PxRenderOutput.h
-- Installing: /home/robert/Install/include/common/PxSerialFramework.h
-- Installing: /home/robert/Install/include/common/PxSerializer.h
-- Installing: /home/robert/Install/include/common/PxStringTable.h
-- Installing: /home/robert/Install/include/common/PxTolerancesScale.h
-- Installing: /home/robert/Install/include/common/PxTypeInfo.h
-- Installing: /home/robert/Install/include/pvd/PxPvdSceneClient.h
-- Installing: /home/robert/Install/include/pvd/PxPvd.h
-- Installing: /home/robert/Install/include/pvd/PxPvdTransport.h
-- Installing: /home/robert/Install/include/omnipvd/PxOmniPvd.h
-- Installing: /home/robert/Install/include/collision/PxCollisionDefs.h
-- Installing: /home/robert/Install/include/solver/PxSolverDefs.h
-- Installing: /home/robert/Install/include/PxConfig.h
-- Installing: /home/robert/Install/include/characterkinematic/PxBoxController.h
-- Installing: /home/robert/Install/include/characterkinematic/PxCapsuleController.h
-- Installing: /home/robert/Install/include/characterkinematic/PxController.h
-- Installing: /home/robert/Install/include/characterkinematic/PxControllerBehavior.h
-- Installing: /home/robert/Install/include/characterkinematic/PxControllerManager.h
-- Installing: /home/robert/Install/include/characterkinematic/PxControllerObstacles.h
-- Installing: /home/robert/Install/include/characterkinematic/PxExtended.h
-- Installing: /home/robert/Install/include/geometry/PxBoxGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxCapsuleGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxConvexMesh.h
-- Installing: /home/robert/Install/include/geometry/PxConvexMeshGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxCustomGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxGeometryInternal.h
-- Installing: /home/robert/Install/include/geometry/PxGeometryHelpers.h
-- Installing: /home/robert/Install/include/geometry/PxGeometryHit.h
-- Installing: /home/robert/Install/include/geometry/PxGeometryQuery.h
-- Installing: /home/robert/Install/include/geometry/PxGeometryQueryFlags.h
-- Installing: /home/robert/Install/include/geometry/PxGeometryQueryContext.h
-- Installing: /home/robert/Install/include/geometry/PxHairSystemDesc.h
-- Installing: /home/robert/Install/include/geometry/PxHairSystemGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxHeightField.h
-- Installing: /home/robert/Install/include/geometry/PxHeightFieldDesc.h
-- Installing: /home/robert/Install/include/geometry/PxHeightFieldFlag.h
-- Installing: /home/robert/Install/include/geometry/PxHeightFieldGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxHeightFieldSample.h
-- Installing: /home/robert/Install/include/geometry/PxMeshQuery.h
-- Installing: /home/robert/Install/include/geometry/PxMeshScale.h
-- Installing: /home/robert/Install/include/geometry/PxPlaneGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxReportCallback.h
-- Installing: /home/robert/Install/include/geometry/PxSimpleTriangleMesh.h
-- Installing: /home/robert/Install/include/geometry/PxSphereGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxTriangle.h
-- Installing: /home/robert/Install/include/geometry/PxTriangleMesh.h
-- Installing: /home/robert/Install/include/geometry/PxTriangleMeshGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxBVH.h
-- Installing: /home/robert/Install/include/geometry/PxBVHBuildStrategy.h
-- Installing: /home/robert/Install/include/geometry/PxTetrahedron.h
-- Installing: /home/robert/Install/include/geometry/PxTetrahedronMesh.h
-- Installing: /home/robert/Install/include/geometry/PxTetrahedronMeshGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxParticleSystemGeometry.h
-- Installing: /home/robert/Install/include/geometry/PxGjkQuery.h
-- Installing: /home/robert/Install/include/geomutils/PxContactBuffer.h
-- Installing: /home/robert/Install/include/geomutils/PxContactPoint.h
-- Installing: /home/robert/Install/include/cooking/PxBVH33MidphaseDesc.h
-- Installing: /home/robert/Install/include/cooking/PxBVH34MidphaseDesc.h
-- Installing: /home/robert/Install/include/cooking/Pxc.h
-- Installing: /home/robert/Install/include/cooking/PxConvexMeshDesc.h
-- Installing: /home/robert/Install/include/cooking/PxCooking.h
-- Installing: /home/robert/Install/include/cooking/PxCookingInternal.h
-- Installing: /home/robert/Install/include/cooking/PxMidphaseDesc.h
-- Installing: /home/robert/Install/include/cooking/PxTriangleMeshDesc.h
-- Installing: /home/robert/Install/include/cooking/PxTetrahedronMeshDesc.h
-- Installing: /home/robert/Install/include/cooking/PxBVHDesc.h
-- Up-to-date: /home/robert/Install/include/cooking/PxTetrahedronMeshDesc.h
-- Installing: /home/robert/Install/include/cooking/PxSDFDesc.h
-- Installing: /home/robert/Install/include/extensions/PxBinaryConverter.h
-- Installing: /home/robert/Install/include/extensions/PxBroadPhaseExt.h
-- Installing: /home/robert/Install/include/extensions/PxCollectionExt.h
-- Installing: /home/robert/Install/include/extensions/PxConvexMeshExt.h
-- Installing: /home/robert/Install/include/extensions/PxDefaultAllocator.h
-- Installing: /home/robert/Install/include/extensions/PxDefaultCpuDispatcher.h
-- Installing: /home/robert/Install/include/extensions/PxDefaultErrorCallback.h
-- Installing: /home/robert/Install/include/extensions/PxDefaultSimulationFilterShader.h
-- Installing: /home/robert/Install/include/extensions/PxDefaultStreams.h
-- Installing: /home/robert/Install/include/extensions/PxExtensionsAPI.h
-- Installing: /home/robert/Install/include/extensions/PxMassProperties.h
-- Installing: /home/robert/Install/include/extensions/PxRaycastCCD.h
-- Installing: /home/robert/Install/include/extensions/PxRepXSerializer.h
-- Installing: /home/robert/Install/include/extensions/PxRepXSimpleType.h
-- Installing: /home/robert/Install/include/extensions/PxRigidActorExt.h
-- Installing: /home/robert/Install/include/extensions/PxRigidBodyExt.h
-- Installing: /home/robert/Install/include/extensions/PxSceneQueryExt.h
-- Installing: /home/robert/Install/include/extensions/PxSceneQuerySystemExt.h
-- Installing: /home/robert/Install/include/extensions/PxCustomSceneQuerySystem.h
-- Installing: /home/robert/Install/include/extensions/PxSerialization.h
-- Installing: /home/robert/Install/include/extensions/PxShapeExt.h
-- Installing: /home/robert/Install/include/extensions/PxSimpleFactory.h
-- Installing: /home/robert/Install/include/extensions/PxSmoothNormals.h
-- Installing: /home/robert/Install/include/extensions/PxSoftBodyExt.h
-- Installing: /home/robert/Install/include/extensions/PxStringTableExt.h
-- Installing: /home/robert/Install/include/extensions/PxTriangleMeshExt.h
-- Installing: /home/robert/Install/include/extensions/PxTetrahedronMeshExt.h
-- Installing: /home/robert/Install/include/extensions/PxRemeshingExt.h
-- Installing: /home/robert/Install/include/extensions/PxTriangleMeshAnalysisResult.h
-- Installing: /home/robert/Install/include/extensions/PxTetrahedronMeshAnalysisResult.h
-- Installing: /home/robert/Install/include/extensions/PxTetMakerExt.h
-- Installing: /home/robert/Install/include/extensions/PxGjkQueryExt.h
-- Installing: /home/robert/Install/include/extensions/PxCustomGeometryExt.h
-- Installing: /home/robert/Install/include/extensions/PxSamplingExt.h
-- Installing: /home/robert/Install/include/extensions/PxParticleClothCooker.h
-- Installing: /home/robert/Install/include/extensions/PxParticleExt.h
-- Installing: /home/robert/Install/include/extensions/PxConstraintExt.h
-- Installing: /home/robert/Install/include/extensions/PxContactJoint.h
-- Installing: /home/robert/Install/include/extensions/PxD6Joint.h
-- Installing: /home/robert/Install/include/extensions/PxD6JointCreate.h
-- Installing: /home/robert/Install/include/extensions/PxDistanceJoint.h
-- Up-to-date: /home/robert/Install/include/extensions/PxContactJoint.h
-- Installing: /home/robert/Install/include/extensions/PxFixedJoint.h
-- Installing: /home/robert/Install/include/extensions/PxGearJoint.h
-- Installing: /home/robert/Install/include/extensions/PxRackAndPinionJoint.h
-- Installing: /home/robert/Install/include/extensions/PxJoint.h
-- Installing: /home/robert/Install/include/extensions/PxJointLimit.h
-- Installing: /home/robert/Install/include/extensions/PxPrismaticJoint.h
-- Installing: /home/robert/Install/include/extensions/PxRevoluteJoint.h
-- Installing: /home/robert/Install/include/extensions/PxSphericalJoint.h
-- Installing: /home/robert/Install/include/filebuf/PxFileBuf.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleComponents.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleDrive.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleDrive4W.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleDriveNW.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleDriveTank.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleNoDrive.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleSDK.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleShaders.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleTireFriction.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleUpdate.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleUtil.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleUtilControl.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleUtilSetup.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleUtilTelemetry.h
-- Installing: /home/robert/Install/include/vehicle/PxVehicleWheels.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleAPI.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleComponent.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleComponentSequence.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleLimits.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleParams.h
-- Installing: /home/robert/Install/include/vehicle2/PxVehicleMaths.h
-- Installing: /home/robert/Install/include/vehicle2/braking/PxVehicleBrakingFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/braking/PxVehicleBrakingParams.h
-- Installing: /home/robert/Install/include/vehicle2/commands/PxVehicleCommandHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/commands/PxVehicleCommandParams.h
-- Installing: /home/robert/Install/include/vehicle2/commands/PxVehicleCommandStates.h
-- Installing: /home/robert/Install/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h
-- Installing: /home/robert/Install/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h
-- Installing: /home/robert/Install/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h
-- Installing: /home/robert/Install/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h
-- Installing: /home/robert/Install/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h
-- Installing: /home/robert/Install/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h
-- Installing: /home/robert/Install/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h
-- Installing: /home/robert/Install/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h
-- Installing: /home/robert/Install/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h
-- Installing: /home/robert/Install/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h
-- Installing: /home/robert/Install/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h
-- Installing: /home/robert/Install/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h
-- Installing: /home/robert/Install/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h
-- Installing: /home/robert/Install/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h
-- Installing: /home/robert/Install/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h
-- Installing: /home/robert/Install/include/vehicle2/steering/PxVehicleSteeringFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/steering/PxVehicleSteeringParams.h
-- Installing: /home/robert/Install/include/vehicle2/suspension/PxVehicleSuspensionComponents.h
-- Installing: /home/robert/Install/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/suspension/PxVehicleSuspensionParams.h
-- Installing: /home/robert/Install/include/vehicle2/suspension/PxVehicleSuspensionStates.h
-- Installing: /home/robert/Install/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/tire/PxVehicleTireComponents.h
-- Installing: /home/robert/Install/include/vehicle2/tire/PxVehicleTireFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/tire/PxVehicleTireHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/tire/PxVehicleTireParams.h
-- Installing: /home/robert/Install/include/vehicle2/tire/PxVehicleTireStates.h
-- Installing: /home/robert/Install/include/vehicle2/wheel/PxVehicleWheelComponents.h
-- Installing: /home/robert/Install/include/vehicle2/wheel/PxVehicleWheelFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/wheel/PxVehicleWheelParams.h
-- Installing: /home/robert/Install/include/vehicle2/wheel/PxVehicleWheelStates.h
-- Installing: /home/robert/Install/include/vehicle2/wheel/PxVehicleWheelHelpers.h
-- Installing: /home/robert/Install/include/vehicle2/pvd/PxVehiclePvdComponents.h
-- Installing: /home/robert/Install/include/vehicle2/pvd/PxVehiclePvdFunctions.h
-- Installing: /home/robert/Install/include/vehicle2/pvd/PxVehiclePvdHelpers.h
-- Installing: /home/robert/Install/source/fastxml/include/PsFastXml.h
-- Installing: /home/robert/Install/include/task/PxCpuDispatcher.h
-- Installing: /home/robert/Install/include/task/PxTask.h
-- Installing: /home/robert/Install/include/task/PxTaskManager.h
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXFoundation_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXCharacterKinematic_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXPvdSDK_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXCommon_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXCooking_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXExtensions_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXVehicle_static_64.a
-- Installing: /home/robert/Install/bin/linux.clang/release/libPhysXVehicle2_static_64.a
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdLibraryFunctions.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdCommands.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdDefines.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdReader.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdWriter.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdReadStream.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdWriteStream.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdFileReadStream.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdFileWriteStream.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdMemoryStream.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdLibraryHelpers.h
-- Installing: /home/robert/Install/pvdruntime/include/OmniPvdLoader.h
-- Up-to-date: /home/robert/Install/pvdruntime/include/OmniPvdLoader.h
-- Installing: /home/robert/Install/bin/linux.clang/release/libPVDRuntime_64.so
Actually, the finder script should work just fine as-is with that directory structure, but you need to tell it that PHYSX_PLATFORM_DIRECTORY_NAME
is linux.clang
, either with -DPHYSX_PLATFORM_DIRECTORY_NAME=linux.clang
on the command line when configuring CMake, or via ccmake
or cmake-gui
. I made that string an argument rather than computing it as PhysX uses several hundred lines of CMake to figure out what it should be, and it's dependent on several options, so I'd be forced to take arguments for the finder script anyway. I tried defaulting to a wildcard, but they only work in filenames and as a suffix to the search directory, so that didn't accomplish anything.
By the way, CMAKE_INSTALL_PREFIX
is only one of the paths CMake searches for things by default. CMAKE_PREFIX_PATH
(available both as a CMake option and an environment variable) is a list of directories separated like the OS PATH
environment variable (so :
on Unix and ;
on Windows) that it'll also search. That means that if you've got a library that doesn't install itself to a subdirectory by default, you can manually add a subdirectory to CMAKE_INSTALL_PREFIX
when installing that project, and add that directory to CMAKE_PREFIX_PATH
in projects that consume it, and everything will still work, but it'll be easier to remove the library and do all the other things having it in a subdirectory helps with.
Thanks for the -DPHYSX_PLATFORM_DIRECTORY_NAME=linux.clang tip, with that addition things now generate the make files and I'm able to progress a bit further. I get a compile error:
-- Reading 'vsg_...' macros from /home/robert/Install/lib/cmake/vsg/vsgMacros.cmake - look there for documentation
-- Configuring done
-- Generating done
-- Build files have been written to: /home/robert/Dev/vsgPhysX
Consolidate compiler generated dependencies of target vsgPhysX
[ 11%] Building CXX object CMakeFiles/vsgPhysX.dir/src/vsgPhysX/Actor.cpp.o
[ 22%] Building CXX object CMakeFiles/vsgPhysX.dir/src/vsgPhysX/Engine.cpp.o
[ 33%] Building CXX object CMakeFiles/vsgPhysX.dir/src/vsgPhysX/PhysicsTransform.cpp.o
[ 44%] Building CXX object CMakeFiles/vsgPhysX.dir/src/vsgPhysX/ActorBuilder.cpp.o
[ 55%] Building CXX object CMakeFiles/vsgPhysX.dir/src/vsgPhysX/SimulateOperation.cpp.o
[ 66%] Building CXX object CMakeFiles/vsgPhysX.dir/src/vsgPhysX/Scene.cpp.o
In file included from /home/robert/Dev/vsgPhysX/include/vsgPhysX/PhysicsTransform.h:6,
from /home/robert/Dev/vsgPhysX/src/vsgPhysX/PhysicsTransform.cpp:1:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h: In member function ‘vsgPhysX::ref_ptr<T>& vsgPhysX::ref_ptr<T>::assignNoAcquireRef(R*)’:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h:169:20: error: ‘ptr’ was not declared in this scope; did you mean ‘_ptr’?
169 | _ptr = ptr;
| ^~~
| _ptr
In file included from /home/robert/Dev/vsgPhysX/include/vsgPhysX/Engine.h:8,
from /home/robert/Dev/vsgPhysX/src/vsgPhysX/Engine.cpp:1:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h: In member function ‘vsgPhysX::ref_ptr<T>& vsgPhysX::ref_ptr<T>::assignNoAcquireRef(R*)’:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h:169:20: error: ‘ptr’ was not declared in this scope; did you mean ‘_ptr’?
169 | _ptr = ptr;
| ^~~
| _ptr
In file included from /home/robert/Dev/vsgPhysX/src/vsgPhysX/Scene.cpp:1:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/Scene.h: In member function ‘bool vsgPhysX::Scene::addActor(vsgPhysX::unique_ptr<T>&, const physx::PxBVH*)’:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/Scene.h:29:38: warning: invalid use of incomplete type ‘class physx::PxScene’
29 | return implementation().addActor(*actor, bvh);
| ~~~~~~~~~~~~~~^~
/home/robert/Dev/vsgPhysX/include/vsgPhysX/Scene.h:13:11: note: forward declaration of ‘class physx::PxScene’
13 | class PxScene;
| ^~~~~~~
In file included from /home/robert/Dev/vsgPhysX/include/vsgPhysX/Engine.h:8,
from /home/robert/Dev/vsgPhysX/src/vsgPhysX/Scene.cpp:6:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h: In member function ‘vsgPhysX::ref_ptr<T>& vsgPhysX::ref_ptr<T>::assignNoAcquireRef(R*)’:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h:169:20: error: ‘ptr’ was not declared in this scope; did you mean ‘_ptr’?
169 | _ptr = ptr;
| ^~~
| _ptr
In file included from /home/robert/Dev/vsgPhysX/include/vsgPhysX/SimulateOperation.h:8,
from /home/robert/Dev/vsgPhysX/src/vsgPhysX/SimulateOperation.cpp:1:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/Scene.h: In member function ‘bool vsgPhysX::Scene::addActor(vsgPhysX::unique_ptr<T>&, const physx::PxBVH*)’:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/Scene.h:29:38: warning: invalid use of incomplete type ‘class physx::PxScene’
29 | return implementation().addActor(*actor, bvh);
| ~~~~~~~~~~~~~~^~
/home/robert/Dev/vsgPhysX/include/vsgPhysX/Scene.h:13:11: note: forward declaration of ‘class physx::PxScene’
13 | class PxScene;
| ^~~~~~~
make[2]: *** [CMakeFiles/vsgPhysX.dir/build.make:118: CMakeFiles/vsgPhysX.dir/src/vsgPhysX/PhysicsTransform.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/vsgPhysX.dir/build.make:132: CMakeFiles/vsgPhysX.dir/src/vsgPhysX/Scene.cpp.o] Error 1
make[2]: *** [CMakeFiles/vsgPhysX.dir/build.make:104: CMakeFiles/vsgPhysX.dir/src/vsgPhysX/Engine.cpp.o] Error 1
In file included from /home/robert/Dev/vsgPhysX/include/vsgPhysX/Engine.h:8,
from /home/robert/Dev/vsgPhysX/src/vsgPhysX/Actor.cpp:10:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h: In member function ‘vsgPhysX::ref_ptr<T>& vsgPhysX::ref_ptr<T>::assignNoAcquireRef(R*)’:
/home/robert/Dev/vsgPhysX/include/vsgPhysX/ref_ptr.h:169:20: error: ‘ptr’ was not declared in this scope; did you mean ‘_ptr’?
169 | _ptr = ptr;
| ^~~
| _ptr
make[2]: *** [CMakeFiles/vsgPhysX.dir/build.make:76: CMakeFiles/vsgPhysX.dir/src/vsgPhysX/Actor.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:136: CMakeFiles/vsgPhysX.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Missing include?
I have fixed the build errors & warnings:
$ git diff
diff --git a/include/vsgPhysX/Scene.h b/include/vsgPhysX/Scene.h
index 9691db7..7f25af0 100644
--- a/include/vsgPhysX/Scene.h
+++ b/include/vsgPhysX/Scene.h
@@ -1,6 +1,7 @@
#pragma once
#include <PxSceneDesc.h>
+#include <PxScene.h>
#include <vsg/core/Inherit.h>
diff --git a/include/vsgPhysX/ref_ptr.h b/include/vsgPhysX/ref_ptr.h
index 588ac62..264c0a0 100644
--- a/include/vsgPhysX/ref_ptr.h
+++ b/include/vsgPhysX/ref_ptr.h
@@ -166,7 +166,7 @@ namespace vsgPhysX
if (_ptr) _ptr.release();
- _ptr = ptr;
+ _ptr = rhs;
return *this;
}
The vsgPhysX library now builds and links, but the vsgPhysXHelloWorld example throws lots of link errors:
77%] Built target vsgPhysX
[ 88%] Linking CXX executable vsgPhysXHelloWorld
/bin/ld: /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a(NpPhysics.cpp.o): in function `physx::NpPhysics::NpPhysics(physx::PxTolerancesScale const&, physx::PxvOffsetTable const&, bool, physx::pvdsdk::PsPvd*, physx::PxFoundation&, physx::PxOmniPvd*)':
NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x41): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x98): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0xe1): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x12e): undefined reference to `physx::PxMutexImpl::getSize()'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x13b): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x180): undefined reference to `physx::PxMutexImpl::PxMutexImpl()'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x1e7): undefined reference to `physx::PxMutexImpl::getSize()'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x1f4): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x224): undefined reference to `physx::PxMutexImpl::PxMutexImpl()'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x24d): undefined reference to `physx::PxMutexImpl::getSize()'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x25a): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x291): undefined reference to `physx::PxMutexImpl::PxMutexImpl()'
/bin/ld: /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a(NpPhysics.cpp.o): in function `physx::NpPhysics::~NpPhysics()':
NpPhysics.cpp:(.text._ZN5physx9NpPhysicsD2Ev+0xa3): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsD2Ev+0xd1): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsD2Ev+0x205): undefined reference to `physx::PxMutexImpl::~PxMutexImpl()'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsD2Ev+0x218): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsD2Ev+0x23c): undefined reference to `physx::PxMutexImpl::~PxMutexImpl()'
There are lots more besides these.
Build results with VERBOSE=1 to show the linked libs, curiously libPhysX_static_64.a is listed 4 times in the link line...
make VERBOSE=1
...
[100%] Linking CXX executable vsgPhysXHelloWorld
cd /home/robert/Dev/vsgPhysX/examples && /usr/bin/cmake -E cmake_link_script CMakeFiles/vsgPhysXHelloWorld.dir/link.txt --verbose=1
/bin/c++ -O3 -DNDEBUG CMakeFiles/vsgPhysXHelloWorld.dir/helloworld.cpp.o -o vsgPhysXHelloWorld -Wl,-rpath,/home/robert/3rdParty/VulkanSDK/1.3.268.0/x86_64/lib:/home/robert/Install/bin/linux.clang/release: ../libvsgPhysX.a /home/robert/Install/lib/libvsg.a /home/robert/3rdParty/VulkanSDK/1.3.268.0/x86_64/lib/libvulkan.so /usr/lib/x86_64-linux-gnu/libxcb.so /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a
/bin/ld: CMakeFiles/vsgPhysXHelloWorld.dir/helloworld.cpp.o: in function `main':
helloworld.cpp:(.text.startup+0x21f8): undefined reference to `physx::PxDefaultSimulationFilterShader(unsigned int, physx::PxFilterData, unsigned int, physx::PxFilterData, physx::PxFlags<physx::PxPairFlag::Enum, unsigned short>&, void const*, unsigned int)'
/bin/ld: helloworld.cpp:(.text.startup+0x2244): undefined reference to `physx::PxDefaultCpuDispatcherCreate(unsigned int, unsigned int*, physx::PxDefaultCpuDispatcherWaitForWorkMode::Enum, unsigned int)'
/bin/ld: ../libvsgPhysX.a(Actor.cpp.o): in function `vsgPhysX::createActor(physx::PxGeometry const&, float, physx::PxMaterial*)':
Actor.cpp:(.text+0xa3): undefined reference to `physx::PxCreateDynamic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, float, physx::PxTransformT<float> const&)'
/bin/ld: Actor.cpp:(.text+0xfd): undefined reference to `physx::PxCreateStatic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, physx::PxTransformT<float> const&)'
/bin/ld: ../libvsgPhysX.a(Actor.cpp.o): in function `vsgPhysX::createBoxActor(vsg::t_vec3<float> const&, float, physx::PxMaterial*)':
Actor.cpp:(.text+0x212): undefined reference to `physx::PxCreateDynamic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, float, physx::PxTransformT<float> const&)'
/bin/ld: Actor.cpp:(.text+0x26f): undefined reference to `physx::PxCreateStatic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, physx::PxTransformT<float> const&)'
/bin/ld: ../libvsgPhysX.a(Actor.cpp.o): in function `vsgPhysX::createCapsuleActor(float, float, float, physx::PxMaterial*)':
Actor.cpp:(.text+0x378): undefined reference to `physx::PxCreateDynamic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, float, physx::PxTransformT<float> const&)'
/bin/ld: Actor.cpp:(.text+0x3cf): undefined reference to `physx::PxCreateStatic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, physx::PxTransformT<float> const&)'
/bin/ld: ../libvsgPhysX.a(Actor.cpp.o): in function `vsgPhysX::createPlaneActor(vsg::t_vec4<float> const&, physx::PxMaterial*)':
Actor.cpp:(.text+0x633): undefined reference to `physx::PxCreateStatic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, physx::PxTransformT<float> const&)'
/bin/ld: ../libvsgPhysX.a(Actor.cpp.o): in function `vsgPhysX::createSphereActor(float, float, physx::PxMaterial*)':
Actor.cpp:(.text+0x7fe): undefined reference to `physx::PxCreateDynamic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, float, physx::PxTransformT<float> const&)'
/bin/ld: Actor.cpp:(.text+0x84f): undefined reference to `physx::PxCreateStatic(physx::PxPhysics&, physx::PxTransformT<float> const&, physx::PxGeometry const&, physx::PxMaterial&, physx::PxTransformT<float> const&)'
/bin/ld: ../libvsgPhysX.a(Engine.cpp.o): in function `vsgPhysX::Engine::Engine(physx::PxTolerancesScale const&)':
Engine.cpp:(.text+0x22f): undefined reference to `PxCreateFoundation'
/bin/ld: /home/robert/Install/bin/linux.clang/release/libPhysX_static_64.a(NpPhysics.cpp.o): in function `physx::NpPhysics::NpPhysics(physx::PxTolerancesScale const&, physx::PxvOffsetTable const&, bool, physx::pvdsdk::PsPvd*, physx::PxFoundation&, physx::PxOmniPvd*)':
NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x41): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0x98): undefined reference to `PxGetBroadcastAllocator'
/bin/ld: NpPhysics.cpp:(.text._ZN5physx9NpPhysicsC2ERKNS_17PxTolerancesScaleERKNS_14PxvOffsetTableEbPNS_6pvdsdk5PsPvdERNS_12PxFoundationEPNS_9PxOmniPvdE+0xe1): undefined reference to `PxGetBroadcastAllocator'
I have hacked the example CMakeLists.txt to link to several PhysX libraries to get things to link and now can run the example:
The changes I've made are:
$ git diff
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 7b38d6c..c559ee2 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,6 @@
add_executable(vsgPhysXHelloWorld helloworld.cpp)
target_link_libraries(vsgPhysXHelloWorld vsgPhysX)
+target_link_libraries(vsgPhysXHelloWorld vsg::vsg ${physx_namespace}::${physx_main_library} ${PhysX5_PhysXCommon_LIBRARY_RELEASE} ${PhysX5_PhysXFoundation_LIBRARY_RELEASE} ${PhysX5_PhysXExtensions_LIBRARY_RELEASE})
if (WIN32 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
add_custom_command(TARGET vsgPhysXHelloWorld POST_BUILD
diff --git a/include/vsgPhysX/Scene.h b/include/vsgPhysX/Scene.h
index 9691db7..7f25af0 100644
--- a/include/vsgPhysX/Scene.h
+++ b/include/vsgPhysX/Scene.h
@@ -1,6 +1,7 @@
#pragma once
#include <PxSceneDesc.h>
+#include <PxScene.h>
#include <vsg/core/Inherit.h>
diff --git a/include/vsgPhysX/ref_ptr.h b/include/vsgPhysX/ref_ptr.h
index 588ac62..264c0a0 100644
--- a/include/vsgPhysX/ref_ptr.h
+++ b/include/vsgPhysX/ref_ptr.h
@@ -166,7 +166,7 @@ namespace vsgPhysX
if (_ptr) _ptr.release();
- _ptr = ptr;
+ _ptr = rhs;
return *this;
}
The target_link_libraries is hardwired to the RELEASE variants provide by your cmake/FindPhysX5.cmake.
The compilation errors are in templated code that doesn't get instantiated with MSVC unless you actually call it. The ref_ptr
function isn't something that gets used yet, so I'd never noticed the typo. The Scene
method was designed so you'd need PxScene.h
in files that called it, but could get away with just a forward declaration in files that just used the other methods, but I forgot that not every compiler interprets that part of the standard the same way.
For the CMake problem, there's PhysX5::PhysXCommon
and equivalents for the other libs that I set up to use the correct library variant for the current build configuration, so that should solve the need to explicitly link with individual ones, but I've already set up PhysX5::PhysX
to transitively link with its dependencies, so there should be no need to do any of this explicitly in the first place. I've got a dentist's appointment now, but I'll look into why this isn't working later.
One compilation error was caught by MSVC when I told it to work in standards-compliant mode instead of backwards compatibility mode - I'd just forgotten that they'd not changed the default yet. The other wasn't, but I still managed to fix it while keeping compatibility with forward declarations.
I found a couple of bugs in the FindPhysX5.cmake
script, and have fixed them, so hopefully that'll make linking work out-of-the-box. I'm not entirely sure how anything managed to work without the bug fixes, unless one would sometimes counteract the other.
Thanks for the fixes. vsgPhysX now compiles cleanly for me if I do:
cmake . -DCMAKE_INSTALL_PREFIX=~/Install -DPHYSX_PLATFORM_DIRECTORY_NAME=linux.clang
However, I now get a seg fault when I run the vsgPhysXHelloWorld executable. I'll recompile with debug and get a stack trace.
I now see that vsgPhysX is leaving the build target as unset, rather than defaulting to Release like the various vsg-dev do, so the build of vsgPhysX may be unset by linking to old VSG debug libs that I haven't updated recently. I'm now rebuilding and will set the target explicitly.
A fresh Debug works fine, as does a fresh Release build so you can safely ignore my report of crash as it looks just down to old VSG project libs.
What is the recommended dependencies for vsgPhysX?
I have cloned the https://github.com/NVIDIA-Omniverse/PhysX and attempted to build it under Kubuntu 22.04 but it's complaining about clang and clang++ not being installed when I have then installed by they've been installed as clang-15 and clang++-15 which looks to be confusing PhysX's build. Setting the suggest env vars to the compiler hasn't worked so I'm a bit wary of just how easy this is expected to be. Should I just be pulling down binaries? Installing from repos?