xiangaodielian / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

LinearMath library fails to compile in VS 2005 #680

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open build\vs2005\0BulletSollution.sln in MS VS 2005 (SP1)
2. Switch to release
3. ProjectOnly/Build Only Linear Math. General "Build" yelds the same results 
whatsoever.

What is the expected output? What do you see instead?
Should compile, obviously.
Instead it generates the following:

1>..\..\src\LinearMath\btConvexHullComputer.cpp(2029) : error C2784: 'void 
btAlignedObjectArray<T>::quickSort(const L &)' : could not deduce template 
argument for 'overloaded function type' from 'overloaded function type'
1>        with
1>        [
1>            T=btConvexHullInternal::Point32
1>        ]
1>        
c:\ar\programming\libraries\bullet\bullet-2.81-rev2613\src\linearmath\btAlignedO
bjectArray.h(365) : see declaration of 'btAlignedObjectArray<T>::quickSort'
1>        with
1>        [
1>            T=btConvexHullInternal::Point32
1>        ]

What version of the product are you using? On what operating system?
Win XP SP3, Microsoft Visual Studio 2005 Professional with SP1 installed.

Please provide any additional information below.

Had to turn off #define BT_USE_SSE in btScalar.h by testing (_MSC_VER > 1400) 
and that fixed other issues. This one is beyond a quick fix for me. 

Please help!

Original issue reported on code.google.com by anwilew...@gmail.com on 6 Dec 2012 at 9:26

Attachments:

GoogleCodeExporter commented 9 years ago
I just recompiled latest trunk, without any modifications, using Visual Studio 
2005 SP1 and got no error.

Without reproduction it is hard to fix such error.

Are you sure this is an unmodified version of Bullet, using latest trunk?

Original comment by erwin.coumans on 7 Dec 2012 at 7:07

GoogleCodeExporter commented 9 years ago
Can you try if changing

btAlignedObjectArray<Point32> points;

to 

btAlignedObjectArray<btConvexHullInternal::Point32> points;

fixes your compile error?

Original comment by erwin.coumans on 7 Dec 2012 at 9:03

GoogleCodeExporter commented 9 years ago
I just downloaded the 2627 using svn checkout and the problem unfortunately 
persists. No modifications, just trying to compile (either debug or release - 
no matter). Also the change you suggested didn't help.

Please take a look at www.silden.eu/misc/bt.jpg

Now I understand it does compile for you, but since it doesn't for me I'd 
really appreciate help with this issue.

Original comment by anwilew...@gmail.com on 8 Dec 2012 at 7:25

GoogleCodeExporter commented 9 years ago
Or can someone just please e-mail me the compiled LinearMath.lib? VS 2005, 
release, please? The e-mail is andrzej@silden eu. Thank you!

Might help me quite a bit, and the other libs compile just fine.

Original comment by anwilew...@gmail.com on 10 Dec 2012 at 10:33

GoogleCodeExporter commented 9 years ago
It is best if you can help fixing the problem, by testing some modifications.

It is likely some compiler bug in Visual Studio 2005 we have to work around. 
2005 without SP1, 2008, 2010 and 2012, Xcode, gcc, llvm all work fine.

I'll try to make some workaround and get back to you.

Original comment by erwin.coumans on 14 Dec 2012 at 8:37

GoogleCodeExporter commented 9 years ago
All right, if you have any ideas just let me know - I'll be glad to test them 
out.

Original comment by anwilew...@gmail.com on 15 Dec 2012 at 5:30

GoogleCodeExporter commented 9 years ago
Can you try to move the Point32 into global namespace?

Original comment by erwin.coumans on 15 Dec 2012 at 5:57

GoogleCodeExporter commented 9 years ago
Yeah, I moved Point64 and Point32 into the global namespace and 
btConvexHullComputer.cpp compiles with exactly the same effect.

I had to change pointCmp declaration to
static bool pointCmp(const Point32& p, const Point32& q)
- obviously, but the template argument still cannot be deduced.

