New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved CMake scripts #1667

Closed
wants to merge 19 commits into
base: dev
from

Conversation

Projects
None yet
@Nerei

Nerei commented Jan 2, 2015

@shelhamer @jeffdonahue @baeuml @kloudkl @akosiorek @Yangqing @BlGene

Hello all,

hope I referenced everyone who participated cmake development (at least I didn't find others)

Following discussion here #1586, as I promised, I prepared slightly improved caffe cmake scripts. The improvement was developed using Ubuntu 14.04 and tested on Yosemite (with libstdc++). I believe Windows support now is as difficult as compiling all dependencies. But I prefer to postpone testing on Windows until current very linux-ish build scripts and behaviour are slightly adapted for cross-platform use and some dependencies are made optional.

Description of changes and new features added

Added OpenCV like formatted configuration log
https://travis-ci.org/BVLC/caffe/jobs/45700248

Added CaffeConfig.cmake generation for build/install cases.
This allows you to connect Caffe to your application using CMake's find_package(Caffe). For more detailed description see below.

BUILD_SHARED_LIB=ON (default) or OFF
build caffe as shared library. In CMake it not good practice to build both shared and static simultaneously. That’s why the switch.

CPU_ONLY = OFF(default) or ON
Forces excluding CUDA support. Also Caffe will compile in CPU_ONLY mode if CUDA Toolkit is not installed or found by cmake. Before build please read chic configuration log dumped by cmake to control this case.

USE_CUDNN = ON (default)
If enabled and cudnn is found build with it, otherwise build without.

CUDA_ARCH_NAME=Auto(default), All, Fermi, Kepler, Maxwell, Manual
specifies target GPU architecture, Selecting concrete value reduces CUDA code compilation time (for instance compilation for sm_20 and sm_30 is twice longer than just for one of them). In case of Auto, cmake will make an attempt to detect GPUS installed in your computer and compile only for them. In case of manual, new CUDA_ARCH_BIN/PTX cmake variables are created where space separated list of architectures should be set. Example, CUDA_ARCH_BIN=”20 21(20) 50”

BUILD_docs = ON (default)

  • If doxygen installed and found enables doc target. Use make docs to build and make jekyll to run web server. html docs are built in <source folder>/doxygen, and next symlink is created in <source folder>/docs/doxygen. Functionality from scripts/gather_examples.sh is now implemented in cmake, but copy_notebook.py is still required.
  • Source folder for generation is used because .Doxyfile contains relative paths and I prefer not to modify it now, but think generation in binary folder is better

BUILD_python = ON (default)
Build python interface if all required dependencies found, otherwise excluded from build automatically

BUILD_matlab = OFF(default)
Enables building matlab interfaces. Currently it supports both Octave and Matlab. For Octave set Octave_compiler to mkoctfile if not found automatically. For Matlab specify Matlab_DIR or Matlab_mex and Matlab_mexext if again not found automatically. If both installed and found, to select which one to use, set Matlab_build_mex_using=Matlab(default) or Octave. Note matlab wrappers can only be built if BUILD_SHARED_LIB=On. On macos both doesn’t compile.

Proto-files
Now protobuf files ARE NOT copied to <caffe_root>/include/caffe/proto anymore. Instead they are generated to <build_dir>/include/caffe/proto. Know one may include old headers, but this is interest rates to payback of technical debt appeared due to incorrect original cmake scripts design. Also removed them from .gitignore

test.testbin

  • Now NO cmake_test_defines.hpp and sample_data_list.txt are configured by cmake to source directory and NO -DCMAKE_BUILD definition added and all *.in templates were removed. This is because make runtest command is executed in source directory, and embedding absolute paths to test cpp-files is not required! Consider configure_file() to source folder as antipattern. However, one may return such embedding by uncommenting couple lines in srcs/test/CMakeLists.txt.
  • All garbage targets (one per each test file) were removed because they flood IDEs while compilation time reduction is controversial. I replaced them with option BUILD_only_tests that allows quickly include only selected tests. Example: cmake -DBUILD_only_tests=="common,net,blob,im2col_kernel"

Yosemite support
I was able to compile with CUDA support using the Caffe instruction with libstdc++ and patching opencv as here opencv/opencv@32f6e1a. Accelerate.framework support added. Matlab interface was failed to compile.

Temporary changes

  • make symlink creates symlink [caffe_root]/build -> cmake_build_directory
  • Now all examples are built without .bin suffix and next symlink with .bin suffix created nearby. So that tutorials could work. Once naming standardized, should remove this.

Including Caffe in your CMake project via find_package()

git clone git@github.com:BVLC/caffe.git. 
cd caffe && mkdir cmake_build && cd cmake_build
cmake .. -DBUILD_SHARED_LIB=ON

Verify that cmake found everything and in proper locations. After can run make -j 12 right now or better do this:

cmake . -DCMAKE_BUILD_TYPE=Debug     # switch to debug
make -j 12 && make install           # installs by default to build_dir/install
cmake . -DCMAKE_BUILD_TYPE=Release   # switch to release
make -j 12 && make install           # doesn’t overwrite debug install
make symlink

After the operations complete, caffe tutorials should work from caffe root directory. Let’s now see how to connect caffe to a C++ application that uses Caffe API with cmake. Prepare the following script:

cmake_minimum_required(VERSION 2.8.8)

find_package(Caffe)
include_directories(${Caffe_INCLUDE_DIRS})
add_definitions(${Caffe_DEFINITIONS})    # ex. -DCPU_ONLY

add_executable(caffeinated_application main.cpp)
target_link_libraries(caffeinated_application ${Caffe_LIBRARIES})

Run CMake to configure this application and generate build scripts or IDE project. It will automatically find Caffe in its build directory and pick up all necessarily dependencies (includes, libraries, definitions) and application will compile without any additional actions. Caffe dependencies will also have been included. If you have several Caffe builds or for some reason Cmake wasn’t able find Caffe automatically, you may specify Caffe_DIR=<path-to-caffe-build-dir> in Cmake and this guarantees that everything will work.

Specified Caffe_DIR to build directory leads to always using a build configuration (say, Release or Debug) Caffe compiled last time for. If you set Caffe_DIR=<caffe-install-dir>/share/Caffe where both configurations have been installed, proper debug or release caffe binaries will be selected depending on for which configuration you compile your caffeinated_application.

Enjoy!!

(Fixed typos in CUDA architectures - @Noiredd)

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 3, 2015

Nerei@60e8f7a#commitcomment-9141630 According to this @longjon 's comment, I reverted last commit where I had reduced NumPy requirements from 1.7.1. to 1.6.1. But now python interface compilation is not tested by Travis CI. Need to update numpy there.

Nerei commented Jan 3, 2015

Nerei@60e8f7a#commitcomment-9141630 According to this @longjon 's comment, I reverted last commit where I had reduced NumPy requirements from 1.7.1. to 1.6.1. But now python interface compilation is not tested by Travis CI. Need to update numpy there.

@longjon

This comment has been minimized.

Show comment
Hide comment
@longjon

longjon Jan 3, 2015

Contributor

Re: numpy versions, Travis should use a recent version after #1473. (If we want to build pycaffe with these CMake updates before that, the Travis build script could be modified to force CMake to go ahead with an older version, either by some CMake switch that I don't know, or by actually updating the CMake script before the build.)

Contributor

longjon commented Jan 3, 2015

Re: numpy versions, Travis should use a recent version after #1473. (If we want to build pycaffe with these CMake updates before that, the Travis build script could be modified to force CMake to go ahead with an older version, either by some CMake switch that I don't know, or by actually updating the CMake script before the build.)

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 4, 2015

I noticed that some tasty python features are being implemented (Once they're done, I'm ready to prepare new PR with its support)

Nerei commented Jan 4, 2015

I noticed that some tasty python features are being implemented (Once they're done, I'm ready to prepare new PR with its support)

@shelhamer

This comment has been minimized.

Show comment
Hide comment
@shelhamer

shelhamer Jan 5, 2015

Member

@Nerei thanks for the effort to improve the CMake build and align it with the features of the Makefile. Nice to have the pieces in place to include Caffe in other projects too.

Regarding the shared or static library build, I'd rather the shared library be the default since it is used more commonly (right?).

Member

shelhamer commented Jan 5, 2015

@Nerei thanks for the effort to improve the CMake build and align it with the features of the Makefile. Nice to have the pieces in place to include Caffe in other projects too.

Regarding the shared or static library build, I'd rather the shared library be the default since it is used more commonly (right?).

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 5, 2015

Contributor

👍 for shared default

Contributor

bhack commented Jan 5, 2015

👍 for shared default

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 5, 2015

Absolutely agree that shared is better! Just it was for similarity with previous vesion.

Nerei commented Jan 5, 2015

Absolutely agree that shared is better! Just it was for similarity with previous vesion.

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

@Nerei I'm guessing what is the support status for windows generators with this refactoring. Working VS generators could help people at #15

Contributor

bhack commented Jan 11, 2015

@Nerei I'm guessing what is the support status for windows generators with this refactoring. Working VS generators could help people at #15

@bhack bhack referenced this pull request Jan 11, 2015

Closed

Caffe on Windows #15

@shelhamer

This comment has been minimized.

Show comment
Hide comment
@shelhamer

shelhamer Jan 11, 2015

Member

Great work @Nerei! Is this ready for review or are there further changes planned for this PR?

(Of course more can be done in follow ups, such as CMake support for the new Python features that are on track for merge.)

Member

shelhamer commented Jan 11, 2015

Great work @Nerei! Is this ready for review or are there further changes planned for this PR?

(Of course more can be done in follow ups, such as CMake support for the new Python features that are on track for merge.)

@Nerei Nerei closed this Jan 11, 2015

@Nerei Nerei reopened this Jan 11, 2015

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 11, 2015

To: @bhack CC: @shelhamer @Yangqing

Absolutely, agree that can use windows generators with cmake. But now I don't think that windows is currently supported by caffe without modifications.

If you compile caffe as dynamic library, Attribute __declspec(dllexport) using macro like here should be added to the beginning of EACH class and function in caffe, otherwise the symbols won't be visible from outside of dll-library. In case of static compilation, current layer registration scheme (introduced in @Yangqing's commit 2f88dab) doesn't work because unreferenced static constructors that register layers are just excluded by linker. To fix this, caffe uses workaround in Makefile.

