Compile OpenBLAS under Linux command line in Windows 10 (want to produce dll/lib)

302 views
Skip to first unread message

Bennie Zhitomirsky

unread,
Sep 20, 2016, 1:05:18 PM9/20/16
to OpenBLAS-users
Hi,

Instead of having a headache with MinGW, Cigwin and others I am trying to use the new Windows 10 feature (in beta) which allows to execute Linux stuff under windows. Seeing that make may be confused I am executing the following command line: make OSNAME=WINNT. However I am getting the errors that I am pasting below. It looks like it does not see windows definitions.

blas_server_win32.c:47:3: error: unknown type name ‘CRITICAL_SECTION’
   CRITICAL_SECTION lock;
   ^
blas_server_win32.c:48:3: error: unknown type name ‘HANDLE’
   HANDLE filled;
   ^
blas_server_win32.c:49:3: error: unknown type name ‘HANDLE’
   HANDLE killed;
   ^
blas_server_win32.c:63:1: error: unknown type name ‘HANDLE’
 static HANDLE     blas_threads   [MAX_CPU_NUMBER];
 ^
blas_server_win32.c:64:1: error: unknown type name ‘DWORD’
 static DWORD     blas_threads_id[MAX_CPU_NUMBER];
 ^
blas_server_win32.c:155:1: error: unknown type name ‘DWORD’
 static DWORD WINAPI blas_thread_server(void *arg){
 ^
blas_server_win32.c:155:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘blas_thread_server’
 static DWORD WINAPI blas_thread_server(void *arg){
                     ^
blas_server_win32.c: In function ‘blas_thread_init’:
blas_server_win32.c:303:3: warning: passing argument 1 of ‘pthread_mutex_lock’ from incompatible pointer type [enabled by default]
   LOCK_COMMAND(&server_lock);
   ^
parameter.c: In function ‘blas_set_parameter’:
parameter.c:255:7: warning: unused variable ‘size’ [-Wunused-variable]
   int size = 16;
       ^
In file included from ../../common.h:129:0,
                 from blas_server_win32.c:41:
/usr/include/pthread.h:773:12: note: expected ‘union pthread_mutex_t *’ but argument is of type ‘BLASULONG *’
 extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
            ^
blas_server_win32.c:312:5: warning: implicit declaration of function ‘InitializeCriticalSection’ [-Wimplicit-function-declaration]
     InitializeCriticalSection(&pool.lock);
     ^
blas_server_win32.c:313:5: warning: implicit declaration of function ‘CreateEvent’ [-Wimplicit-function-declaration]
     pool.filled = CreateEvent(NULL, FALSE, FALSE, NULL);
     ^
blas_server_win32.c:313:37: error: ‘FALSE’ undeclared (first use in this function)
     pool.filled = CreateEvent(NULL, FALSE, FALSE, NULL);
                                     ^
blas_server_win32.c:313:37: note: each undeclared identifier is reported only once for each function it appears in
blas_server_win32.c:314:37: error: ‘TRUE’ undeclared (first use in this function)
     pool.killed = CreateEvent(NULL, TRUE,  FALSE, NULL);
                                     ^
blas_server_win32.c:320:7: warning: implicit declaration of function ‘CreateThread’ [-Wimplicit-function-declaration]
       blas_threads[i] = CreateThread(NULL, 0,
       ^
blas_server_win32.c:321:10: error: ‘blas_thread_server’ undeclared (first use in this function)
          blas_thread_server, (void *)i,
          ^
blas_server_win32.c:328:3: warning: passing argument 1 of ‘pthread_mutex_unlock’ from incompatible pointer type [enabled by default]
   UNLOCK_COMMAND(&server_lock);
   ^
In file included from ../../common.h:129:0,
                 from blas_server_win32.c:41:
/usr/include/pthread.h:784:12: note: expected ‘union pthread_mutex_t *’ but argument is of type ‘BLASULONG *’
 extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
            ^
blas_server_win32.c: In function ‘exec_blas_async’:
blas_server_win32.c:349:13: error: ‘blas_queue_t’ has no member named ‘finish’
     current -> finish = CreateEvent(NULL, FALSE, FALSE, NULL);
             ^
blas_server_win32.c:349:43: error: ‘FALSE’ undeclared (first use in this function)
     current -> finish = CreateEvent(NULL, FALSE, FALSE, NULL);
                                           ^
blas_server_win32.c:361:3: warning: implicit declaration of function ‘EnterCriticalSection’ [-Wimplicit-function-declaration]
   EnterCriticalSection(&pool.lock);
   ^
blas_server_win32.c:371:3: warning: implicit declaration of function ‘LeaveCriticalSection’ [-Wimplicit-function-declaration]
   LeaveCriticalSection(&pool.lock);
   ^
blas_server_win32.c:373:3: warning: implicit declaration of function ‘SetEvent’ [-Wimplicit-function-declaration]
   SetEvent(pool.filled);
   ^
blas_server_win32.c: In function ‘exec_blas_async_wait’:
blas_server_win32.c:389:7: warning: implicit declaration of function ‘WaitForSingleObject’ [-Wimplicit-function-declaration]
       WaitForSingleObject(queue->finish, INFINITE);
       ^
blas_server_win32.c:389:32: error: ‘blas_queue_t’ has no member named ‘finish’
       WaitForSingleObject(queue->finish, INFINITE);
                                ^
blas_server_win32.c:389:42: error: ‘INFINITE’ undeclared (first use in this function)
       WaitForSingleObject(queue->finish, INFINITE);
                                          ^
blas_server_win32.c:391:7: warning: implicit declaration of function ‘CloseHandle’ [-Wimplicit-function-declaration]
       CloseHandle(queue->finish);
       ^
blas_server_win32.c:391:24: error: ‘blas_queue_t’ has no member named ‘finish’
       CloseHandle(queue->finish);
                        ^
blas_server_win32.c:392:7: warning: implicit declaration of function ‘DeleteCriticalSection’ [-Wimplicit-function-declaration]
       DeleteCriticalSection(&queue -> lock);
       ^
blas_server_win32.c: In function ‘blas_thread_shutdown_’:
blas_server_win32.c:439:3: warning: passing argument 1 of ‘pthread_mutex_lock’ from incompatible pointer type [enabled by default]
   LOCK_COMMAND(&server_lock);
   ^
In file included from ../../common.h:129:0,
                 from blas_server_win32.c:41:
/usr/include/pthread.h:773:12: note: expected ‘union pthread_mutex_t *’ but argument is of type ‘BLASULONG *’
 extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
            ^
blas_server_win32.c:447:3: warning: implicit declaration of function ‘TerminateThread’ [-Wimplicit-function-declaration]
   TerminateThread(blas_threads[i],0);
   ^
blas_server_win32.c:453:3: warning: passing argument 1 of ‘pthread_mutex_unlock’ from incompatible pointer type [enabled by default]
   UNLOCK_COMMAND(&server_lock);
   ^
In file included from ../../common.h:129:0,
                 from blas_server_win32.c:41:
/usr/include/pthread.h:784:12: note: expected ‘union pthread_mutex_t *’ but argument is of type ‘BLASULONG *’
 extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
            ^
blas_server_win32.c: In function ‘goto_set_num_threads’:
blas_server_win32.c:468:3: warning: passing argument 1 of ‘pthread_mutex_lock’ from incompatible pointer type [enabled by default]
   LOCK_COMMAND(&server_lock);
   ^
In file included from ../../common.h:129:0,
                 from blas_server_win32.c:41:
/usr/include/pthread.h:773:12: note: expected ‘union pthread_mutex_t *’ but argument is of type ‘BLASULONG *’
 extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
            ^
blas_server_win32.c:474:36: error: ‘FALSE’ undeclared (first use in this function)
    pool.filled = CreateEvent(NULL, FALSE, FALSE, NULL);
                                    ^
blas_server_win32.c:475:36: error: ‘TRUE’ undeclared (first use in this function)
    pool.killed = CreateEvent(NULL, TRUE,  FALSE, NULL);
                                    ^
blas_server_win32.c:485:10: error: ‘blas_thread_server’ undeclared (first use in this function)
          blas_thread_server, (void *)i,
          ^
blas_server_win32.c:491:3: warning: passing argument 1 of ‘pthread_mutex_unlock’ from incompatible pointer type [enabled by default]
   UNLOCK_COMMAND(&server_lock);
   ^
In file included from ../../common.h:129:0,
                 from blas_server_win32.c:41:
/usr/include/pthread.h:784:12: note: expected ‘union pthread_mutex_t *’ but argument is of type ‘BLASULONG *’
 extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
            ^
make[1]: *** [blas_server.obj] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/mnt/c/mingw/msys/home/benjz/openblas/driver/others'
make: *** [libs] Error 1

Thanks in advance.

Marco Atzeri

unread,
Sep 20, 2016, 2:44:31 PM9/20/16
to openbla...@googlegroups.com
On 20/09/2016 19:05, Bennie Zhitomirsky wrote:
> Hi,
>
> Instead of having a headache with MinGW, Cigwin and others I am trying
> to use the new Windows 10 feature (in beta) which allows to execute
> Linux stuff under windows. Seeing that make may be confused I am
> executing the following command line: make OSNAME=WINNT. However I am
> getting the errors that I am pasting below. It looks like it does not
> see windows definitions.

I doubt the OSNAME=WINNT makes sense inside what is basically a
Linux Virtual Machine.

Regards
Marco

Marco Atzeri

unread,
Sep 24, 2016, 2:37:24 AM9/24/16
to Bennie Zhitomirsky, openbla...@googlegroups.com

back on the mailing list.
Bottom post is better please.

On 22/09/2016 17:16, Bennie Zhitomirsky wrote:
> Yes it make sense what you say (while actually this is not a virtual
> machine but Linux subsystem and it does have direct access to all
> resources without using any of virtualization technologies).

It is a crafted VM.

>
> In any case is there any way to build Windows binaries in Linux without
> dealing with those tools for Windows: MinGW and MSys and etc? Whenever I
> need to use these tools I am getting a headache;-)

On cygwin I have no problem, but I am the cygwin binary maintainer
so slight biased.


> Thanks in advance!

You are welcome

Marco Atzeri

unread,
Sep 24, 2016, 3:30:23 AM9/24/16
to Bennie Zhitomirsky, openbla...@googlegroups.com
back on mailing list #2

On 22/09/2016 19:35, Bennie Zhitomirsky wrote:
> Update I came up with the following command line and I think and have
> some progress, however it still fails in test build and doesn't create dll.
> make AR=i686-w64-mingw32-ar RANLIB=i686-w64-mingw32-ranlib
> CC=i686-w64-mingw32-gcc FC=i686-w64-mingw32-gfortran BINARY=64
> USE_THREAD=1 TARGET=NEHALEM HOSTCC=gcc
>
> Build error:
> /sblat1: 1: ./sblat1: MZ� ���@� � �: not found
> ./sblat1: 2: ./sblat1: � �W� S� f�: not found
> ./sblat1: 3: ./sblat1: Syntax error: "(" unexpected
> It looks like it tries to execute windows executable...

maybe, I am on W7 so I can not verify

Regards
Marco
Reply all
Reply to author
Forward
0 new messages