Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1819270
Summary: | Unresolved symbol on static template called from static class method | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Paulo Andrade <paulo.cesar.pereira.de.andrade> |
Component: | 0ad | Assignee: | Paulo Andrade <paulo.cesar.pereira.de.andrade> |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 32 | CC: | aoliva, bioinfornatics, cheese, dmalcolm, fweimer, igor.raits, jakub, jwakely, law, mpolacek, msebor, nickc, paulo.cesar.pereira.de.andrade, walter.pete |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-04-02 12:49:47 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Paulo Andrade
2020-03-31 15:20:24 UTC
(In reply to Paulo Andrade from comment #0) > Patch to FAXInstanceExport.cpp was added due to error when calling > the static template from a static method, without an object instance. That makes no sense. > The workaround was to define the template in the header file, > declaring the class. I don't think it's a workaround, I think it's fixing invalid code. I don't see a GCC bug here. (In reply to Jonathan Wakely from comment #1) > (In reply to Paulo Andrade from comment #0) > > Patch to FAXInstanceExport.cpp was added due to error when calling > > the static template from a static method, without an object instance. > > That makes no sense. I also think so. Maybe I did not explain it correctly. > > The workaround was to define the template in the header file, > > declaring the class. > > I don't think it's a workaround, I think it's fixing invalid code. > > I don't see a GCC bug here. You might take a quick look on the source code here https://github.com/0ad/0ad/tree/master/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML to have an idea of the source code. Or latest (and very short lived) build logs after the patch at https://koji.fedoraproject.org/koji/taskinfo?taskID=42916164 the failing build logs attached to https://bugzilla.redhat.com/show_bug.cgi?id=1799112 do not show all errors (it only shows the last 32Kb), but without the patch, I see: FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp: In static member function 'st atic xmlNode* FArchiveXML::WritePhysicsRigidBodyInstance(FCDObject*, xmlNode*)': FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:258:126: error: cannot call member function 'xmlNode* FArchiveXML::AddPhysicsParameter(xmlNode*, const char*, FCDParameterAnimatableT<TYPE, QUALIFIERS>&) [with TYPE = FMVector3; int QUAL = 0; xmlNode = _xmlNode]' without object 258 | FArchiveXML::AddPhysicsParameter(techniqueNode, DAE_ANGULAR_VELOCITY_ELEMENT, physicsRigidBodyInstance->GetAngularVelocity()); | ^ FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:259:111: error: cannot call member function 'xmlNode* FArchiveXML::AddPhysicsParameter(xmlNode*, const char*, FCDParameterAnimatableT<TYPE, QUALIFIERS>&) [with TYPE = FMVector3; int QUAL = 0; xmlNode = _xmlNode]' without object 259 | FArchiveXML::AddPhysicsParameter(techniqueNode, DAE_VELOCITY_ELEMENT, physicsRigidBodyInstance->GetVelocity()); | ^ the above is the reason of the patch to FAXInstanceExport.cpp and the ending errors: g++ -o "../../../binaries/system/libCollada.so" obj/Collada_Release/CommonConvert.o obj/Collada_Release/DLL.o obj/Collada_Release/Decompose.o obj/Collada_Release/GeomReindex.o obj/Collada_Release/Maths.o obj/Collada_Release/PMDConvert.o obj/Collada_Release/PSAConvert.o obj/Collada_Release/StdSkeletons.o obj/Collada _Release/XMLFix.o obj/Collada_Release/precompiled.o -L../../../binaries/system -L../../../libraries/source/fcollada/lib -L/usr/X11R6/lib -shared -Wl,-soname=libCollada.so -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-rpath,/usr/lib64/0ad -rdynamic -lFColladaSR -lxml2 -ldl /usr/bin/ld: ../../../libraries/source/fcollada/lib/libFColladaSR.a(FAXInstanceExport.o): in function `FArchiveXML::WritePhysicsRigidBodyInstance(FCDObject*, _xmlNode*)': /builddir/build/BUILD/0ad-0.0.23b-alpha/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:258: undefined reference to `_xmlNode* FArchiveXML::AddPhysicsParameter<FMVector3, 0>(_xmlNode*, char const*, FCDParameterAnimatableT<FMVector3, 0>&)' /usr/bin/ld: /builddir/build/BUILD/0ad-0.0.23b-alpha/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:259: undefined reference to `_xmlNode* FArchiveXML::AddPhysicsParameter<FMVector3, 0>(_xmlNode*, char const*, FCDParameterAnimatableT<FMVector3, 0>&)' collect2: error: ld returned 1 exit status This bug report is just to work as a possible heads up on a possible issue, as this code used to compile and build since f16, when the 0ad package was added to Fedora. (In reply to Paulo Andrade from comment #2) > Or latest (and very short lived) build logs after the patch at > https://koji.fedoraproject.org/koji/taskinfo?taskID=42916164 > > the failing build logs attached to > https://bugzilla.redhat.com/show_bug.cgi?id=1799112 > do not show all errors (it only shows the last 32Kb), but without the patch, > I see: > > FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp: In static member function > 'st > atic xmlNode* FArchiveXML::WritePhysicsRigidBodyInstance(FCDObject*, > xmlNode*)': > FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:258:126: error: cannot > call member function 'xmlNode* FArchiveXML::AddPhysicsParameter(xmlNode*, > const char*, FCDParameterAnimatableT<TYPE, QUALIFIERS>&) [with TYPE = > FMVector3; int QUAL = 0; xmlNode = _xmlNode]' without object > 258 | FArchiveXML::AddPhysicsParameter(techniqueNode, > DAE_ANGULAR_VELOCITY_ELEMENT, > physicsRigidBodyInstance->GetAngularVelocity()); > | > ^ > FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:259:111: error: cannot > call member function 'xmlNode* FArchiveXML::AddPhysicsParameter(xmlNode*, > const char*, FCDParameterAnimatableT<TYPE, QUALIFIERS>&) [with TYPE = > FMVector3; int QUAL = 0; xmlNode = _xmlNode]' without object > 259 | FArchiveXML::AddPhysicsParameter(techniqueNode, > DAE_VELOCITY_ELEMENT, physicsRigidBodyInstance->GetVelocity()); > | > ^ > > the above is the reason of the patch to FAXInstanceE This should not be possible. Are you sure you didn't incorrectly apply the changes to FArchiveXML.h and accidentally remove the 'static', which would cause the error above? > This bug report is just to work as a possible heads up on a possible issue, > as this code used to compile and build since f16, when the 0ad package > was added to Fedora. That doesn't mean the code was correct. I think this is the same issue as Bug 1794127, the code is not correct unless the function template is defined in the header, or there is an explicit instantiation declaration. In particular, see Bug 1794127 comment 7. (In reply to Jonathan Wakely from comment #3) > (In reply to Paulo Andrade from comment #2) > > Or latest (and very short lived) build logs after the patch at > > https://koji.fedoraproject.org/koji/taskinfo?taskID=42916164 > > > > the failing build logs attached to > > https://bugzilla.redhat.com/show_bug.cgi?id=1799112 > > do not show all errors (it only shows the last 32Kb), but without the patch, > > I see: > > > > FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp: In static member function > > 'st > > atic xmlNode* FArchiveXML::WritePhysicsRigidBodyInstance(FCDObject*, > > xmlNode*)': > > FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:258:126: error: cannot > > call member function 'xmlNode* FArchiveXML::AddPhysicsParameter(xmlNode*, > > const char*, FCDParameterAnimatableT<TYPE, QUALIFIERS>&) [with TYPE = > > FMVector3; int QUAL = 0; xmlNode = _xmlNode]' without object > > 258 | FArchiveXML::AddPhysicsParameter(techniqueNode, > > DAE_ANGULAR_VELOCITY_ELEMENT, > > physicsRigidBodyInstance->GetAngularVelocity()); > > | > > ^ > > FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp:259:111: error: cannot > > call member function 'xmlNode* FArchiveXML::AddPhysicsParameter(xmlNode*, > > const char*, FCDParameterAnimatableT<TYPE, QUALIFIERS>&) [with TYPE = > > FMVector3; int QUAL = 0; xmlNode = _xmlNode]' without object > > 259 | FArchiveXML::AddPhysicsParameter(techniqueNode, > > DAE_VELOCITY_ELEMENT, physicsRigidBodyInstance->GetVelocity()); > > | > > ^ > > > > the above is the reason of the patch to FAXInstanceE > > This should not be possible. Are you sure you didn't incorrectly apply the > changes to FArchiveXML.h and accidentally remove the 'static', which would > cause the error above? I've just removed that part of the patch and it still builds fine, as expected. Scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=42929681 I agree that part should no longer be required, after fully declaring the template in the header file. But before that, it was required to avoid the compile time error. But would still fail to link. Will update the package to remove that part for next builds. Otherwise, with that chunk it should just work, so, no need for a new f32 update. It should be enough to move the static template definition from FAXPhysicsExport.cpp to FArchiveXML.h https://src.fedoraproject.org/rpms/0ad/blob/a544c594cbf6dea76160dd338e75166390b6de2d/f/0ad-fcollada.patch Maybe it should be moved to some other .cpp file, or declared in every .cpp file that uses it? If that is the case, the proper place would be in the header file. (In reply to Paulo Andrade from comment #5) > But before that, it was required to avoid the compile time error. I still don't believe it. Anyway, reassigning to the right component, as this isn't a GCC bug. (In reply to Jonathan Wakely from comment #6) > (In reply to Paulo Andrade from comment #5) > > But before that, it was required to avoid the compile time error. > > I still don't believe it. > > Anyway, reassigning to the right component, as this isn't a GCC bug. I will double check it. Agree it might have been my fault, as mock build.log is not truncated, and in one of my test builds I might have changed that, and looked in the wrong portion. In a few minutes should be 100% sure. You are right. I made several experiments in test builds, and should have removed the static keyword in one of them. Issue will be reported to fcollada interested parties. |