Skip to content
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

cp problem #32

Closed
chaowyc opened this issue Nov 21, 2017 · 6 comments
Closed

cp problem #32

chaowyc opened this issue Nov 21, 2017 · 6 comments

Comments

@chaowyc
Copy link

chaowyc commented Nov 21, 2017

hi, I face a problem while I compile the newest version project.

cp: cannot copy a directory, '/home/chaowyc/tensorflow_cc/tensorflow_cc/build/tensorflow/tensorflow/co
ntrib/makefile/gen/protobuf', into itself, './tensorflow/contrib/makefile/gen/protobuf/protobuf'

the whole context is showed in the picture below:
_20171121220825

I tried the last second commit version, but failed too

@chaowyc
Copy link
Author

chaowyc commented Nov 21, 2017

I read the issue the other one posted who faced the same problem before, and the solution you provided in that issue by adding -DCMAKE_INSTALL_PREFIX is doesn't work for me, and at the same time I face a new problem before the cp.

_20171121224004

so, is there any relation between the two problem?

@FloopCZ
Copy link
Owner

FloopCZ commented Nov 21, 2017

Hi, the solution will probably work for you as well, but you have to remove the tensorflow_cc/build folder first. Also consider removing ~/.cache to clean up the previous builds.

@chaowyc
Copy link
Author

chaowyc commented Nov 22, 2017

hi, I think I find the key point why this cp error appears after reading the your whole project and many times building.
At first, I found the error always showed after tensorflow build process was finished. That means our tensorflow is successful built and then next step will do some cp operations, At that time I didn't know why there should have cp operation because I only typed make command without make install, as you can see the make install command will cause some files movement and use cp is make sense.
So, I began read your cmake files. After long time reading, I found some clues in cmake directory. In the TensorflowShared.cmake file, there are some command execute sequences, the last two commands are to build tensorflow and do some copy links by executing bash files respectively. That is what I want find as I described above, the error shows after tensorflow is successful built.
Then read the copy-links bash file. According to my understanding, the main function of the bash file is find symbolic links under the directory which is specified by argument, then remove these symbolic links by unlink them and copy the content from the realpath to there, it seems something wrong when copying . Actually it is, when I comment the do copy-links bash file command, which means there is no copy process after building tensorflow, the cp problem is disappear.
Then, I execute the commands inside the copy-links.sh manually, I get the same cp error, and the error only happened when process this path:

"./tensorflow/contrib/makefile/gen/protobuf/protobuf"

after testing this path, I find this symbolic links actully is a circle.
when list the content in this path (./tensorflow/contrib/makefile/gen/protobuf/protobuf), shows below

lib, bin, include, protobuf

then cd to the protobuf dir and list(./tensorflow/contrib/makefile/gen/protobuf/protobuf/protobuf), shows same content as below. you can do these processes several times, you will find the content is NEVER changed.
So this circle will lead the source and destination is same when do the copy command to protobuf dir !!!.
AND, fortunately it's also means that we do not need do the copy command to this dir beacause it's content not changed, it's SAME one.
I finally got this, and modify your copy-links.sh file, now it's look likes below:

#!/bin/sh
set -e
skip="./tensorflow/contrib/makefile/gen/protobuf/protobuf"
for f in $(find "$1" -type l); do
    if test $f = $skip
        then
            continue
    fi
    realf="$(realpath $f)"
    unlink "$f"
    cp -r "$realf" "$f"
done

it's look likes simple and force, but it really works for me, faceplam.

I still have some question, I don't understand why you clean up the symbolic links. I browse the commit history find that it's no need delete these links before.
And, when I compile the tensorflow by bazel, there is no symbolic links generated, so why there is some when compile tf through your project.
Anyway, thank for you project, I can get my hand on building the tf by cmake, and I also learn a lot by read your code. Hope my issue will help you find the truly solution for this problem.

@FloopCZ
Copy link
Owner

FloopCZ commented Nov 24, 2017

Hi,

The reason for "delinking" is that some of the files in the compiled library folder are actually only links to the ~/.cache/bazel. After removing ~/.cache, the installation would stop working. Can you please try to remove both tensorflow_cc/build and ~/.cache, and rebuild the project with -DCMAKE_INSTALL_PREFIX=/usr/local?

@FloopCZ
Copy link
Owner

FloopCZ commented Dec 10, 2017

Closing for inactivity, please reopen if you continue to encounter this issue.

@FloopCZ FloopCZ closed this as completed Dec 10, 2017
FloopCZ added a commit that referenced this issue Dec 11, 2017
@FloopCZ
Copy link
Owner

FloopCZ commented Dec 11, 2017

Hi, the issue should be fixed in the latest master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants