strongn
Posts: 2
Joined: Sun Aug 12, 2018 4:13 pm

PTHREADS libarary on Pi 3 MOdel B+

Sun Aug 12, 2018 4:24 pm

Hi

I've recently acquired P3B+ and migrating existing code onto that platform and I'm encountering a pile of problems recompiling. I'm not sure if it's the toolchain, the compiler or the linux environment that is causing the issue.

I've installed libpthread-stubs0-dev on the pi.

I've using VIsual Studio to cross-compile with VisualGDB / Cygwin / arm-linux-gnueabihf toolchain and this code has worked for years on older PIs.

The new one however, doesn't seem to like PTHREADS and is failing to compile with a
__PTHREAD_SPINS was not declared in this scope
error

I've tried every compile switch I can think of, but getting the same error. Not many references to this error on google, so hoping someone can tell me if it's something to do with the processor architecture?

Very simple to reproduce : this won't compile

Code: Select all

#include <iostream>
#include <pthread.h>

using namespace std;

int main(int argc, char *argv[])
{
	pthread_mutex_t mp = PTHREAD_MUTEX_INITIALIZER;
	
	return 0;
}
Many thanks in advance

User avatar
Paeryn
Posts: 2054
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: PTHREADS libarary on Pi 3 MOdel B+

Sun Aug 12, 2018 5:21 pm

__PTHREAD_SPINS is defined in bits/pthreadtypes.h which pthread.h should be including. That file is provided by the package libc6-dev
She who travels light — forgot something.

strongn
Posts: 2
Joined: Sun Aug 12, 2018 4:13 pm

Re: PTHREADS libarary on Pi 3 MOdel B+

Sun Aug 12, 2018 6:51 pm

Spot on Paeryn! I could see the include file bits/pthreadtypes.h on the Pi but it wasn't in the Toolchain. I deleted the old toolchain folder and re-installed and all is good now! :D

Many thanks!

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 7 guests