For Windows, one may try -DCMAKE_CXX_FLAGS=/OPT:NOREF option, But I'd rather rewrite the code since anyway it is not very cross-platform, produces difficulties with different compilers, with Matlab/Octave interface and even with clang for ubuntu (--force-load only for shared libraries not for executables). Even if I make it work for some set of compilers now, it would be difficult to support and test these scripts in future for different configurations.

Nerei commented Jan 11, 2015

To: @bhack CC: @shelhamer @Yangqing

Absolutely, agree that can use windows generators with cmake. But now I don't think that windows is currently supported by caffe without modifications.

If you compile caffe as dynamic library, Attribute __declspec(dllexport) using macro like here should be added to the beginning of EACH class and function in caffe, otherwise the symbols won't be visible from outside of dll-library. In case of static compilation, current layer registration scheme (introduced in @Yangqing's commit 2f88dab) doesn't work because unreferenced static constructors that register layers are just excluded by linker. To fix this, caffe uses workaround in Makefile.

For Windows, one may try -DCMAKE_CXX_FLAGS=/OPT:NOREF option, But I'd rather rewrite the code since anyway it is not very cross-platform, produces difficulties with different compilers, with Matlab/Octave interface and even with clang for ubuntu (--force-load only for shared libraries not for executables). Even if I make it work for some set of compilers now, it would be difficult to support and test these scripts in future for different configurations.

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 11, 2015

@shelhamer Thanks! I think it's ready for review. At least future changes, like windows support or improvements, I would cover in separate PR.

I think better to fetch the branch and review cmake-files locally, it should be easy to read. I wanted to write them as very readable, all difficulties are separated as macros, most of which I just copy-pasted from my projects and opencv. My aim was to create some well done basis/style and standardize it, so that it would be clear where/how to write changes in future.

Nerei commented Jan 11, 2015

@shelhamer Thanks! I think it's ready for review. At least future changes, like windows support or improvements, I would cover in separate PR.

I think better to fetch the branch and review cmake-files locally, it should be easy to read. I wanted to write them as very readable, all difficulties are separated as macros, most of which I just copy-pasted from my projects and opencv. My aim was to create some well done basis/style and standardize it, so that it would be clear where/how to write changes in future.

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 11, 2015

Regarding windows, I might be worth creating a repository with cmakeified dependencies so that one can compile and use use the dependencies for caffe compilation "in couple clicks". I can help with this since I am primary a windows user.

Nerei commented Jan 11, 2015

Regarding windows, I might be worth creating a repository with cmakeified dependencies so that one can compile and use use the dependencies for caffe compilation "in couple clicks". I can help with this since I am primary a windows user.

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

@Nerei I'm not a window user but in past for other projects we have used MXE on Linux to cross compile dependencies. It integrates also well with Cmake.

Contributor

bhack commented Jan 11, 2015

@Nerei I'm not a window user but in past for other projects we have used MXE on Linux to cross compile dependencies. It integrates also well with Cmake.

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 11, 2015

@bhack Interesting. But cmake scripts are required to be written anyway. And this cross-compile tool uses mingw (gcc port to windows), and its output can't be used from Visual Studio, only from mingw.

Nerei commented Jan 11, 2015

@bhack Interesting. But cmake scripts are required to be written anyway. And this cross-compile tool uses mingw (gcc port to windows), and its output can't be used from Visual Studio, only from mingw.

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

@Nerei VS generators are a feature of cmake. FindScripts need to be written or copied by other BSD project for correct multiplatform support (ones that are not already distributed by Cmake). Mxe is only for building easly I.e. widows dependencies from Linux or easily compiling caffe for windows target in Linux with almost the actual infrastructure.

Contributor

bhack commented Jan 11, 2015

@Nerei VS generators are a feature of cmake. FindScripts need to be written or copied by other BSD project for correct multiplatform support (ones that are not already distributed by Cmake). Mxe is only for building easly I.e. widows dependencies from Linux or easily compiling caffe for windows target in Linux with almost the actual infrastructure.

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 11, 2015

