Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you compile static pthread-win32 lib for x64?

It looks like some work has been done to make pthread-win32 work with x64, but there are no build instructions. I have tried simly building with the Visual Studio x64 Cross Tools Command Prompt, but when I try to link to the lib from an x64 application, it can't see any of the function exports. It seems like it is still compiling the lib as x86 or something.

I've even tried adding /MACHINE to the makefile in the appropriate places, but it doesn't help. Has anyone gotten this to work?

like image 204
kgriffs Avatar asked Oct 01 '08 19:10

kgriffs


1 Answers

For me, I just use a 64-bit windows compiler (mingw-w64 cross compiler in this particular case) then make (with2.9.1) like:

$ make clean GC-static 

Then how I install it for use (some of this may not be needed, of course),

cp libpthreadGC2.a $mingw_w64_x86_64_prefix/lib/libpthread.a
cp pthread.h sched.h semaphore.h $mingw_w64_x86_64_prefix/include

then to use it, you have to define this (example ffmpeg configure line to use it):

--extra-cflags=-DPTW32_STATIC_LIB 

Anyhow that's one way.

Another way is to do the same then modify the *.h files and remove all references to dllexport from the headers (or manually define DPTW32_STATIC_LIB in the headers).

ex:

 sed 's/ __declspec (dllexport)//g;s/ __declspec (dllimport)//g'

(ref: zeranoe build scripts)

like image 117
rogerdpack Avatar answered Sep 19 '22 17:09

rogerdpack