mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix a caffe2-gloo dependency problem
Summary: The problem: Building caffe2 fails because the installed directory contains "anaconda". The cause: Compiling Gloo will generate a new config.h file in the binary folder. If we put the original config.h in front, the compiler will complain "Expected GLOO_USE_CUDA to be defined". ~~~Switch the positions of the include folders can solve the problem.~~~ Function caffe2_include_directories in cmake/Utils.cmake is a little bit hacky. If the directory contains "anaconda", it will append the new include directory after existing include path. Otherwise it will insert the directory before the path. So in the first case, the directories are inserted in order, and in the latter one, they are inserted reversely. The solution: See the commit. pietern #1121 Closes https://github.com/caffe2/caffe2/pull/1258 Reviewed By: Yangqing Differential Revision: D5907167 Pulled By: houseroad fbshipit-source-id: 2cb3916e7e0313ebc3be3d1666bfa14bbf479607
This commit is contained in:
committed by
Facebook Github Bot
parent
bd5233b4f9
commit
def0506d95
@ -356,8 +356,11 @@ if(USE_GLOO)
|
||||
set(BUILD_TEST OFF)
|
||||
set(BUILD_BENCHMARK OFF)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/gloo)
|
||||
caffe2_include_directories(${PROJECT_SOURCE_DIR}/third_party/gloo)
|
||||
caffe2_include_directories(${PROJECT_BINARY_DIR}/third_party/gloo)
|
||||
# Here is a little bit hacky. We have to put PROJECT_BINARY_DIR in front
|
||||
# of PROJECT_SOURCE_DIR with/without conda system. The reason is that
|
||||
# gloo generates a new config.h in the binary diretory.
|
||||
include_directories(BEFORE SYSTEM ${PROJECT_SOURCE_DIR}/third_party/gloo)
|
||||
include_directories(BEFORE SYSTEM ${PROJECT_BINARY_DIR}/third_party/gloo)
|
||||
set(BUILD_TEST ${__BUILD_TEST})
|
||||
set(BUILD_BENCHMARK ${__BUILD_BENCHMARK})
|
||||
|
||||
|
Reference in New Issue
Block a user