Yes. you're completely right, you can compile caffe.exe from linux for windows and use the executable. there. But not cafe.lib to link into your Visual Studio application. The same with dependencies.

Nerei commented Jan 11, 2015

Yes. you're completely right, you can compile caffe.exe from linux for windows and use the executable. there. But not cafe.lib to link into your Visual Studio application. The same with dependencies.

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

Static library are directly supported in VS. Also dynamic ones are supported with some additional steps

Contributor

bhack commented Jan 11, 2015

Static library are directly supported in VS. Also dynamic ones are supported with some additional steps

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

You can see also VLC example

Contributor

bhack commented Jan 11, 2015

You can see also VLC example

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 11, 2015

For sure you're right. And my 9-th year experience of cross-platform OpenCV support doesn't help me to understand what can and what can't be done with mingw. At least I still think C API can and C++ can't.

Nerei commented Jan 11, 2015

For sure you're right. And my 9-th year experience of cross-platform OpenCV support doesn't help me to understand what can and what can't be done with mingw. At least I still think C API can and C++ can't.

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

@Nerei so your are from Itseez. Nice to know 😉

Contributor

bhack commented Jan 11, 2015

@Nerei so your are from Itseez. Nice to know 😉

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 11, 2015

Contributor

I'm sure that with all the opencv dependencies could be quite impractical.

Contributor

bhack commented Jan 11, 2015

I'm sure that with all the opencv dependencies could be quite impractical.

@shelhamer

This comment has been minimized.

Show comment
Hide comment
@shelhamer

shelhamer Jan 16, 2015

Member

@Nerei why does the CMake build crash on

[  2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_absval_layer.cu.o
/usr/local/include/opencv2/core/mat.hpp(117): error: type name is not allowed
/usr/local/include/opencv2/core/mat.hpp(117): error: identifier "_Atomic" is undefined
/usr/local/include/opencv2/core/mat.hpp(117): error: expected an expression
/usr/local/include/opencv2/core/mat.hpp(117): error: identifier "__c11_atomic_fetch_add" is undefined

while there is no issue with the Makefile build? I know you cited @bhack's patch but I installed on OS X 10.10 with OpenCV 2.4.9 with no issue with #1740.

p.s. the auto arch detection is nice for GPU code.

Member

shelhamer commented Jan 16, 2015

@Nerei why does the CMake build crash on

[  2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_absval_layer.cu.o
/usr/local/include/opencv2/core/mat.hpp(117): error: type name is not allowed
/usr/local/include/opencv2/core/mat.hpp(117): error: identifier "_Atomic" is undefined
/usr/local/include/opencv2/core/mat.hpp(117): error: expected an expression
/usr/local/include/opencv2/core/mat.hpp(117): error: identifier "__c11_atomic_fetch_add" is undefined

while there is no issue with the Makefile build? I know you cited @bhack's patch but I installed on OS X 10.10 with OpenCV 2.4.9 with no issue with #1740.

p.s. the auto arch detection is nice for GPU code.

@shelhamer

This comment has been minimized.

Show comment
Hide comment
@shelhamer

shelhamer Jan 16, 2015

Member

The Python dependencies should be aligned so that libraries and numpy matching the interpreter are chosen and not this:

-- Python:
--   Interpreter       :   /home/shelhamer/anaconda/bin/python2.7 (ver. 2.7.8)
--   Libraries         :   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6)

A good rule might be to pick the Python from the user's PATH and determine the libs from there. Often users will have multiple Pythons so picking matters.

Member

shelhamer commented Jan 16, 2015

The Python dependencies should be aligned so that libraries and numpy matching the interpreter are chosen and not this:

-- Python:
--   Interpreter       :   /home/shelhamer/anaconda/bin/python2.7 (ver. 2.7.8)
--   Libraries         :   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6)

A good rule might be to pick the Python from the user's PATH and determine the libs from there. Often users will have multiple Pythons so picking matters.

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 17, 2015

@shelhamer Good question :-) The answer is -DOSX wasn't added in cmake, while added in Makefile. It controlled OpenCV inclusion, but now it seems someone removed OpenCV from headers. At least after rebase, I can't reproduce the problem even if -DOSX is not defined.

FYI, It's better to use #if defined __APPLE__ rather than declare own define in build scripts.

Nerei commented Jan 17, 2015

@shelhamer Good question :-) The answer is -DOSX wasn't added in cmake, while added in Makefile. It controlled OpenCV inclusion, but now it seems someone removed OpenCV from headers. At least after rebase, I can't reproduce the problem even if -DOSX is not defined.

FYI, It's better to use #if defined __APPLE__ rather than declare own define in build scripts.

@bhack

This comment has been minimized.

Show comment
Hide comment
@bhack

bhack Jan 17, 2015

Contributor

@Nerei Was it removed with this merge #1236?

Contributor

bhack commented Jan 17, 2015

@Nerei Was it removed with this merge #1236?

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jan 17, 2015

@shelhamer Regarding the python issue, CMake always takes PythonInterp from PATH first, and after, if not found, searches in standard folders. While PythonLibs are always searched in some set of standard hint directories.

CMake doesn't know about your non-standard python installation. General rule (cmake standard) here is to specify all required paths manually in command line:

cmake <build_dir> -DPYTHON_EXECUTABLE=<..> -DPYTHON_LIBRARY=<..> -DPYTHON_INCLUDE_DIR=<..>

or in cmake-gui (cd build_dir && cmake-gui .) So this is not a bug, but well known feature, although agree, it may confuse beginners.

If several Python versions installed, current scripts by default search for 2.7, but user is free to specify 3.0 paths in the same way as for anaconda above. Thanks to cmake variable caching, this have to be done only once.

Perhaps, some kind of automation and checks can be added (say, if ANACONDA_PATH defined by user take everything from it instead of standard python search) but I would put it out of scope of this PR since well done solution require deep plunging into python search specifics on different platforms. Current solution is a bit dumb but universal. CMake summary log should help to catch issues.

Nerei commented Jan 17, 2015

@shelhamer Regarding the python issue, CMake always takes PythonInterp from PATH first, and after, if not found, searches in standard folders. While PythonLibs are always searched in some set of standard hint directories.

CMake doesn't know about your non-standard python installation. General rule (cmake standard) here is to specify all required paths manually in command line:

cmake <build_dir> -DPYTHON_EXECUTABLE=<..> -DPYTHON_LIBRARY=<..> -DPYTHON_INCLUDE_DIR=<..>

or in cmake-gui (cd build_dir && cmake-gui .) So this is not a bug, but well known feature, although agree, it may confuse beginners.

If several Python versions installed, current scripts by default search for 2.7, but user is free to specify 3.0 paths in the same way as for anaconda above. Thanks to cmake variable caching, this have to be done only once.

Perhaps, some kind of automation and checks can be added (say, if ANACONDA_PATH defined by user take everything from it instead of standard python search) but I would put it out of scope of this PR since well done solution require deep plunging into python search specifics on different platforms. Current solution is a bit dumb but universal. CMake summary log should help to catch issues.

@shelhamer

This comment has been minimized.

