u2f4moz icon indicating copy to clipboard operation
u2f4moz copied to clipboard

What's the Windows build toolchain ?

Open clownbaby opened this issue 8 years ago • 4 comments

Has anyone successfully built the windows binary? What toolchain did you use?

Which version of cmake, make, gcc, visual studio ?

Thanks!

clownbaby avatar Jan 06 '17 00:01 clownbaby

Hello,

I am cross compiling this on linux using mingw, but it should be possible to do that using windows mingw (i am not sure if you would be able to compile this using visual c, iirc i tried to use vc at first and there were compatibility in libu2f-host library that is used in this extension, or maybe it was problem with automake build system that it used? I did convert it to cmake so at least that step should be ok). I am using cmake 3.6 and gcc from mingw-w64, i think its version 5.0.x.

prefiks avatar Jan 06 '17 10:01 prefiks

Thanks!

Do you have a toolchain config? I'm getting a bunch of problems with cmake throwing -rdynamic at i686-w64-mingw32-gcc even though CMAKE_SYSTEM_NAME is set to 'Windows'

clownbaby avatar Jan 06 '17 23:01 clownbaby

This is toolchain file i am using:

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/lib/gcc/i686-w64-mingw32/6.2-win32)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

You probably will need to adopt paths, this one uses paths that are compatible with what debian mingw-w64 package offers.

prefiks avatar Jan 07 '17 09:01 prefiks

And shell commands to have build it like that:

cd <repo>/c_src
mkdir build-windows
cd build-windows
cmake -DCMAKE_TOOLCHAIN_FILE=<path_to_toolchain>/cmake-mingw.cmake ..
make
make install/strip

and this will give you .exe in /ext/bin/winnt_x86-msvc

prefiks avatar Jan 07 '17 09:01 prefiks