-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
CMake build system #442
CMake build system #442
Conversation
@@ -153,7 +153,7 @@ else ifeq ($(UNAME), Darwin) | |||
endif | |||
|
|||
ifeq ($(LINUX), 1) | |||
CXX := /usr/bin/g++ | |||
CXX := /usr/bin/g++-4.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all users use the same version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solved in df2322c
This is a great PR. @akosiorek, thank you very much! Besides the line notes, I am curious about a few more questions.
Also, please consider organizing the CMake scripts in platform specific directories as OpenCV does. |
For now there aren't any platform specific scripts. I've got a few question, too. |
Just hub checkouted and tried this on Ubuntu 14.04. I guess that the out-of-source building problem is because that the CMakeLists.txt is not in the top level directory as often seen in projects built by CMake. The default BLAS option Atlas was found correctly and the objects files were compiled successfully but libcaffe.so was not generated. The script src/CMakeScripts/FindOpenBLAS.cmake |
You have to specify -DBUILD_SHARED_LIBS=ON at configuration to get libcaffe.so. A static library is built otherwise. I'll work on all your comments and try to solve the issues next week (from tuesday on I guess) |
After adding the flag, building failed with the errors:
|
I've got the same error with BUILD_SHARED_LIBS=ON. I'll try to address it. In the meantime, I restored gtest dir to contain only the 3 original source files in 3de9118. As of 6073ff0, manual file listing is no longer necessary. There is a catch, however. After adding a file CMake has no way of knowing that any file was added and will not include it in the next build. You have to "touch" a CMakeLists.txt file in order to refresh it. By touching I mean adding and deleting an empty space for instance. From file section in CMake documentation:
|
As for the OpenBLAS: I'll try on other workstations later, but for now I can't nail the problem |
I restored original source tree structure in 23a0cea. Both CMake and Makefile build systems now work. Git does not complain about generated header files anymore. I'm afraid I can't work on Matlab build, nor the Intel MKL find scripts. We're not using them here and I'm running out of time. EDIT: |
rebased |
@akosiorek, your expertise in CMake is really amazing, thanks again! I have tested four flag combinations Just as a minor reminder, when building with atlas
With The output of the Some of the original files are still mixed after rebase. If you clean them up, I think this PR will be ready to be reviewed by others. |
*rebase required moving some files around *I've made a mistake with generated file extension in cmake; corrected
*makefile can now deal with changed include in caffe_pretty_print *added dependencies in CMake
@kloudkl I'm on it. Edit: Conflicts resolved. |
I've tested on Debian testing and works for me. We need to choice if we want default BUILD_SHARED_LIBS=off or BUILD_SHARED_LIBS=on |
@@ -0,0 +1,79 @@ | |||
# Copyright: (C) 2010 RobotCub Consortium | |||
# Authors: Arjan Gijsberts | |||
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is inclusion of an LGPL source file a concern here? I'd think this would not be compatible with the BSD license, but I'm not an expert in these things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a concern, but I believe replacing this script with BSD code is on
the PR authors' TODO list.
All licensing must be BSD-compatible for merge.
On Wed, Jun 25, 2014 at 6:07 AM, Rob Hess notifications@github.com wrote:
In CMakeScripts/FindAtlas.cmake:
@@ -0,0 +1,79 @@
+# Copyright: (C) 2010 RobotCub Consortium
+# Authors: Arjan Gijsberts
+# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXTIs inclusion of an LGPL source file a concern here? I'd think this would
not be compatible with the BSD license, but I'm not an expert in these
things.—
Reply to this email directly or view it on GitHub
https://github.com/BVLC/caffe/pull/442/files#r14158833.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the default FindBlas distributed with cmake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably tools must be installed in /usr/local/bin and set_target_properties needs also caffe_cu and ../src/caffe/proto/libproto.so |
Gods of the write access, we beseach you. Please merge! I need CMake for support in my IDE. |
Ok, I took a look at this. (I'll reiterate that I know absolutely nothing about CMake.) I tried following the instructions currently in the OP on this thread from @akosiorek:
Is the
Apparently I have boost 1.46...this should probably be allowed as it's apparently the version that Ubuntu installs by default. So I did:
And then changed the
I then do
It seems like it may have not located CUDA correctly? Since there is demand for this and presumably it's working for somebody, I've pushed it (with my one change of Boost 1.49 requirement to Boost 1.46) to a branch in the BVLC repo for easier checkout. I tried to rebase on the latest dev, but I ran into many problems -- many example files have been deleted, and there seem to be EOL whitespace issues all over the place that git complains about:
The trailing whitespace issues should be fixed. The first merge conflict in Makefile is requiring g++ exactly 4.6:
I don't know about this...why would we not want to support future versions of GCC? Anyway, I accept the modification for now with
Huh...any idea what's going on here? Why are the examples being removed? |
@jeffdonahue Thanks for trying it out.
Are you sure you are working with the newest version? There shouldn't be any merge conflicts as indicated by |
(3.) Is related by cuda version found by cmake. Every cuda release_notes give you an hint of supported gcc versions. |
@bhack I tried the FindBLAS.cmake in the first place but it didn't work for me. I'd be great if you could make it work, but I find it easier to use the scripts. |
@akosiorek I've tested now.. works for me on debian testing with debian openblas offical package using find_package(BLAS REQUIRED). What problem did you have when you have tested? |
@bhack
|
@akosiorek I think you have still this problem because on saucy (and Mint 16) blas libraries file was still under named subdirectory as you can see (i've tested on ubuntu 14.04 LTS and works fine like in debian): |
@bhack I see. But isn't the script supposed to work on Mint as well? What do you suggest? Mint is my OS of choice and I need Caffe to be compatible with it. |
@akosiorek Can you try this on Mint? |
@bhack I have Atlas located under /usr/lib/atlas and /usr/include/atlas. I've tried setting the prefix path to both atlas and atlas-base and vendor to ATLAS and atlas; None worked. EDIT: |
@akosiorek It is strange but i have no other platform to test other then debian testing and ubuntu 14.04 EDIT: |
I created a cleaned version of this PR in 'CMake build system - cleaned' or #573. Please continue the discussion under the new PR. |
CMake build system for Caffe as suggest in #215
Changes:
Changed source tree in order to facilitate out-of-source buildBuilding tips:
(Not sure if
CC=gcc-4.6
is neccesary, but no other version works for me)Options are specified at cmake invokation with -D flag. Example: -DPYTHON=ON
PYTHONBUILD_PYTHON [default OFF]MATLABBUILD_MATLAB [default OFF]EXAMPLESBUILD_EXAMPLES [default ON]TOOLS [ON]Not anymore, tools are built by defualtRemarks:
Have yet to figure out why tools require recompilation of Blob.cpp