Show comment
Hide comment
@shelhamer

shelhamer Jan 17, 2015

Member

Thanks for the Python explanation in #1667 (comment). I agree it's fine as it is but there'll need to be a note in the installation instructions.

Member

shelhamer commented Jan 17, 2015

Thanks for the Python explanation in #1667 (comment). I agree it's fine as it is but there'll need to be a note in the installation instructions.

@baimin1

This comment has been minimized.

Show comment
Hide comment
@baimin1

baimin1 Jun 19, 2015

Could NOT find HDF5 (missing: HDF5_LIBRARIES), but i have install hdf5-1.8.14, and set the path
as:
PATH=$PATH:/usr/local/hdf5
PATH=$PATH:/data/home/tools_for_caffe/hdf5-1.8.14
and source, but still Could NOT find HDF5, anyone can help me?

baimin1 commented Jun 19, 2015

Could NOT find HDF5 (missing: HDF5_LIBRARIES), but i have install hdf5-1.8.14, and set the path
as:
PATH=$PATH:/usr/local/hdf5
PATH=$PATH:/data/home/tools_for_caffe/hdf5-1.8.14
and source, but still Could NOT find HDF5, anyone can help me?

@akosiorek

This comment has been minimized.

Show comment
Hide comment
@akosiorek

akosiorek Jun 19, 2015

Contributor

@baimin1 CMake uses Find*.cmake scripts for finding particular packages, in this case it's the FindHDF5.cmake script delivered with your CMake installation. It's best to look in this script which variables it does use to determine location of a given package. E.g. in my installation (3.22) it uses HDF5_ROOT variable, either enviornmental or specified with configuration as cmake -DHDF5_ROOT ....

Contributor

akosiorek commented Jun 19, 2015

@baimin1 CMake uses Find*.cmake scripts for finding particular packages, in this case it's the FindHDF5.cmake script delivered with your CMake installation. It's best to look in this script which variables it does use to determine location of a given package. E.g. in my installation (3.22) it uses HDF5_ROOT variable, either enviornmental or specified with configuration as cmake -DHDF5_ROOT ....

@flowirin

This comment has been minimized.

Show comment
Hide comment
@flowirin

flowirin Jul 9, 2015

c:>git clone git@github.com:BVLC/caffe.git.
Cloning into 'caffe.git.'...
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

i'm new to this. how do i fix this error?

flowirin commented Jul 9, 2015

c:>git clone git@github.com:BVLC/caffe.git.
Cloning into 'caffe.git.'...
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

i'm new to this. how do i fix this error?

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Jul 9, 2015

Add your public ssh key to your github account

Nerei commented Jul 9, 2015

Add your public ssh key to your github account

@achristensen56

This comment has been minimized.

Show comment
Hide comment
@achristensen56

achristensen56 Feb 15, 2016

Hi,
I'm trying to install Caffe with cmake on a macbookpro 2015 without a dedicated GPU. When I do:

cmake . -DBUILD_SHARED_LIB=ON -DCPU_ONLY=ON

I get the following output:

` cmake . -DBUILD_SHARED_LIB=ON -DCPU_ONLY=ON
-- Boost version: 1.57.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- Found gflags (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib)
-- Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)
-- Found PROTOBUF Compiler: /usr/local/bin/protoc
-- Found lmdb (include: /usr/local/include, library: /usr/local/lib/liblmdb.dylib)
-- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.dylib)
-- Found Snappy (include: /usr/local/include, library: /usr/local/lib/libsnappy.dylib)
-- -- CUDA is disabled. Building without it...
-- OpenCV found (/usr/local/share/OpenCV)
-- Found standalone vecLib.framework
-- NumPy ver. 1.10.1 found (include: /Users/ameliachristensen/anaconda2/lib/python2.7/site-packages/numpy/core/include)
-- Boost version: 1.57.0
-- Found the following Boost libraries:
-- python

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)

-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0-rc3
-- Git : unknown
-- System : Darwin
-- C++ compiler : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized

-- Build type : Release

-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : ON
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON

-- ALLOW_LMDB_NOLOCK : OFF

-- Dependencies:
-- BLAS : Yes (vecLib)
-- Boost : Yes (ver. 1.57)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 2.6.1)
-- lmdb : Yes (ver. 0.9.14)
-- LevelDB : Yes (ver. 1.18)
-- Snappy : Yes (ver. 1.1.3)
-- OpenCV : Yes (ver. 2.4.12)

-- CUDA : No

-- Python:
-- Interpreter : /Users/ameliachristensen/anaconda2/bin/python2.7 (ver. 2.7.11)
-- Libraries : /Users/ameliachristensen/anaconda2/lib/libpython2.7.dylib (ver 2.7.11)

-- NumPy : /Users/ameliachristensen/anaconda2/lib/python2.7/site-packages/numpy/core/include (ver 1.10.1)

-- Documentaion:
-- Doxygen : No

-- config_file :

-- Install:

-- Install path : /Users/ameliachristensen/Documents/caffe-master/install

-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

BUILD_SHARED_LIB

-- Build files have been written to: /Users/ameliachristensen/Documents/caffe-master`

however when I do:

make -j 4 && make install

The install fails on not finding the file 'cblas.h'... any hints?

achristensen56 commented Feb 15, 2016

Hi,
I'm trying to install Caffe with cmake on a macbookpro 2015 without a dedicated GPU. When I do:

cmake . -DBUILD_SHARED_LIB=ON -DCPU_ONLY=ON

I get the following output:

` cmake . -DBUILD_SHARED_LIB=ON -DCPU_ONLY=ON
-- Boost version: 1.57.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- Found gflags (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib)
-- Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)
-- Found PROTOBUF Compiler: /usr/local/bin/protoc
-- Found lmdb (include: /usr/local/include, library: /usr/local/lib/liblmdb.dylib)
-- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.dylib)
-- Found Snappy (include: /usr/local/include, library: /usr/local/lib/libsnappy.dylib)
-- -- CUDA is disabled. Building without it...
-- OpenCV found (/usr/local/share/OpenCV)
-- Found standalone vecLib.framework
-- NumPy ver. 1.10.1 found (include: /Users/ameliachristensen/anaconda2/lib/python2.7/site-packages/numpy/core/include)
-- Boost version: 1.57.0
-- Found the following Boost libraries:
-- python

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)

-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0-rc3
-- Git : unknown
-- System : Darwin
-- C++ compiler : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized

-- Build type : Release

-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : ON
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON

-- ALLOW_LMDB_NOLOCK : OFF

-- Dependencies:
-- BLAS : Yes (vecLib)
-- Boost : Yes (ver. 1.57)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 2.6.1)
-- lmdb : Yes (ver. 0.9.14)
-- LevelDB : Yes (ver. 1.18)
-- Snappy : Yes (ver. 1.1.3)
-- OpenCV : Yes (ver. 2.4.12)

-- CUDA : No

-- Python:
-- Interpreter : /Users/ameliachristensen/anaconda2/bin/python2.7 (ver. 2.7.11)
-- Libraries : /Users/ameliachristensen/anaconda2/lib/libpython2.7.dylib (ver 2.7.11)

-- NumPy : /Users/ameliachristensen/anaconda2/lib/python2.7/site-packages/numpy/core/include (ver 1.10.1)

-- Documentaion:
-- Doxygen : No

-- config_file :

-- Install:

-- Install path : /Users/ameliachristensen/Documents/caffe-master/install

-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

BUILD_SHARED_LIB

-- Build files have been written to: /Users/ameliachristensen/Documents/caffe-master`

