A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Slick » Thu Feb 18, 2016 10:09 am
I'm getting a crash on line 586:
- Code: Select all
void dgWorldDynamicUpdate::FindActiveJointAndBodies (dgIsland* const island)
{
dgWorld* const world = (dgWorld*) this;
dgBodyInfo* const bodyArrayPtr = (dgBodyInfo*) &world->m_bodiesMemory[0];
dgBodyInfo* const bodyArray = &bodyArrayPtr[island->m_bodyStart];
It looks like maybe there is a NULL body but I need to research more.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Slick » Thu Feb 18, 2016 11:29 am
As a follow up I removed the only body and got the same crash. This is using Android and for reference I did have it working before but updated to the github source. It could be possible it is something to do with me building the libraries but I used the same procedure as before.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Julio Jerez » Thu Feb 18, 2016 12:02 pm
I do not know, that crash has never happened before. Are you using the dNewton?
I fix the syntax error now please sync again.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Slick » Thu Feb 18, 2016 12:11 pm
Yes I am using dNewton.
I fixed the mWorld already in my source but will sync again.
Here is a screen cap that looks to me like the body is a null pointer.
Could I create a problem like this in creating the libraries?

-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Slick » Fri Jun 17, 2016 7:02 am
I'm still getting this crash. I've read the threads I can find on Android and can't seem to find more help. Are there certain defines that I might be missing to use on Android.
I'll try simplifying my code also.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Slick » Fri Jun 17, 2016 7:28 am
I just noticed when stepping through code that:
- Code: Select all
void dgWorldDynamicUpdate::FindActiveJointAndBodies (void* const context, void* const worldContext, dgInt32 threadID)
{
dgWorldDynamicUpdateSyncDescriptor* const descriptor = (dgWorldDynamicUpdateSyncDescriptor*) context;
dgWorld* const world = (dgWorld*) worldContext;
dgInt32 count = descriptor->m_islandCount;
dgIsland* const islands = &((dgIsland*)&world->m_islandMemory[0])[descriptor->m_firstIsland];
for (dgInt32 i = dgAtomicExchangeAndAdd(&descriptor->m_atomicCounter, 1); i < count; i = dgAtomicExchangeAndAdd(&descriptor->m_atomicCounter, 1)) {
dgIsland* const island = &islands[i];
world->FindActiveJointAndBodies (island);
in the above code when stepping i=-1599590304 it seems like it is not getting set to a reasonable value in the line:
- Code: Select all
for (dgInt32 i = dgAtomicExchangeAndAdd(&descriptor->m_atomicCounter, 1);
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Slick » Sat Jul 23, 2016 10:32 am
I'm still getting this crash. Could it be an incorrect define when building the libraries. I have it running in just one thread because I'm not sure if multiple threads are supported.
What else can I do to work out the cause?
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Slick » Mon Jul 25, 2016 7:35 am
Well I got it working. For anyone else and my future reference it appears to be related to putting the _POSIX_VER define in. I think you are supposed to but for me if I did I started getting errors like
- Code: Select all
S:\Newton\corelibrary_313\source\newton/emmintrin.h:28:2: error: #error "SSE2 instruction set not enabled"
#error "SSE2 instruction set not enabled"
and
- Code: Select all
28:2: error: #error mmintrin.h included without enabling WMMX/WMMX2 instructions (e.g. -march=iwmmxt or -march=iwmmxt2)
#error mmintrin.h included without enabling WMMX/WMMX2 instructions (e.g. -march=iwmmxt or -march=iwmmxt2)
So my solution which I'm sure is not the most elegant was not to use the _POSIX_VER define. I then moved dgAtomicExchangeAndAdd and dgInterlockedExchange in dgTypes.h outside of the define check.
I now have a small test with bouncing balls working.
If there is a more elegant solution I'd like to know.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Dave Gravel » Mon Jul 25, 2016 8:52 pm
I have already successfully get newton 3.13 working in the pass under my android samsung s4 10 po tablette.
At this time I have compiled newton with linux and linux android tools.
My application under android is create with visual express 2012 and vs-android tools + GLES2 and GLES3.
Now I have retry with visual express 2015, the vs-android tools is better implemented in this version.
I have successfully rebuild newton 3.14 under visual express 2015.
When I try to load newton from the lib .so I get a crash.
In the pass with the compiled lib .so under linux it working good for me.
I can load the static lib .a and create the newton world and it seen to work good.
I need to make more test, because all my old visual 2012 android projects don't compile under 2015..
I don't know what is the problem for this... but I working on a little quick application test to see if the lib working good for the physics simulation.
I can let's you know soon how it going.
-

Dave Gravel
-
- Posts: 801
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Slick » Tue Jul 26, 2016 8:52 am
I am using static libraries .a. My problem was mainly related to using or in my case deciding not to use _POSIX_VER.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Julio Jerez » Tue Jul 26, 2016 2:14 pm
I am glad you found a solution, but if you do not use POSIT_VER and it is a unit like system,
how does is resolve call to OS functions like atomic and threads.
are you using the pthread code in newton or the system threads that is part of unit systems.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Dave Gravel » Tue Jul 26, 2016 10:58 pm
Last edited by
Dave Gravel on Wed Jul 27, 2016 2:45 pm, edited 3 times in total.
-

Dave Gravel
-
- Posts: 801
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Slick » Wed Jul 27, 2016 6:06 am
Julio Jerez wrote:I am glad you found a solution, but if you do not use POSIT_VER and it is a unit like system,
how does is resolve call to OS functions like atomic and threads.
are you using the pthread code in newton or the system threads that is part of unit systems.
I had to add two functions outside of the defines braces in dgTypes.h they are dgAtomicExchangeAndAdd and also dgInterlockedExchange.
All I can say is that my method is working but not elegant. I have only tried using one thread so far. I don't yet know if more than 1 thread works.
I am not using pThreads. I don't think they are supported on Android but not sure.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Dave Gravel » Wed Jul 27, 2016 6:34 am
The multithreads seen to work normally for me.
In my demo I set it to two and when I get the thread count in runtime I get two.
Normally if it don't work it just return 1, If i'm not wrong.
I have test higher value like 8 and more like 24.
The maximum is 16 with 24 it return 16.
I can't say for sure if it work for real or not, I can try to find a tool to check the running threads in my tablet.
My tablet model have 4 cores.
-

Dave Gravel
-
- Posts: 801
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 3 guests