godot: Build errors with Bullet physics engine Static Library - Unresolved external symbol
Windows 64bit - Godot version: 3.0 alpha
I’ve implemented Bullet physics engine, but now that I’ve registered the BulletPhysicsServer class using the register_Bullet_types class:
void register_Bullet_types() {
ClassDB::register_class<BulletPhysicsServer>();
}
I get a building error, that is caused (I think) to the bad configuration of SCsub file. The error is: error LNK2019: unresolved external symbol when I build the code
.
The file system structure is that:
godot
├── modules
│ └── Bullet
│ └── SCsub
│ └── some_file.h
│ └── some_file.cpp
└── thirdparty
└── Bullet
├── include
│ └── ALL_HEADERS.h
└── Win64
└── lib
└── ALL_LIBRARIES.lib
The SCsub file is that:
#!/usr/bin/env python
Import('env')
thirdparty_dir = "#thirdparty/Bullet/"
thirdparty_lib = thirdparty_dir + "Win64/lib/"
env_Bullet = env.Clone()
thirdparty_sources = [
"Bullet2FileLoader",
"Bullet3Collision",
"Bullet3Common",
"Bullet3Dynamics",
"Bullet3Geometry",
"Bullet3OpenCL_clew",
"BulletCollision",
"BulletDynamics",
"BulletInverseDynamics",
"BulletSoftBody",
"LinearMath"
]
thirdparty_sources = [thirdparty_lib + file + ".lib" for file in thirdparty_sources]
env_Bullet.StaticLibrary(target = 'Bullet', source = thirdparty_sources )
env_Bullet.Append(CPPPATH=[thirdparty_dir + "/include/"])
env_Bullet.add_source_files(env.modules_sources, "*.cpp")
Here there is the Building error:
[...]
modules.windows.tools.64.lib(GodotCollisionDispatcher.windows.tools.64.obj) : error LNK2001: unresolved external symbol "public: virtual class btCollisionAlgorithm * __cdecl btCollisionDispatcher::findAlgorithm(struct btCollisionObjectWrapper const *,struct btCollisionObjectWrapper const *,class btPersistentManifold *,enum ebtDispatcherQueryType)" (?findAlgorithm@btCollisionDispatcher@@UEAAPEAVbtCollisionAlgorithm@@PEBUbtCollisionObjectWrapper@@0PEAVbtPersistentManifold@@W4ebtDispatcherQueryType@@@Z)
modules.windows.tools.64.lib(GodotCollisionDispatcher.windows.tools.64.obj) : error LNK2019: unresolved external symbol "public: virtual bool __cdecl btCollisionDispatcher::needsCollision(class btCollisionObject const *,class btCollisionObject const *)" (?needsCollision@btCollisionDispatcher@@UEAA_NPEBVbtCollisionObject@@0@Z) referenced in function "public: virtual bool __cdecl GodotCollisionDispatcher::needsCollision(class btCollisionObject const *,class btCollisionObject const *)" (?needsCollision@GodotCollisionDispatcher@@UEAA_NPEBVbtCollisionObject@@0@Z)
modules.windows.tools.64.lib(GodotCollisionDispatcher.windows.tools.64.obj) : error LNK2019: unresolved external symbol "public: virtual bool __cdecl btCollisionDispatcher::needsResponse(class btCollisionObject const *,class btCollisionObject const *)" (?needsResponse@btCollisionDispatcher@@UEAA_NPEBVbtCollisionObject@@0@Z) referenced in function "public: virtual bool __cdecl GodotCollisionDispatcher::needsResponse(class btCollisionObject const *,class btCollisionObject const *)" (?needsResponse@GodotCollisionDispatcher@@UEAA_NPEBVbtCollisionObject@@0@Z)
modules.windows.tools.64.lib(GodotCollisionDispatcher.windows.tools.64.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl btCollisionDispatcher::dispatchAllCollisionPairs(class btOverlappingPairCache *,struct btDispatcherInfo const &,class btDispatcher *)" (?dispatchAllCollisionPairs@btCollisionDispatcher@@UEAAXPEAVbtOverlappingPairCache@@AEBUbtDispatcherInfo@@PEAVbtDispatcher@@@Z)
modules.windows.tools.64.lib(GodotCollisionDispatcher.windows.tools.64.obj) : error LNK2001: unresolved external symbol "public: virtual void * __cdecl btCollisionDispatcher::allocateCollisionAlgorithm(int)" (?allocateCollisionAlgorithm@btCollisionDispatcher@@UEAAPEAXH@Z)
modules.windows.tools.64.lib(GodotCollisionDispatcher.windows.tools.64.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl btCollisionDispatcher::freeCollisionAlgorithm(void *)" (?freeCollisionAlgorithm@btCollisionDispatcher@@UEAAXPEAX@Z)
bin\godot.windows.tools.64.exe : fatal error LNK1120: 70 unresolved externals
scons: *** [bin\godot.windows.tools.64.exe] Error 1120
scons: building terminated because of errors.
00:18:33: The process "C:\Python27\scons.bat" exited with code 2.
Error while building/deploying project godot (kit: Desktop)
The kit Desktop has configuration issues which might be the root cause for this problem.
When executing step "Custom Process Step"
00:18:33: Elapsed time: 00:37.
So what is the right way of include a static Library using scons in order to avoid error LNK2019: unresolved external symbol this error?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (21 by maintainers)
@vnen Why do you think Godot physics is better than Bullet physics?
Try to create a chain like this: PinJoint <-- rigid body–> hinge joint then <-- anothe rigid body WITH CAMERA This is the result: https://youtu.be/JxfW2gmANZE
Then you talk about the compatibility of bullet with godot, what you said was the first thing I thought when I started to create the “wrapper”. But (thanks to god 😄) as I went deeper more I realized that the Godot physics was inspired by Bullet. In addition I can say that the part of software that manage the constant collision detection is completelly copied from Bullet.
Check these file please: https://github.com/godotengine/godot/blob/master/servers/physics/body_sw.cpp#L60 https://github.com/godotengine/godot/blob/master/servers/physics/joints/cone_twist_joint_sw.cpp#L32 https://github.com/godotengine/godot/blob/master/servers/physics/joints/generic_6dof_joint_sw.cpp#L32 etc…
So Bullet can be replaced perfectly, and in addition it can stay together with the current physics engine, and both can be switched in the settings with out touching a line of code, since the Godot’s interface that implement physics is fantastic and allow that. I’ll demonstrate that.
I don’t know about the tests done about Godot physics but I can say that Bullet physics engine is not little and not tested.
What I want to say is that currently Godot is a very good idea (3D side), but is not ready to be competitive with UE4, Unity, CryEngine.
It lacks a lot of features, for example it hasn’t the soft body, cloth, the vehicle is not so robust, destructible mesh. These are all things that if Bullet is implemented the only thing to do is create the wrapper from Godot to Bullet. And this allow us to have more time to spent on other features like improve networking, create a good particle system, create the World editor (that simply doen’t exist), improve the editor that in this state is very difficult to use for a broad project, or improve even more the rendering. And other hundred things that I can list.
If we have to implement every part of the engine from the scratch even when is not needed, for a reason that I don’t understand, we can stay sure about that Godot remain always behind the other engines.
I want to improve godot because I like its concept, and I’m convinced about that this is the right thing to do to boost the engine development.
@AndreaCatania I guess it will be hard to convince devs to replace a big core component with a 3rd party one without a previous long, heated and boring discussion 😅
But if you can, keep it in a fork, it will help a lot to people who want to implement their own physics.
Also, try to get in touch with the GDNative devs, if this can be turned into a plugin will be amazing.