however when I do:

make -j 4 && make install

The install fails on not finding the file 'cblas.h'... any hints?

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Feb 15, 2016

Without debugging no idea why install requires cblas.h

p.s. BUILD_SHARED_LIBS (should end with s)

Nerei commented Feb 15, 2016

Without debugging no idea why install requires cblas.h

p.s. BUILD_SHARED_LIBS (should end with s)

@dafukua

This comment has been minimized.

Show comment
Hide comment
@dafukua

dafukua Apr 20, 2016

Thanks for the tutorial. I'm able to import Caffe using CMake in my own project. But I still cannot figure out how the system finds Caffe through find_package(Caffe) without setting Caffe_DIR in the CMakeLists.txt in my own project.

I've searched a lot about that but haven't found any answer yet.. Any comments will be very much appreciated!

dafukua commented Apr 20, 2016

Thanks for the tutorial. I'm able to import Caffe using CMake in my own project. But I still cannot figure out how the system finds Caffe through find_package(Caffe) without setting Caffe_DIR in the CMakeLists.txt in my own project.

I've searched a lot about that but haven't found any answer yet.. Any comments will be very much appreciated!

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei Apr 20, 2016

You have to set Caffe_DIR. Just pass it once as CMake parameter. Future cmake runs don't require passing it again sine it will be cached.

cmake -DCaffe_DIR=<...>  ...

Nerei commented Apr 20, 2016

You have to set Caffe_DIR. Just pass it once as CMake parameter. Future cmake runs don't require passing it again sine it will be cached.

cmake -DCaffe_DIR=<...>  ...
@dafukua

This comment has been minimized.

Show comment
Hide comment
@dafukua

dafukua Apr 20, 2016

@Nerei, for my case, I didn't set Caffe_DIR (I just did cmake ..). After CMake compilation, Caffe can be successfully found in my own project via find_package(Caffe). I tried to look into the compilation related files, but haven't found any clue about how the system can find Caffe.

dafukua commented Apr 20, 2016

@Nerei, for my case, I didn't set Caffe_DIR (I just did cmake ..). After CMake compilation, Caffe can be successfully found in my own project via find_package(Caffe). I tried to look into the compilation related files, but haven't found any clue about how the system can find Caffe.

@InfiniteLifeH

This comment has been minimized.

Show comment
Hide comment
@InfiniteLifeH

InfiniteLifeH May 23, 2016

Hello.
Trying to use Caffe C++ API in my project with Visual Studio, Windows. I have build Caffe sucsesfully according to WIndows installation guide.
Can someone advise how to include Caffe to my project? I'm new to Cmake, so I tried to do following, may be something naive - created CMakeLists.txt with

> cmake_minimum_required(VERSION 2.8.8)
> 
> find_package(Caffe)
> include_directories(${Caffe_INCLUDE_DIRS})
> add_definitions(${Caffe_DEFINITIONS})    # ex. -DCPU_ONLY
> 
> add_executable(caffeinated_application main.cpp)
> target_link_libraries(caffeinated_application ${Caffe_LIBRARIES})

and have set Caffe_DIR to root path to Caffe project. But after every Configure try, Cmake says that it's not able to find Caffe package, and value of Caffe_DIR gets replaces by "NOT_FOUND"

InfiniteLifeH commented May 23, 2016

Hello.
Trying to use Caffe C++ API in my project with Visual Studio, Windows. I have build Caffe sucsesfully according to WIndows installation guide.
Can someone advise how to include Caffe to my project? I'm new to Cmake, so I tried to do following, may be something naive - created CMakeLists.txt with

> cmake_minimum_required(VERSION 2.8.8)
> 
> find_package(Caffe)
> include_directories(${Caffe_INCLUDE_DIRS})
> add_definitions(${Caffe_DEFINITIONS})    # ex. -DCPU_ONLY
> 
> add_executable(caffeinated_application main.cpp)
> target_link_libraries(caffeinated_application ${Caffe_LIBRARIES})

and have set Caffe_DIR to root path to Caffe project. But after every Configure try, Cmake says that it's not able to find Caffe package, and value of Caffe_DIR gets replaces by "NOT_FOUND"

@Nerei

This comment has been minimized.

Show comment
Hide comment
@Nerei

Nerei May 23, 2016

Please ask on caffe forums. Actually you should set Caffe_DIR to caffe build directory, not source one.

Nerei commented May 23, 2016

Please ask on caffe forums. Actually you should set Caffe_DIR to caffe build directory, not source one.

@nineilpitt

This comment has been minimized.

Show comment
Hide comment
@nineilpitt

nineilpitt May 25, 2016

Hi all,

I have installed caffe and have tested with a mnist script. That one is working, also with the gpu :)

Now, I am trying to work with the matlab interface. I am testing with the basic demo from CAFFE_FOLDER/matlab/demo

However, I am getting the error:

[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.5.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)

I have verified that I have the proto version 3.00 in my path with 'protoc --version' in console and also in matlab with unix('protoc --version') and I am getting version 3.00. However, still has the previous error.

Any suggestions ?

Thanks.

nineilpitt commented May 25, 2016

Hi all,

I have installed caffe and have tested with a mnist script. That one is working, also with the gpu :)

Now, I am trying to work with the matlab interface. I am testing with the basic demo from CAFFE_FOLDER/matlab/demo

However, I am getting the error:

[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.5.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)

I have verified that I have the proto version 3.00 in my path with 'protoc --version' in console and also in matlab with unix('protoc --version') and I am getting version 3.00. However, still has the previous error.

Any suggestions ?

Thanks.

@moumitaTora

This comment has been minimized.

Show comment
Hide comment
@moumitaTora

moumitaTora Jun 18, 2016

I am continuously getting this error while trying to install Caffe using CMake:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libglog.so: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const_, char const_, char const_, char const_, void_, void_)'

Please help!

moumitaTora commented Jun 18, 2016

I am continuously getting this error while trying to install Caffe using CMake:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libglog.so: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const_, char const_, char const_, char const_, void_, void_)'

Please help!

@ssamira

This comment has been minimized.

Show comment
Hide comment
@ssamira

ssamira Jul 4, 2016

Hello,

I am trying to use Caffe API in my project in visual studio but I have the same issue as @InfiniteLifeH has, @Nerei I set Caffe_DIR to build and still have the problem. I am getting this warning in Cmake :

CMake Warning at (find_package):
By not providing "FindCaffe.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Caffe", but
CMake did not find one.

Could not find a package configuration file provided by "Caffe" with any of
the following names:

CaffeConfig.cmake
caffe-config.cmake

Add the installation prefix of "Caffe" to CMAKE_PREFIX_PATH or set
"Caffe_DIR" to a directory containing one of the above files. If "Caffe"
provides a separate development package or SDK, be sure it has been
installed.
Any suggestions?

