Skip to content

Instantly share code, notes, and snippets.

@stoyanovd
Last active January 7, 2019 12:08
Show Gist options
  • Save stoyanovd/c6931a14c4dd7c76b55f to your computer and use it in GitHub Desktop.
Save stoyanovd/c6931a14c4dd7c76b55f to your computer and use it in GitHub Desktop.
Caffe for win32 (with mini-caffe ~willyd caffe-builder~)

Now nearly all problems are solved with mini-caffe

Legacy

We will go to setup caffe with all dependencies for Win32 executables. (tested with Windows 10 and Visual Studio 2013)

(Nearly) full work can be done with https://github.com/willyd/caffe-builder
But win32 built wants some changes.

think, this fork must be referenced too: https://github.com/lltcggie/caffe-builder

I use Github Desktop (for git executable) and Notepad++ (for going through a lot of fixes).

My fixes are just for run app. Maybe some of them are ugly, but the main aim was to finish quickly.

Fixes.

  1. OpenBLAS must be built for win32
    (change ./cmake/packages/OpenBLAS.cmake)
    for Win32 (there will be no 'int32' vs 'int64' question)
    and mingw: mingw32_dll.zip

-- at this point all dependencies were successfully built --
-- (and hopefully appropriate versions) --

  1. popcnt64 is undefined for Win32
    Add to header which cause an error:
    https://gitcafe.com/Ray/AI2013Spring/blob/master/Connect4/src/Type.hh?locale=zh-TW

(More detailed: https://gist.github.com/stoyanovd/96589e5d0b074df51f72)

  1. C2632 ('int' followed by 'int' is illegal) (or so on)
    I change typedef in hdf5 related files.
    In directory
    .\build\install\include\
    in all files with H5 in names
    change ssize_t to sth specific, for example dima_ssize_t =)

-- at this time code was compiled successfully --

And as I rememeber where will be no problems for linker.

To (our) custom app

add LIBS to cmake.
(at this time I built with Opencv2.4) (and static)
https://gist.github.com/stoyanovd/b30ebe3613aaf4867bd6
and place all .dll's near the our_app.exe

In Linker -> Input -> Additional dependencies appears ZLIB.lib. I don't know why.
As for me, I removed it (because I explicitly place zlibd.lib (or sth else) in cmake project)
(Replace ZLIB.lib; with nothing for all *.vcxproj* files.)

sth additions...

  • As I remember, this builder place OpenCV libs only in lib/Debug, not in lib/Release
  • hdf5 has old link. (it was fixed)
    willyd/caffe-builder#18
    (change it in ./cmake/packages/HDF5.cmake)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment