OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
pthread error

 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> First time - readme
View previous topic :: View next topic  
Author Message
MokhtarBouain



Joined: 31 Jan 2012
Posts: 87

PostPosted: Mon May 07, 2012 2:24 am    Post subject: pthread error Reply with quote

Hi all,

I installed the both platforms (ARMIntegratorCP & ArmVersatileExpress), and I ran the benchmarks.
After that I want to run the pthread library, so I tested the follwing example:
#include <pthread>
#include <stdio>
#define NUM_THREADS 5

void *PrintHello(void *threadid)
{
long tid;
tid = (long)threadid;
printf("Hello World! It's me, thread #%ld!\n", tid);
pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
pthread_t threads[NUM_THREADS];
int rc;
long t;
for(t=0; t<NUM_THREADS; t++){
printf("In main: creating thread %ld\n", t);
rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
}

/* Last thing that main() should do */
pthread_exit(NULL);
}

I compiled the helloworld example with the follwing option:
-pthread -Llibpthread.so.0
But for both platforms, when I run the ./hellowrold.exe in the ARMIntegratorCP & ArmVersatileExpress an error appear to me:
For ARMIntegratorCP : ./helloworld.exe: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
For ArmVersatileExpress : ./helloworld.exe:no version information available (required by helloworld.exe ) Segmentation fault
I did some research on google but I have not found a solution.
Any help please?
Moktar.
Back to top
View user's profile Send private message
LeeMoore
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 633

PostPosted: Tue May 08, 2012 1:12 am    Post subject: Reply with quote

Hi

The problem here is that the shared libraries do not exist on the disk image.

there are 2 possible solutions

1. install the required shared libraries on the disk image - libpthread.so.0

2. alternately, statically link your program '-pthread -static'
I dont think the flag -Llibpthread.so.0 is required, -L is used for a library search path, and this is not what you have provided

Thx
Lee
Back to top
View user's profile Send private message
MokhtarBouain



Joined: 31 Jan 2012
Posts: 87

PostPosted: Fri May 25, 2012 1:13 pm    Post subject: Reply with quote

Hi Lee,
Thank you, it works.

Moktar.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> First time - readme All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2022 Imperas Software