Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build on Windows #37

Open
mAch17 opened this issue Mar 2, 2015 · 11 comments
Open

Cannot build on Windows #37

mAch17 opened this issue Mar 2, 2015 · 11 comments

Comments

@mAch17
Copy link

mAch17 commented Mar 2, 2015

Hi,
I tried building OCCA on Windows using MINGW, but it fails as it cannot find sys/sysctl.h .
I had to hack around a bit to run it on windows, by changing HOME/scripts/makefile at around line 110 to put bash instead of /bin/bash . However, I got stuck at the error mentioned as sys/sysctl.h is not available in Windows apparently. Is there any alternative ?

@nnnunnn
Copy link

nnnunnn commented Mar 2, 2015

Hi mAch17,
Preferred tools for Windows will be the (free) VC 2013 Community edition,
http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx
Project files will be available soon!
Nigel

@dmed256
Copy link
Collaborator

dmed256 commented Mar 2, 2015

Thanks for the update, just pushed the change:

 /bin/bash -> bash

Strange, we have

#if (OCCA_OS == LINUX_OS) || (OCCA_OS == OSX_OS)
#  include <sys/sysctl.h>
#  include <dlfcn.h>
#endif

Can you post part of your compilation output
For instance, I see

clang++ -Wall -D__extern_always_inline=inline -fPIC -o /Users/dsm5/gitRepos/night/obj/occaOpenCL.o -D LINUX_OS=1 -D OSX_OS=2 -D WINDOWS_OS=4 -D OCCA_OS=OSX_OS -Wno-deprecated-declarations  -g -DOCCA_DEBUG_ENABLED=1 -DOCCA_CHECK_ENABLED=1 -DOCCA_OPENMP_ENABLED=0 -DOCCA_OPENCL_ENABLED=1 -DOCCA_CUDA_ENABLED=0 -DOCCA_COI_ENABLED=0 -c -I/Users/dsm5/gitRepos/night/lib -I/Users/dsm5/gitRepos/night/include -I./include /Users/dsm5/gitRepos/night/src/occaOpenCL.cpp

I'm looking for this part

-D LINUX_OS=1 -D OSX_OS=2 -D WINDOWS_OS=4 -D OCCA_OS=OSX_OS

which shows what OS you're using (might be faking Linux on MINGW?)

@dmed256
Copy link
Collaborator

dmed256 commented Mar 2, 2015

The machines Travis uses doesn't like the change to the makefile, still debugging it before merging with the main branch

@dmed256 dmed256 self-assigned this Mar 2, 2015
@dmed256
Copy link
Collaborator

dmed256 commented Mar 2, 2015

Just merged with the main branch, could you try compiling again?

I added an extra check for Cygwin/MINGW in the makefile, hopefully it detects Windows_OS

Thanks =)

@mAch17
Copy link
Author

mAch17 commented Mar 2, 2015

Thanks for the quick response :) . The problem still persists. I think like as you said, MINGW faking Linux causes the problem.
g++ -O3 -o C:\Users\sony\Documents\OCCA2/obj/occaCUDA.o -D LINUX_OS=1 -D OSX_OS
=2 -D WINDOWS_OS=4 -D OCCA_OS=LINUX_OS -DOCCA_DEBUG_ENABLED=0 -DNDEBUG=1 -DOCCA_SHOW_WARNINGS=0 -DOCCA_CHECK_ENABLED=1 -DOCCA_OPENMP_ENABLED= -DOCCA_OPENCL_ENABLED=0 -DOCCA_CUDA_ENABLED=0 -DOCCA_COI_ENABLED=0

@mAch17
Copy link
Author

mAch17 commented Mar 2, 2015

Also am I supposed to update list of openCL supporting devices somewhere in config or will OCCA find openCL libs by itself ? Both my CPU and GPU support openCL, however it looks like OpenCL is not enabled in above compilation.

@dmed256
Copy link
Collaborator

dmed256 commented Mar 2, 2015

No problem =)

URG, still not detecting Windows ( - n-)
I changed the OS-detection in the makefile, can you try pulling and compiling again?

If you have OpenCL installed but it's not enabled, set:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/libOpenCL.so
export OCCA_INCLUDE_PATH=$OCCA_INCLUDE_PATH:/path/to/CL/opencl.h

I'm not sure how the headers are handled in Windows (haven't programmed in Windows) or if the headers/libraries have different names

If it fails, please send me more info and I'll fix it ASAP =)

Thanks again!

EDIT: INCLUDE was mispelled

@dmed256
Copy link
Collaborator

dmed256 commented Mar 2, 2015

Oh, also set

export PATH=$PATH:$OCCA_DIR/bin

and you'll be able to do

occainfo

to print out device info.
For instance, here's my output:

> occainfo
==============o=======================o==========================================
   CPU Info   |  Processor Name       | Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
              |  Cores                | 4
              |  Clock Frequency      | 1.4 GHz
              |  SIMD Instruction Set | SSE3
              |  SIMD Width           | 128 bits
              |  L1 Cache Size (d)    |  32 KB
              |  L2 Cache Size        | 256 KB
              |  L3 Cache Size        |   3 MB
==============o=======================o==========================================
    OpenCL    |  Device Name          | Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
              |  Driver Vendor        | Intel
              |  Platform ID          | 0
              |  Device ID            | 0
              |-----------------------+------------------------------------------
              |  Device Name          | HD Graphics 5000
              |  Driver Vendor        | Intel
              |  Platform ID          | 0
              |  Device ID            | 1
==============o=======================o==========================================

@mAch17
Copy link
Author

mAch17 commented Mar 2, 2015

Still encounters some problem.

C:\Users\sony\Documents\OCCA2/include/occaTools.hpp:28:0: warning: "NOMINMAX" redefined

define NOMINMAX // NBN: clear min/max macros

^
In file included from c:/mywares/gnu/mingw64/x86_64-w64-mingw32/include/c++/x86_
64-w64-mingw32/bits/c++config.h:430:0,
from c:/mywares/gnu/mingw64/x86_64-w64-mingw32/include/c++/iostream:38,
from C:\Users\sony\Documents\OCCA2/include/occa.hpp:4,
from C:\Users\sony\Documents\OCCA2/src/occaBase.cpp:1:
c:/mywares/gnu/mingw64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32/bits/os_defines.h:45:0: note: this is the location of the previous definition
#define NOMINMAX 1
^
C:\Users\sony\Documents\OCCA2/src/occaBase.cpp:867:24: error: #if with no expression
#if OCCA_OPENMP_ENABLED^
C:\Users\sony\Documents\OCCA2/src/occaBase.cpp:1574:24: error: #if with no expression
#if OCCA_OPENMP_ENABLED^
make: *** [C:\Users\sony\Documents\OCCA2/obj/occaBase.o] Error 1
bash-3.1$

@dmed256
Copy link
Collaborator

dmed256 commented Mar 2, 2015

Oh, I guess the OpenMP-detection script crashed

I just pushed to the main branch something that will hopefully fix it

Thanks again!

@dmed256
Copy link
Collaborator

dmed256 commented Mar 3, 2015

Good news, I got it compiled with Cygwin and going to test MINGW soon

I'll have to change some of the code, I'll push tonight

@dmed256
Copy link
Collaborator

dmed256 commented Mar 3, 2015

I got OCCA and some examples to compile using Cygwin (haven't tested OpenCL/CUDA)

I finally got MinGW set up (OS detection works) and compiles most files
Need to switch pthreads -> Windows threads (same with mutex's)

@dmed256 dmed256 removed their assignment May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants