[Bf-committers] MinGW Build Questions

Antony Riakiotakis kalast at gmail.com
Sat Nov 24 20:14:20 CET 2012


Hi, Openmp is a MinGW64 problem, mixing pthreads with openmp is buggy.

Currently I am trying to debug this in their winpthread implementation
but I am no thread expert. Not by far. Any help is welcome.
I have downloaded their svn repository and winpthread is in
experimental/winpthread folder. Standard configure/make with CFLAGS=-g
is enough to get a debug build. Also MSYS is required.

Warning! Uncommented and unindented code in there, prepare for eyesores :p

A minimum test case to reproduce the hang is (compile with -fopenmp)

#include <cstdio>
#include <omp.h>
#include <pthread.h>

void *do_thread(void *) {	
	int niterations = 200;
	int i;

	#pragma omp parallel for
	for (i = 0; i < niterations; i++)
	{
		printf ("ducks\n");
	}

	return NULL;
}

int main() {
	pthread_t id;
	
	pthread_create(&id, NULL, do_thread, NULL);
	pthread_join (id, NULL);
}


More information about the Bf-committers mailing list