tensorflow_cc icon indicating copy to clipboard operation
tensorflow_cc copied to clipboard

CPack support

Open FloopCZ opened this issue 8 years ago • 7 comments

It would be great to add CPack functionality in order to be able to distribute this as an already built installer and a standard package for Debian, Ubuntu, etc. See https://github.com/tensorflow/tensorflow/issues/2412#issuecomment-304433971

FloopCZ avatar Jul 17 '17 10:07 FloopCZ

I recently packaged this for xenial, debian packaging available here:

https://github.com/MarbleInc/tensorflow_cc/tree/xenial

phil-marble avatar Jan 12 '18 21:01 phil-marble

@phil-marble Cool, thank you! When you are ready, you can make a PR out of it.

FloopCZ avatar Jan 19 '18 19:01 FloopCZ

I managed get CPack worked for this project.

  1. you have to use higher version of cmake (>3.7.0) in order to get over cmake bug #14332. Ubuntu 16.04 Xenial official apt only has cmake version 3.5.1. you have to upgrade it manually. I tested with cmake 3.10.

  2. add CPack into the end of CMakeList.txt

SET(CPACK_GENERATOR "DEB;TGZ")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Tensorflow_cc Maintainer")
SET(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar") # for cmake bug #14332
SET(CPACK_SET_DESTDIR true)
SET(CPACK_INSTALL_PREFIX "/usr/local")

INCLUDE(CPack)
  1. some symlink will not be replaced in Bazel output directories and they will cause errors when deb installation. I found not all the Bazel output directories are necessary thus I changed header installation part into
install(
  DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/"
  DESTINATION include/tensorflow
  FILES_MATCHING
  PATTERN "*.h"
  PATTERN "bazel-tensorflow*" EXCLUDE
)

maybe more filters can be added to get rid of empty directories as well. full CMakeLists.txt: CMakeLists.txt

sunfic avatar Feb 01 '18 21:02 sunfic

@sunfic This is great, thank you!

I fixed the script that gets rid of symlinks by copying the original files. Can you try to build a .deb file out of the most recent master branch?

FloopCZ avatar Feb 08 '18 12:02 FloopCZ

@FloopCZ Hey, I used the instructions in the post by @sunfic and it seems to have built a working package :)

sjdrc avatar Feb 21 '18 04:02 sjdrc

@FloopCZ I tried to test the new code but right now the Bazel, Tensorflow and CUDA updates make more errors pop up. I will wait until the tool chains stable than redo the tests.

sunfic avatar Mar 02 '18 21:03 sunfic

@FloopCZ I can comfirm that for current version tensorflow_cc for tensorflow 1.6.0 can be successfully built on X86-64 with latest CUDA 9.1 and on aarch64 (NVIDIA TX1) with CUDA 8.0 with bazel 0.11.0. I did with "--config=monolithic" option on and used GCC5. Since both GCC versions (5 and 6) worked, I suggest by default using system gcc version without adding additional tool chain for current Ubuntu 16.04.

sunfic avatar Mar 05 '18 16:03 sunfic