Pet*_*ion 2 windows gcc cygwin openssl makefile
我正在尝试按照以下说明在 cygwin 中安装 openssl:我从该站点http://www.openssl.org/source/ 下载了最新的 tarball ,并将其放入 C:\cygwin64\home,然后我运行这些来自 cygwin 的命令
进行安装
(来自这里的说明:http : //www.slideshare.net/ganaaturuu/cygwinandopen-sslinstallguide)
直到第 3 步 ./config 它工作正常我相信,至少没有报告错误,并且它给出消息“为 Cygwin 配置”。到底。当我运行 make 虽然它给了我这个输出:
making all in crypto...
make[1]: Entering directory '/home/openssl-1.0.1e/crypto'
( echo "#ifndef MK1MF_BUILD"; \
echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
echo ' #define CFLAGS "gcc -DOPENSSL_THREADS -DDSO_DLFCN -DHAVE_DLFCN_H -DTERM IOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_ WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLP OOL_ASM -DGHASH_ASM"'; \
echo ' #define PLATFORM "Cygwin"'; \
echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
echo '#endif' ) >buildinf.h
gcc -I. -I.. -I../include -DOPENSSL_THREADS -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMI OS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_W ORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPO OL_ASM -DGHASH_ASM -c -o cryptlib.o cryptlib.c
cryptlib.c:1:0: error: CPU you selected does not support x86-64 instruction set
/* crypto/cryptlib.c */
^
cryptlib.c:1:0: error: CPU you selected does not support x86-64 instruction set
<builtin>: recipe for target 'cryptlib.o' failed
make[1]: *** [cryptlib.o] Error 1
make[1]: Leaving directory '/home/openssl-1.0.1e/crypto'
Makefile:278: recipe for target 'build_crypto' failed
make: *** [build_crypto] Error 1
Run Code Online (Sandbox Code Playgroud)
我搜索了“您选择的 CPU 不支持 x86-64 指令集”,我认为这与 CFLAGS 和 -march=i486 选项有关,但我完全不确定应该更改什么。
在这个如何在 64 位机器上将 C++ 程序编译为 64 位?问题有一些建议的解决方案,但在我的情况下,makefile 选项(如 -m32 和 -march=i686)中没有任何地方可以删除。
如果你能告诉我搜索这个的正确方向,如果不是解决方案,我将不胜感激。
我正在使用 cygwin 和 gcc 版本 4.8.2 的 Windows 7 64 位。
这是一个“我也是”的答案,因为事情发生了一些变化。Cygwin-x64 支持于 2015 年 5 月在问题 3110:添加对 x86_64 Cygwin 的支持下加入。
不过,config还是选择i686版本的库来搭建。另请参阅问题 #4326:无法在 OpenSSL 错误跟踪器中配置 Cygwin-x64。
要在 Cygwin-x64 上构建 OpenSSL 1.0.2,您必须使用Configure并选择三元组。下面是汤到坚果的食谱。
$ curl https://www.openssl.org/source/openssl-1.0.2f.tar.gz -o openssl-1.0.2f.tar.gz
...
$ tar -xzf openssl-1.0.2f.tar.gz
...
$ cd openssl-1.0.2f
Run Code Online (Sandbox Code Playgroud)
然后:
$ ./Configure Cygwin-x86_64 shared no-ssl2 no-ssl3 --openssldir="$HOME/ssl"
...
$ make depend
...
$ make
...
$ make install_sw
Run Code Online (Sandbox Code Playgroud)
install_sw在 中安装头文件$OPENSSLDIR/include,在$OPENSSLDIR/lib. 它不安装手册页。
然后编译并链接:
$ gcc -I "$HOME/ssl/include" test.c -o test.exe "$HOME/ssl/lib/libcrypto.a" "$HOME/ssl/lib/libssl.a"
Run Code Online (Sandbox Code Playgroud)
链接libcrypto.a和libssl.a意味着您可以避免库路径问题。事情会为你“正常工作”。
此外,如果您需要 OpenSSL 1.0.1 的这个,那么您可以复制/粘贴 1.0.2 中的三元组设置Configure(来自第 613 行):
$ grep "Cygwin-x86_64" Configure
"Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
Run Code Online (Sandbox Code Playgroud)
如果您想config为 1.0.1“正常工作”,请添加以下内容。确保将 for 行Cygwin-x86_64添加到Configure.
x86_64-*-cygwin) OUT="Cygwin-x86_64" ;; <== Add this in front of the ones below
*-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
*-*-cygwin) OUT="Cygwin" ;;
Run Code Online (Sandbox Code Playgroud)