r615 has many erors in dgCollisionConvex.cpp

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

r615 has many erors in dgCollisionConvex.cpp

Postby drawtree » Sat May 07, 2011 2:49 am

r615 has many errors in coreLibrary_200/source/physics/dgCollisionConvex.cpp

This happens in non-SIMD compilation path. The method SupportVertexSimd() <around line 928> is not escaped in the non-SIMD path. I resolved this by wrapping it with preprocessor macros like this.


Code: Select all
dgVector dgCollisionConvex::SupportVertexSimd (const dgVector& direction) const
{
#ifdef DG_BUILD_SIMD_CODE

...

#else
   return   dgVector();
#endif
}


I suggested patch: http://code.google.com/p/newton-dynamic ... etail?id=8
Please reflect this to source.
Last edited by drawtree on Sat May 07, 2011 5:05 am, edited 3 times in total.
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: r615 has many erors in dgCollisionConvex.cpp

Postby drawtree » Sat May 07, 2011 2:51 am

And addition, I have another problem.

/Users/eonil/Work/Library/Newton Game Dynamics/r615/coreLibrary_200/projets/mac/OS10_xcode3.2.5/../../../source/core/dgMemory.cpp:54: warning: deleting 'void*' is undefined

file://localhost/Users/eonil/Work/Libra ... Memory.cpp: warning: Semantic Issue: Cannot delete expression with pointer-to-'void' type 'void *'


The code at the position is

Code: Select all
void operator delete (void *ptr)
   {
      _ASSERTE (0);
      ::delete (ptr);    // warning here.
   }


I don't know why this happen. Is this warning designed or unexpected?
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: r615 has many erors in dgCollisionConvex.cpp

Postby drawtree » Sat May 07, 2011 2:52 am

And should I use coreLibrary_200 or coreLibrary_300?
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: r615 has many erors in dgCollisionConvex.cpp

Postby drawtree » Sat May 07, 2011 7:17 am

When compiling with _MAC_IPHONE flag, pthread_create symbol missing error occurs. This caused by missing inclusion of <pthread.h> in /trunk/packages/dContainers/dThread.cpp. Adding these lines:

Code: Select all
#ifdef _MAC_VER
  #include <pthread.h>
  #include <semaphore.h>
  #include <unistd.h>
#endif


will fix this problem.

I posted a patch: http://code.google.com/p/newton-dynamic ... etail?id=9
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: r615 has many erors in dgCollisionConvex.cpp

Postby Julio Jerez » Sat May 07, 2011 8:20 am

I am confused, some people said that in the latest Iphone SDK Pthread is not supported, so it is #ifdef out

those pythread files are included in file dgTypes.h,

can you verify that it compile with the latest IPhone SDK, by uncommenting the #ifdef in the dgTypes Files,
including it twice will not make it better.

you should use 2.00 until 3.00 become official.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: r615 has many erors in dgCollisionConvex.cpp

Postby drawtree » Sat May 07, 2011 9:20 am

Thank you for guidance!

I verified pthread_create, pthread_join, pthread_exit are working both of Simulator and Device in iOS SDK 4.3 (latest) Maybe you're talking about this thread: viewtopic.php?f=12&t=6327&start=30

I'm feeling strange too, but guessing with the function name in the error message, it maybe a different version of pthread linked to old version of iOS SDK. If your binary was built with old version of SDK, it can be resolved by just recompiling.

As I remember, there was big changes between iOS 2.x > iOS 3 which breaking backward compatibility. This maybe one of them. At the time, many apps broken and Apple requested developers to patch their apps.

And with my knowledge, pthread is recommended and core threading facility. There is no reason to be blocked.

I don't know about semaphores. I don't know how to use it.




I attach part of my test program.
Code: Select all
#import "pthread_testAppDelegate.h"

#import <pthread.h>

@implementation pthread_testAppDelegate


@synthesize window=_window;


void T(void* thid)
{
   printf("%s", (char*)thid);
   
   sleep(4);
   
   pthread_exit(NULL);
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   pthread_t th;
   pthread_create(&th, NULL, T, "DDD");
   
   void* status;
   pthread_join(th, &status);
   printf("XX");
   
   // Override point for customization after application launch.
   [self.window makeKeyAndVisible];
    return YES;
}


XX printed after 4 seconds from DDD. Both of Simulator and Device.




I found <pthread.h> block on both of dgTypes.h and dContainersStdAfx.h. Former one looks can't affect classes in dContainers. I modified both of them like this.

Code: Select all
#ifdef _MAC_VER
   #include <pthread.h>
   #include <semaphore.h>
//   #ifndef _MAC_IPHONE
//      #include <pthread.h>
//      #include <semaphore.h>
//   #endif   

   #include <unistd.h>
   #include <libkern/OSAtomic.h>
   #include <sys/sysctl.h>
#endif


In my opinion, the blocks in both files are duplicated and should be unified.
Library built well with this modification, but I didn't tested yet within actual application. How can I test thread-related code is working well?
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: r615 has many erors in dgCollisionConvex.cpp

Postby Julio Jerez » Sat May 07, 2011 10:04 am

Ok, so you verified that the newer Mac SK do work with Pthread.
I too think you are correct, It may be that the error was when newton was not open source, but now I think that we can include it in fiel dgTypes withoput problems.

I just did that and check in into SVN.

as for the secund inclusion of PThread, those are two seperate libraries,
anyone can use the dContainer and the Dmath libraries without Newton Core, that is why they add the included
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: r615 has many erors in dgCollisionConvex.cpp

Postby drawtree » Sat May 07, 2011 12:21 pm

OK. Thanks.

I'll keep posting when I found anything :)
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 6 guests