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

Request support for MinGW compilers under Windows #133

Closed
Gjacquenot opened this issue Mar 3, 2016 · 5 comments
Closed

Request support for MinGW compilers under Windows #133

Gjacquenot opened this issue Mar 3, 2016 · 5 comments

Comments

@Gjacquenot
Copy link
Contributor

Dear all,

I have tried to compile clFFT with MinGW under Windows 7, with CUDA/v7.0.
I succeed in compiling the program, but examples crash while calling clGetPlatformIDs. It may be an incompatibility with the cl libraries.

First, I had one compilation error in the following function, while calling CreateFile. It seems to be a unicode problem, even though I had declared -DUNICODE:BOOL=OFF while calling cmake

[  3%] Building CXX object library/CMakeFiles/clFFT.dir/fft_binary_lookup.cpp.obj
d:/GJ/GIT/clFFT/src/library/fft_binary_lookup.cpp: In member function 'bool FFTBinaryLookup::CacheEntry::exclusive_create()':
d:/GJ/GIT/clFFT/src/library/fft_binary_lookup.cpp:125:36: error: cannot convert 'const wchar_t*' to 'LPCSTR {aka const char*}' for argument '1' to 'void* CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE)'
                                NULL);
                                    ^
make[2]: *** [library/CMakeFiles/clFFT.dir/fft_binary_lookup.cpp.obj] Error 1
make[1]: *** [library/CMakeFiles/clFFT.dir/all] Error 2
make: *** [all] Error 2

I have fixed by adding a cast on

bool FFTBinaryLookup::CacheEntry::exclusive_create()
{
#ifdef _WIN32
    std::wstring tmp;
    tmp.assign(this->m_filename.begin(), this->m_filename.end());

    HANDLE handle = CreateFile((char*)tmp.c_str(), 
                               GENERIC_WRITE, 
                               0, // no share with other process
                               NULL,
                               CREATE_NEW,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL);

Second, when I call one of the examples, the example crash while calling clGetPlatformIDs. Maybe it is a problem with CUDA libraries.

XXXX@PC-XX MINGW64 /d/GJ/GIT/clFFT_build_debug
$ cmake ../clFFT/src/ -G'MSYS Makefiles' -DUNICODE:BOOL=OFF -DCMAKE_BUILD_TYPE=Debug
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 64bit build - FIND_LIBRARY_USE_LIB64_PATHS TRUE
-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   program_options
-- Boost_PROGRAM_OPTIONS_LIBRARY: C:/Program Files/boost_1_60_0_GCC492_64Bits/lib/libboost_program_options-mgw49-mt-1_60.a
-- Found OPENCL: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.0/lib/x64/OpenCL.lib
-- Could NOT find FFTW (missing:  FFTW_LIBRARIES FFTW_INCLUDE_DIRS)
-- FindFFTW looked for single precision libraries named: fftw3f or libfftw3f-3
-- FindFFTW looked for double precision libraries named: fftw3 or libfftw3-3
-- Detected GNU fortran compiler.
-- CMAKE_CXX_COMPILER flags: -m64 -pthread
-- CMAKE_CXX_COMPILER debug flags: -g
-- CMAKE_CXX_COMPILER release flags: -O3 -DNDEBUG
-- CMAKE_CXX_COMPILER relwithdebinfo flags: -O2 -g -DNDEBUG
-- CMAKE_EXE_LINKER link flags:
FFT clients will NOT be built
GoogleTest unit tests will NOT be built
FFT callback client will NOT be built
-- Configuring done
-- Generating done
-- Build files have been written to: D:/GJ/GIT/clFFT_build_debug




$ gdb ./fft1d.exe
GNU gdb (GDB) 7.8.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./fft1d.exe...done.
(gdb) r
Starting program: D:\GJ\GIT\clFFT_build_debug\package\share\clFFT\examples\fft1d.exe
[New Thread 17636.0x4b80]
warning: Could not load shared library symbols for C:\windows\system32\kernel64.dll.
Do you need "set solib-search-path" or "set sysroot"?

Program received signal SIGSEGV, Segmentation fault.
0x0000000000401c08 in clGetPlatformIDs ()
(gdb) bt
#0  0x0000000000401c08 in clGetPlatformIDs ()
#1  0x00000000004015dc in main () at d:/GJ/GIT/clFFT/src/examples/fft1d.c:45
@bragadeesh
Copy link
Member

Did you first make sure you can get a simple OpenCL program working with MinGW and with the Nvidia OpenCL platform? Once you are successful with that, you can attempt using clFFT.

@bragadeesh
Copy link
Member

I am closing this issue for now; it is great to see efforts to get clFFT working on variety of build environments.

@Gjacquenot
Copy link
Contributor Author

Sorry for the late reply, but yes you are right about the fact one should check if CUDA libraries work with MinGW. For time being, it is not the case. I hope it will soon be available, so that one can use clFFT with MinGW!

@Gjacquenot
Copy link
Contributor Author

@bragadeesh : I succeed in compiling and running clFFT on Windows with MinGW.

I have used Intel OpenCl libraries, and I just convert OpenCL.lib to OpenCL.a with reimp.

Then, I have configured and compiled clFFT without any additional work. It works like a charm!

@bragadeesh
Copy link
Member

@Gjacquenot Great to hear that.

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

2 participants