Original comment by anwilew...@gmail.com on 15 Dec 2012 at 6:14

GoogleCodeExporter commented 9 years ago
can you move the compare func inside a class? please checkout other places that 
use quickSort in the Bullet source code.
(while keeping Point32 in global namespace)

thanks for helping

Original comment by erwin.coumans on 15 Dec 2012 at 6:49

GoogleCodeExporter commented 9 years ago
Right. 

When I moved the compare func (I assume you meant the pointCmp) inside a class, 
the compiler started to treat it as an explicite function and demanded a 
pointer to it, operators... Or I misunderstood you about which function should 
be moved.

Still I checked other uses of quickSort in source code and all of them have a 
class with () operator defined as a compare function. Hence I replaced function 
pointCmp with 

class pointCmp
{
public:
  bool operator() ( const Point32& p, const Point32& q ) const
  {
    return (p.y < q.y) || ((p.y == q.y) && ((p.x < q.x) || ((p.x == q.x) && (p.z < q.z))));
  }
};

and changed the call to:
  points.quickSort(pointCmp());

This compiles cleanly, but I have no idea if it's ok from your point of view as 
it's more of a hack. In fact the whole LinearMath compiles cleanly now, with 
exception of only one warning:

1>btVector3.obj : warning LNK4221: no public symbols found; archive member will 
be inaccessible

I hope it helps, please let me know if it is an acceptable solution.

Original comment by anwilew...@gmail.com on 15 Dec 2012 at 7:10

GoogleCodeExporter commented 9 years ago
great, can you please share a working version of that file, or a patch?

does it still work if you move the Point32 class back in the original location,
and make your new compareClass compile again?

Original comment by erwin.coumans on 15 Dec 2012 at 1:23

GoogleCodeExporter commented 9 years ago
It does, as long as I change the compare class to:

class pointCmp
{
public:

  bool operator() ( const btConvexHullInternal::Point32& p, const btConvexHullInternal::Point32& q ) const
  {
    return (p.y < q.y) || ((p.y == q.y) && ((p.x < q.x) || ((p.x == q.x) && (p.z < q.z))));
  }
};

File attached.

Thanks for your help!

Original comment by anwilew...@gmail.com on 15 Dec 2012 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
There are a few other places using quickSort without a compareClass.

does the full Bullet sdk compile, including the default demos?

did you try premake generated visual studio projects
(Bullet/build/vs2005.bat) and cmake version?

Thanks,
Erwin

Original comment by erwin.coumans on 15 Dec 2012 at 1:46

GoogleCodeExporter commented 9 years ago
App_VoronoiFractureDemo doesn't compile for exactly the some reasons the 
LinearMath didn't. Everything else compiles just fine, except for a few 
warnings here and there.

I used premake generated projects, I don't use cmake.

I have attached full rebuild output log and that Voronoi BuildLog.html, hope 
this helps.

Original comment by anwilew...@gmail.com on 15 Dec 2012 at 2:09

Attachments:

GoogleCodeExporter commented 9 years ago
The App_VoronoiFractureDemo uses a struct, not a global compare function.

Can you send a fixed version for the App_VoronoiFractureDemo?

Thanks a lot,
Erwin

Original comment by erwin.coumans on 17 Dec 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Unfortunately I don't have it - I didn't debug nor fix the Voronoi Demo. I just 
recompiled everything to check things out and Voronoi is the only thing that 
doesn't compile, but I didn't look into it in details. I noticed it gives the 
same error output, but that's it so far.

Since the libraries compiled I have other issues (outside bullet) to address, 
but if you want me to test something specific, just let me know - I'll be glad 
to help.

Original comment by anwilew...@gmail.com on 18 Dec 2012 at 7:54

GoogleCodeExporter commented 9 years ago
thanks a lot for the report and help,

both issues are fixed now:
https://code.google.com/p/bullet/source/detail?r=2635
https://code.google.com/p/bullet/source/detail?r=2632

Original comment by erwin.coumans on 20 Dec 2012 at 10:48