Thanks,

ssamira commented Jul 4, 2016

Hello,

I am trying to use Caffe API in my project in visual studio but I have the same issue as @InfiniteLifeH has, @Nerei I set Caffe_DIR to build and still have the problem. I am getting this warning in Cmake :

CMake Warning at (find_package):
By not providing "FindCaffe.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Caffe", but
CMake did not find one.

Could not find a package configuration file provided by "Caffe" with any of
the following names:

CaffeConfig.cmake
caffe-config.cmake

Add the installation prefix of "Caffe" to CMAKE_PREFIX_PATH or set
"Caffe_DIR" to a directory containing one of the above files. If "Caffe"
provides a separate development package or SDK, be sure it has been
installed.
Any suggestions?

Thanks,

@cervantes-loves-ai

This comment has been minimized.

Show comment
Hide comment
@cervantes-loves-ai

cervantes-loves-ai Jul 15, 2016

hi, can anyone help me for this error?

[----------] 2 tests from BatchReindexLayerTest/1, where TypeParam = caffe::CPUDevice
[ RUN ] BatchReindexLayerTest/1.TestForward
[ OK ] BatchReindexLayerTest/1.TestForward (0 ms)
[ RUN ] BatchReindexLayerTest/1.TestGradient
[ OK ] BatchReindexLayerTest/1.TestGradient (87 ms)
[----------] 2 tests from BatchReindexLayerTest/1 (87 ms total)

[----------] 5 tests from ImageDataLayerTest/1, where TypeParam = caffe::CPUDevice
[ RUN ] ImageDataLayerTest/1.TestReshape
[ OK ] ImageDataLayerTest/1.TestReshape (46 ms)
[ RUN ] ImageDataLayerTest/1.TestShuffle
[ OK ] ImageDataLayerTest/1.TestShuffle (106 ms)
[ RUN ] ImageDataLayerTest/1.TestRead
[ OK ] ImageDataLayerTest/1.TestRead (103 ms)
[ RUN ] ImageDataLayerTest/1.TestResize
[ OK ] ImageDataLayerTest/1.TestResize (122 ms)
[ RUN ] ImageDataLayerTest/1.TestSpace
[ OK ] ImageDataLayerTest/1.TestSpace (63 ms)
[----------] 5 tests from ImageDataLayerTest/1 (440 ms total)

[----------] Global test environment tear-down
[==========] 1096 tests from 150 test cases ran. (68513 ms total)
[ PASSED ] 1095 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] NeuronLayerTest/0.TestPReLUForward, where TypeParam = caffe::CPUDevice

1 FAILED TEST
make[3]: *** [src/caffe/test/CMakeFiles/runtest] Error 1
make[2]: *** [src/caffe/test/CMakeFiles/runtest.dir/all] Error 2
make[1]: *** [src/caffe/test/CMakeFiles/runtest.dir/rule] Error 2
make: *** [runtest] Error 2

cervantes-loves-ai commented Jul 15, 2016

hi, can anyone help me for this error?

[----------] 2 tests from BatchReindexLayerTest/1, where TypeParam = caffe::CPUDevice
[ RUN ] BatchReindexLayerTest/1.TestForward
[ OK ] BatchReindexLayerTest/1.TestForward (0 ms)
[ RUN ] BatchReindexLayerTest/1.TestGradient
[ OK ] BatchReindexLayerTest/1.TestGradient (87 ms)
[----------] 2 tests from BatchReindexLayerTest/1 (87 ms total)

[----------] 5 tests from ImageDataLayerTest/1, where TypeParam = caffe::CPUDevice
[ RUN ] ImageDataLayerTest/1.TestReshape
[ OK ] ImageDataLayerTest/1.TestReshape (46 ms)
[ RUN ] ImageDataLayerTest/1.TestShuffle
[ OK ] ImageDataLayerTest/1.TestShuffle (106 ms)
[ RUN ] ImageDataLayerTest/1.TestRead
[ OK ] ImageDataLayerTest/1.TestRead (103 ms)
[ RUN ] ImageDataLayerTest/1.TestResize
[ OK ] ImageDataLayerTest/1.TestResize (122 ms)
[ RUN ] ImageDataLayerTest/1.TestSpace
[ OK ] ImageDataLayerTest/1.TestSpace (63 ms)
[----------] 5 tests from ImageDataLayerTest/1 (440 ms total)

[----------] Global test environment tear-down
[==========] 1096 tests from 150 test cases ran. (68513 ms total)
[ PASSED ] 1095 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] NeuronLayerTest/0.TestPReLUForward, where TypeParam = caffe::CPUDevice

1 FAILED TEST
make[3]: *** [src/caffe/test/CMakeFiles/runtest] Error 1
make[2]: *** [src/caffe/test/CMakeFiles/runtest.dir/all] Error 2
make[1]: *** [src/caffe/test/CMakeFiles/runtest.dir/rule] Error 2
make: *** [runtest] Error 2

@riteshpradhan

This comment has been minimized.

Show comment
Hide comment
@riteshpradhan

riteshpradhan Jul 28, 2016

make symlink
make: *** No rule to make targetsymlink'. Stop.`

it's not working.

riteshpradhan commented Jul 28, 2016

make symlink
make: *** No rule to make targetsymlink'. Stop.`

it's not working.

@PingHGao

This comment has been minimized.

Show comment
Hide comment
@PingHGao

PingHGao Oct 5, 2016

i run into this problem:

[ 88%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layer.cpp.o
Linking CXX shared library ../../lib/libcaffe-d.so
/usr/bin/ld: /usr/local/lib/libcblas.a(cblas_sgemv.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcblas.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcaffe-d.so.1.0.0-rc3] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

any idea? thanks a lot ^_^

PingHGao commented Oct 5, 2016

i run into this problem:

[ 88%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layer.cpp.o
Linking CXX shared library ../../lib/libcaffe-d.so
/usr/bin/ld: /usr/local/lib/libcblas.a(cblas_sgemv.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcblas.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcaffe-d.so.1.0.0-rc3] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

any idea? thanks a lot ^_^

@flowirin

This comment has been minimized.

Show comment
Hide comment
@flowirin

flowirin Oct 5, 2016

try compiling with -fPIC ?

flow ir in

On 5 October 2016 at 14:09, EmpireofQin notifications@github.com wrote:

i run into this problem:

[ 88%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layer.cpp.o
Linking CXX shared library ../../lib/libcaffe-d.so
/usr/bin/ld: /usr/local/lib/libcblas.a(cblas_sgemv.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcblas.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcaffe-d.so.1.0.0-rc3] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

any idea? thanks a lot ^_^


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1667 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMnuraAjwwK-tenDParQaW62SaK6K9SDks5qwvjOgaJpZM4DNzQk
.

flowirin commented Oct 5, 2016

try compiling with -fPIC ?

flow ir in

On 5 October 2016 at 14:09, EmpireofQin notifications@github.com wrote:

i run into this problem:

[ 88%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layer.cpp.o
Linking CXX shared library ../../lib/libcaffe-d.so
/usr/bin/ld: /usr/local/lib/libcblas.a(cblas_sgemv.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcblas.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcaffe-d.so.1.0.0-rc3] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

any idea? thanks a lot ^_^


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1667 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMnuraAjwwK-tenDParQaW62SaK6K9SDks5qwvjOgaJpZM4DNzQk
.

@PingHGao

This comment has been minimized.

Show comment
Hide comment
@PingHGao

PingHGao Oct 7, 2016

I have tried this, but dosen't work

PingHGao commented Oct 7, 2016

I have tried this, but dosen't work

@flowirin

This comment has been minimized.

Show comment
Hide comment
@flowirin

flowirin Oct 7, 2016

what is the error?

flow ir in

On 7 October 2016 at 14:21, EmpireofQin notifications@github.com wrote:

I have tried this, but dosen't work


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1667 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMnurS7qJtoWVIRYoxcLhnEwHTZbCMnMks5qxZ6KgaJpZM4DNzQk
.

flowirin commented Oct 7, 2016

what is the error?

flow ir in

On 7 October 2016 at 14:21, EmpireofQin notifications@github.com wrote:

I have tried this, but dosen't work


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1667 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMnurS7qJtoWVIRYoxcLhnEwHTZbCMnMks5qxZ6KgaJpZM4DNzQk
.

@PingHGao

This comment has been minimized.

Show comment
Hide comment
@PingHGao

PingHGao Oct 7, 2016

I have solved this problem. I tried to edit CMakeCache.txt in the build file and changed

//Path to a library.
Atlas_CBLAS_LIBRARY:FILEPATH=<path to libcblas.a>

into

//Path to a library.
Atlas_CBLAS_LIBRARY:FILEPATH=/usr/lib/libcblas.so //<path to libcblas.so in my machine>

and it works.
i suppose it is because i have tried to install atlas things to many times LOL
thanks a lot @flowirin

PingHGao commented Oct 7, 2016

I have solved this problem. I tried to edit CMakeCache.txt in the build file and changed

//Path to a library.
Atlas_CBLAS_LIBRARY:FILEPATH=<path to libcblas.a>

into

//Path to a library.
Atlas_CBLAS_LIBRARY:FILEPATH=/usr/lib/libcblas.so //<path to libcblas.so in my machine>

and it works.
i suppose it is because i have tried to install atlas things to many times LOL
thanks a lot @flowirin

@YinHT2016

This comment has been minimized.

Show comment
Hide comment
@YinHT2016

YinHT2016 Oct 9, 2016

@riteshpradh
hi,I met the same question as yours,could you share the solution?thanks a lot.
my email is 714789880@qq.com

YinHT2016 commented Oct 9, 2016

@riteshpradh
hi,I met the same question as yours,could you share the solution?thanks a lot.
my email is 714789880@qq.com

@YinHT2016

This comment has been minimized.

Show comment
Hide comment
@YinHT2016

YinHT2016 Oct 9, 2016

@longjon
hi,there is a question I met:
make symlink
make: *** No rule to make targetsymlink'. Stop.`
I am lack of experience on the CMake and Linux ,could you tell me what shoud I do ?
Thanks a lot.

YinHT2016 commented Oct 9, 2016

@longjon
hi,there is a question I met:
make symlink
make: *** No rule to make targetsymlink'. Stop.`
I am lack of experience on the CMake and Linux ,could you tell me what shoud I do ?
Thanks a lot.

@PingHGao

This comment has been minimized.

Show comment
Hide comment
@PingHGao

PingHGao Oct 31, 2016

Hi, I have error like this:

CMake Error at CMakeLists.txt:83 (add_dependencies):
  The dependency target "pycaffe" of target "pytest" does not exist.

I can still do next steps to finish compiling. What should I do to solve this error?
Hoping to get help, thanks a lot! ^_^

PingHGao commented Oct 31, 2016

Hi, I have error like this:

CMake Error at CMakeLists.txt:83 (add_dependencies):
  The dependency target "pycaffe" of target "pytest" does not exist.

I can still do next steps to finish compiling. What should I do to solve this error?
Hoping to get help, thanks a lot! ^_^

@viscropst

This comment has been minimized.

Show comment
Hide comment
@viscropst

viscropst Jan 22, 2017

Who can tell me how to use intel mkl to compile caffe with cmake????

viscropst commented Jan 22, 2017

Who can tell me how to use intel mkl to compile caffe with cmake????

@seeocean2000

This comment has been minimized.

Show comment
Hide comment
@seeocean2000

seeocean2000 Mar 3, 2017

@viscropst In case you are still wondering, to build w/ Intel MLK, you can do the following:
cmake -DBLAS=MLK ..
I haven't tried MLK specifically, but BLAS=Open works for me (for OpenBLAS). Take a look at the file cmake/Dependencies.cmake.

seeocean2000 commented Mar 3, 2017

@viscropst In case you are still wondering, to build w/ Intel MLK, you can do the following:
cmake -DBLAS=MLK ..
I haven't tried MLK specifically, but BLAS=Open works for me (for OpenBLAS). Take a look at the file cmake/Dependencies.cmake.

@toniiism

This comment has been minimized.

Show comment
Hide comment
@toniiism

toniiism Mar 15, 2017

Compilation crushed on the following errors. Can anyone help?
I am now compiling within fast-rcnn subdirectory

CXX/LD -o .build_release/tools/extract_features.bin
.build_release/lib/libcaffe.so: undefined reference to mdb_txn_begin' .build_release/lib/libcaffe.so: undefined reference tomdb_cursor_get'
.build_release/lib/libcaffe.so: undefined reference to mdb_cursor_close' .build_release/lib/libcaffe.so: undefined reference tomdb_put'
.build_release/lib/libcaffe.so: undefined reference to leveldb::WriteBatch::WriteBatch()' .build_release/lib/libcaffe.so: undefined reference tomdb_txn_abort'
.build_release/lib/libcaffe.so: undefined reference to mdb_strerror' .build_release/lib/libcaffe.so: undefined reference tomdb_txn_commit'
.build_release/lib/libcaffe.so: undefined reference to mdb_env_open' .build_release/lib/libcaffe.so: undefined reference tomdb_cursor_open'
.build_release/lib/libcaffe.so: undefined reference to mdb_env_set_mapsize' .build_release/lib/libcaffe.so: undefined reference tomdb_dbi_close'
.build_release/lib/libcaffe.so: undefined reference to leveldb::Status::ToString[abi:cxx11]() const' .build_release/lib/libcaffe.so: undefined reference tomdb_env_create'
.build_release/lib/libcaffe.so: undefined reference to leveldb::WriteBatch::~WriteBatch()' .build_release/lib/libcaffe.so: undefined reference toleveldb::Options::Options()'
.build_release/lib/libcaffe.so: undefined reference to mdb_env_close' .build_release/lib/libcaffe.so: undefined reference toleveldb::DB::Open(leveldb::Options const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, leveldb::DB**)'
.build_release/lib/libcaffe.so: undefined reference to mdb_dbi_open' .build_release/lib/libcaffe.so: undefined reference toleveldb::WriteBatch::Put(leveldb::Slice const&, leveldb::Slice const&)'
collect2: error: ld returned 1 exit status
makefile:547: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1

toniiism commented Mar 15, 2017

Compilation crushed on the following errors. Can anyone help?
I am now compiling within fast-rcnn subdirectory

CXX/LD -o .build_release/tools/extract_features.bin
.build_release/lib/libcaffe.so: undefined reference to mdb_txn_begin' .build_release/lib/libcaffe.so: undefined reference tomdb_cursor_get'
.build_release/lib/libcaffe.so: undefined reference to mdb_cursor_close' .build_release/lib/libcaffe.so: undefined reference tomdb_put'
.build_release/lib/libcaffe.so: undefined reference to leveldb::WriteBatch::WriteBatch()' .build_release/lib/libcaffe.so: undefined reference tomdb_txn_abort'
.build_release/lib/libcaffe.so: undefined reference to mdb_strerror' .build_release/lib/libcaffe.so: undefined reference tomdb_txn_commit'
.build_release/lib/libcaffe.so: undefined reference to mdb_env_open' .build_release/lib/libcaffe.so: undefined reference tomdb_cursor_open'
.build_release/lib/libcaffe.so: undefined reference to mdb_env_set_mapsize' .build_release/lib/libcaffe.so: undefined reference tomdb_dbi_close'
.build_release/lib/libcaffe.so: undefined reference to leveldb::Status::ToString[abi:cxx11]() const' .build_release/lib/libcaffe.so: undefined reference tomdb_env_create'
.build_release/lib/libcaffe.so: undefined reference to leveldb::WriteBatch::~WriteBatch()' .build_release/lib/libcaffe.so: undefined reference toleveldb::Options::Options()'
.build_release/lib/libcaffe.so: undefined reference to mdb_env_close' .build_release/lib/libcaffe.so: undefined reference toleveldb::DB::Open(leveldb::Options const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, leveldb::DB**)'
.build_release/lib/libcaffe.so: undefined reference to mdb_dbi_open' .build_release/lib/libcaffe.so: undefined reference toleveldb::WriteBatch::Put(leveldb::Slice const&, leveldb::Slice const&)'
collect2: error: ld returned 1 exit status
makefile:547: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1

@389148742

This comment has been minimized.

Show comment
Hide comment
@389148742

389148742 Mar 29, 2017

can anyone help me with this problem when I "make runtest"?

[----------] Global test environment tear-down
[==========] 1104 tests from 150 test cases ran. (130644 ms total)
[ PASSED ] 1103 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] NeuronLayerTest/0.TestPReLUForward, where TypeParam = caffe::CPUDevice

1 FAILED TEST
src/caffe/test/CMakeFiles/runtest.dir/build.make:57: recipe for target 'src/caffe/test/CMakeFiles/runtest' failed
make[3]: *** [src/caffe/test/CMakeFiles/runtest] Error 1
CMakeFiles/Makefile2:362: recipe for target 'src/caffe/test/CMakeFiles/runtest.dir/all' failed
make[2]: *** [src/caffe/test/CMakeFiles/runtest.dir/all] Error 2
CMakeFiles/Makefile2:369: recipe for target 'src/caffe/test/CMakeFiles/runtest.dir/rule' failed
make[1]: *** [src/caffe/test/CMakeFiles/runtest.dir/rule] Error 2
Makefile:253: recipe for target 'runtest' failed
make: *** [runtest] Error 2

389148742 commented Mar 29, 2017

can anyone help me with this problem when I "make runtest"?

[----------] Global test environment tear-down
[==========] 1104 tests from 150 test cases ran. (130644 ms total)
[ PASSED ] 1103 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] NeuronLayerTest/0.TestPReLUForward, where TypeParam = caffe::CPUDevice

1 FAILED TEST
src/caffe/test/CMakeFiles/runtest.dir/build.make:57: recipe for target 'src/caffe/test/CMakeFiles/runtest' failed
make[3]: *** [src/caffe/test/CMakeFiles/runtest] Error 1
CMakeFiles/Makefile2:362: recipe for target 'src/caffe/test/CMakeFiles/runtest.dir/all' failed
make[2]: *** [src/caffe/test/CMakeFiles/runtest.dir/all] Error 2
CMakeFiles/Makefile2:369: recipe for target 'src/caffe/test/CMakeFiles/runtest.dir/rule' failed
make[1]: *** [src/caffe/test/CMakeFiles/runtest.dir/rule] Error 2
Makefile:253: recipe for target 'runtest' failed
make: *** [runtest] Error 2

@Soda-Wong

This comment has been minimized.

Show comment
Hide comment
@Soda-Wong

Soda-Wong Jul 25, 2017

@InfiniteLifeH have you succeed in windows?

Soda-Wong commented Jul 25, 2017

@InfiniteLifeH have you succeed in windows?

@atenpas atenpas referenced this pull request Sep 18, 2017

Closed

Caffe_DIR in CMakeLists.txt #13

@fengfan028

This comment has been minimized.

Show comment
Hide comment
@fengfan028

fengfan028 Sep 24, 2017

Can anyone help me with this problem when I "make install"? Thanks a lot.

CMake Error at python/cmake_install.cmake:59 (file):
file RPATH_CHANGE could not write new RPATH:

/home/lab302/caffe/cmake_build/install/lib:/usr/local/cuda-8.0/lib64:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib:/home/lab302/opencv-3.1.0/release/lib

to the file:

/home/lab302/caffe/cmake_build/install/python/caffe/_caffe.so

The current RPATH is:

$ORIGIN/../../build/lib

which does not contain:

/usr/local/cuda-8.0/lib64:/home/lab302/caffe/cmake_build/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib:/home/lab302/opencv-3.1.0/release/lib::::::::

as was expected.
Call Stack (most recent call first):
cmake_install.cmake:64 (include)

Makefile:61: recipe for target 'install' failed
make: *** [install] Error 1

fengfan028 commented Sep 24, 2017

Can anyone help me with this problem when I "make install"? Thanks a lot.

CMake Error at python/cmake_install.cmake:59 (file):
file RPATH_CHANGE could not write new RPATH:

/home/lab302/caffe/cmake_build/install/lib:/usr/local/cuda-8.0/lib64:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib:/home/lab302/opencv-3.1.0/release/lib

to the file:

/home/lab302/caffe/cmake_build/install/python/caffe/_caffe.so

The current RPATH is:

$ORIGIN/../../build/lib

which does not contain:

/usr/local/cuda-8.0/lib64:/home/lab302/caffe/cmake_build/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib:/home/lab302/opencv-3.1.0/release/lib::::::::

as was expected.
Call Stack (most recent call first):
cmake_install.cmake:64 (include)

Makefile:61: recipe for target 'install' failed
make: *** [install] Error 1

@EgorAntonovich

This comment has been minimized.

Show comment
Hide comment
@EgorAntonovich

EgorAntonovich Nov 14, 2017

how can i change CPU_ONLY :OFF to CPU_ONLY:ON before make cmake.. ???

EgorAntonovich commented Nov 14, 2017

how can i change CPU_ONLY :OFF to CPU_ONLY:ON before make cmake.. ???

@seeocean2000

This comment has been minimized.

Show comment
Hide comment
@seeocean2000

seeocean2000 Nov 14, 2017

seeocean2000 commented Nov 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment