问题
I'm trying to understand a make problem, and I'm not sure what is going on. I'm not sure if I'm experiencing a problem with make or a problem git.
If I perform:
$ git clone git://git.openssl.org/openssl.git openssl-git
Then I get what appears to be OpenSSL's source files:
$ cd openssl-git
$ ls
ACKNOWLEDGMENTS INSTALL.VMS README demos os2
CHANGES INSTALL.W32 README.ASN1 doc perl
CHANGES.SSLeay INSTALL.W64 README.ECC e_os.h shlib
Configure INSTALL.WCE README.ENGINE e_os2.h ssl
...
Those files look exactly like I get when I download an OpenSSL tarball and unpack it.
Are those files not usable? Am I not allowed to perform a make
on them?
The reason I'm asking such a simple question is: I open Configure
, I modify one of the configure lines, and then I perform a clean, configure and make. Make subsequently fails. When I ask about it, I'm told I'm not using git correctly.
Here are the folks telling me make is OK and I'm using git incorrectly (from the OpenSSL Testing mailing list): openssl-dev, link error [heartbeat_test] Error 2.
Here are the folks telling me I'm using git incorrectly (from Stack Overflow): Why does deleting a conflicted file break a project?.
Note: I experience the same problem in both SO question, except this question uses a fresh clone.
# Standard checkout
git clone git://git.openssl.org/openssl.git openssl-git
cd openssl-git
# This is a false start. A config is needed to create a Makefile
export KERNEL_BITS=64
./config
# Clean up developer checked-in cruft
make clean && make dclean
# Open Configure, find debug-darwin64-x86_64-cc, change -g2 to -g3
./Configure debug-darwin64-x86_64-cc no-ssl2 enable-ec_nistp_64_gcc_128
make depend
make
...
duplicate symbol _main in:
heartbeat_test.o
testutil.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [heartbeat_test] Error 2
make: *** [build_tests] Error 1
I can also change ./Configure debug-darwin64-x86_64-cc no-ssl2 enable-ec_nistp_64_gcc_128
to ./config no-ssl2 enable-ec_nistp_64_gcc_128
with the same results. The export KERNEL_BITS=64
ensures I get the 64-bit Darwin configuration (darwin64-x86_64-cc
).
回答1:
You should be able to use that clone to do a make
.
But note that INSTALL advices to use ./config
, not Configure
directly.
You can modify Configure
, but you should do a ./config
after, not ./Configure
(unless you want to configure OpenSSL for your operating system manually).
回答2:
You're right, the problem isn't with your use of Git at all, and is because of the OpenSSL Makefiles. The problem is that make dclean
removes required files. Straight after you run make dclean
, git status
will show that some C files in the test/
directory have been removed. Restoring those files after they have been removed is sufficient to make it work:
git checkout -- 'test/*.c'
What's throwing people off is that you are using Git in ways it is not normally recommended to be used (but actually may well be commonly used), and in ways that can easily cause very similar problems. Like you did in the comments here, though, the simple way to show others that the problem isn't with Git, is to explain the real problem in a way that does not rely on any questionable Git commands. In your question here, you've shown the exact commands that lead to the error message, that can be run straight after git clone
without any further user input. I suspect you would have received more useful answers to your other questions if you had done the same there.
来源:https://stackoverflow.com/questions/25469996/can-i-use-the-files-present-after-a-git-clone