prefiks / u2f4moz

U2F support extension for Firefox
GNU Lesser General Public License v2.1
197 stars 15 forks source link

What's the Windows build toolchain ? #49

Open clownbaby opened 7 years ago

clownbaby commented 7 years ago

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

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

Thanks!

prefiks commented 7 years ago

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.

clownbaby commented 7 years ago

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'

prefiks commented 7 years ago

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 commented 7 years ago

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