免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 12552 | 回复: 15
打印 上一主题 下一主题

[C] 大家来帮忙,windows 编译openssl,报错了,无法解决 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-12-26 15:56 |只看该作者 |倒序浏览
第一步:perl Configure VC-WIN32 --prefix=g:/openssl-0.9.8g  
       G:\openssl-0.9.8g>perl Configure VC-WIN32 --prefix=g:/openssl-0.9.8g
Configuring for VC-WIN32
    no-camellia     [default]  OPENSSL_NO_CAMELLIA (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-mdc2         [default]  OPENSSL_NO_MDC2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)
    no-seed         [default]  OPENSSL_NO_SEED (skip dir)
    no-shared       [default]
    no-tlsext       [default]  OPENSSL_NO_TLSEXT (skip dir)
    no-zlib         [default]
    no-zlib-dynamic [default]
IsMK1MF=1
CC            =cl
CFLAG         =-DOPENSSL_THREADS  -DDSO_WIN32
EX_LIBS       =
CPUID_OBJ     =
BN_ASM        =bn_asm.o
DES_ENC       =des_enc.o fcrypt_b.o
AES_ASM_OBJ   =aes_core.o aes_cbc.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4_enc.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =
SHA1_OBJ_ASM  =
RMD160_OBJ_ASM=
PROCESSOR     =
RANLIB        =true
ARFLAGS       =
PERL          =/bin/perl
THIRTY_TWO_BIT mode
BN_LLONG mode
RC4_INDEX mode
RC4_CHUNK is undefined

第二步   ms\do_ms
G:\openssl-0.9.8g>ms\do_ms

G:\openssl-0.9.8g>perl util\mkfiles.pl  1>MINFO

G:\openssl-0.9.8g>perl util\mk1mf.pl no-asm VC-WIN32  1>ms\nt.mak

G:\openssl-0.9.8g>perl util\mk1mf.pl dll no-asm VC-WIN32  1>ms\ntdll.mak

G:\openssl-0.9.8g>perl util\mk1mf.pl no-asm VC-CE  1>ms\ce.mak
%OSVERSION% is not defined at util/pl/VC-32.pl line 41.
Compilation failed in require at util\mk1mf.pl line 138.

G:\openssl-0.9.8g>perl util\mk1mf.pl dll no-asm VC-CE  1>ms\cedll.mak
%OSVERSION% is not defined at util/pl/VC-32.pl line 41.
Compilation failed in require at util\mk1mf.pl line 138.

G:\openssl-0.9.8g>perl util\mkdef.pl 32 libeay  1>ms\libeay32.def

G:\openssl-0.9.8g>perl util\mkdef.pl 32 ssleay  1>ms\ssleay32.def
第三步:nmake /f ms\nt.mak

G:\openssl-0.9.8g>nmake /f ms\nt.mak

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

' in macro581) : fatal error U1001: syntax error : illegal character '
Stop.
报错
发现nt.mak 252行有点错误,其中共有两个错误 另一个错误是583行
CRYPTO (^M)
OBJ=$(OBJ_D)\crypto.obj \
        $(OBJ_D)\cryptlib.obj $(OBJ_D)\crypto.obj $(OBJ_D)\mem.obj \
        $(OBJ_D)\crypto.obj $(OBJ_D)\mem_clr.obj $(OBJ_D)\crypto.obj \
        $(OBJ_D)\mem_dbg.obj $(OBJ_D)\crypto.obj $(OBJ_D)\cversion.obj \
        $(OBJ_D)\crypto.obj $(OBJ_D)\ex_data.obj $(OBJ_D)\crypto.obj \
修改后再编译,新错误
G:\openssl-0.9.8g>nmake /f ms\nt.mak

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

Building OpenSSL
NMAKE : fatal error U1073: don't know how to make '.\\cryptlib.h'
Stop.
这个问题我研究了好久,没有好的解决办法
主要问题在nt.mak 的691 行,主要问题是源代码不是在$(SRC_D)目录下,
$(INCL_D)\e_os.h: $(SRC_D)\\e_os.h
        $(CP) $(SRC_D)\\e_os.h $(INCL_D)\e_os.h
$(INCL_D)\cryptlib.h: $(SRC_D)\\cryptlib.h
        $(CP) $(SRC_D)\\cryptlib.h $(INCL_D)\cryptlib.h
$(INCL_D)\buildinf.h: $(SRC_D)\\buildinf.h
        $(CP) $(SRC_D)\\buildinf.h $(INCL_D)\buildinf.h
$(INCL_D)\md32_common.h: $(SRC_D)\\md32_common.h
        $(CP) $(SRC_D)\\md32_common.h $(INCL_D)\md32_common.h
$(INCL_D)\o_time.h: $(SRC_D)\\o_time.h
        $(CP) $(SRC_D)\\o_time.h $(INCL_D)\o_time.h
其中 $(SRC_D)是在nt.mak的30行定义的

# The OpenSSL directory
SRC_D=.
第四步:我这个是按照百度上搜来的经验弄的,不成功
第五步:望各位兄弟帮帮忙

论坛徽章:
0
2 [报告]
发表于 2013-12-27 10:31 |只看该作者
win7 64位编译过
openssl-0.9.8
openssl-1.0.1a
openssl-1.0.1b
没啥问题

论坛徽章:
0
3 [报告]
发表于 2013-12-27 11:28 |只看该作者
本帖最后由 taotao_112206_cu 于 2013-12-27 11:33 编辑

回复 2# wenlq
都是按照那个步骤来的吗?有步骤吗?
步骤能给我发一份吗?


   

论坛徽章:
0
4 [报告]
发表于 2013-12-27 11:45 |只看该作者
回复 3# taotao_112206_c


    就是 install.w32

论坛徽章:
1
双子座
日期:2013-11-14 17:43:24
5 [报告]
发表于 2013-12-27 11:55 |只看该作者
本帖最后由 star_in_sky 于 2013-12-27 11:57 编辑

1. 确认你下的openssl包是从官网上下载的。
2. 编译的时候,假定你使用的是MS的编译器(VS), 那么你必须运行VS自带的
命令工具(vcvarsall.bat)来启动命令行。在我的机器上面,这个命令:
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
3. 按照INSTALL.w32中的说明去做,就可以了。

我刚刚编译出来:Win7(64bit), VS2008。

还有,你的错误也很明显:
G:\openssl-0.9.8g>perl util\mk1mf.pl no-asm VC-CE  1>ms\ce.mak
%OSVERSION% is not defined at util/pl/VC-32.pl line 41.
Compilation failed in require at util\mk1mf.pl line 138.

G:\openssl-0.9.8g>perl util\mk1mf.pl dll no-asm VC-CE  1>ms\cedll.mak
%OSVERSION% is not defined at util/pl/VC-32.pl line 41.
Compilation failed in require at util\mk1mf.pl line 138.


%OSVERSION%:没有定义。

我猜测你是直接启动了cmd命令,然后编译的。这个是错误的,因为在这样的情况下面,VS
的很多环境变量都没有定义。

op.png (15.89 KB, 下载次数: 74)

op.png

论坛徽章:
0
6 [报告]
发表于 2013-12-27 11:56 |只看该作者
回复 4# wenlq

但是我在执行nmake -f ms\ntdll.mak 报错了

G:\openssl-0.9.7a>nmake -f ms\ntdll.mak

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

' in macroak(519) : fatal error U1001: syntax error : illegal character '
Stop.

是不是在做"nmake -f ms\ntdll.mak"之前还得做些什么?
   

论坛徽章:
0
7 [报告]
发表于 2013-12-27 12:06 |只看该作者
回复 5# star_in_sky
命令工具(vcvarsall.bat)来启动命令行

这个没有弹出命令行
如何解决?或者说我在环境变量中加一下?


   

论坛徽章:
1
双子座
日期:2013-11-14 17:43:24
8 [报告]
发表于 2013-12-27 12:09 |只看该作者
vcvarsall.bat就放在vs安装的位置

论坛徽章:
0
9 [报告]
发表于 2013-12-27 12:16 |只看该作者
Visual C++
----------

If you want to compile in the assembly language routines with Visual
C++, then you will need already mentioned Netwide Assembler binary,
nasmw.exe or nasm.exe, to be available on your %PATH%.

Firstly you should run Configure with platform VC-WIN32:

> perl Configure VC-WIN32 --prefix=c:\some\openssl\dir

Where the prefix argument specifies where OpenSSL will be installed to.

Next you need to build the Makefiles and optionally the assembly
language files:

- If you are using NASM then run:

   > ms\do_nasm

- If you don't want to use the assembly language files at all then run:

   > perl Configure VC-WIN32 no-asm --prefix=c:/some/openssl/dir
   > ms\do_ms

If you get errors about things not having numbers assigned then check the
troubleshooting section: you probably won't be able to compile it as it
stands.

Then from the VC++ environment at a prompt do:

> nmake -f ms\ntdll.mak

If all is well it should compile and you will have some DLLs and
executables in out32dll. If you want to try the tests then do:

> nmake -f ms\ntdll.mak test


To install OpenSSL to the specified location do:

> nmake -f ms\ntdll.mak install

论坛徽章:
1
双子座
日期:2013-11-14 17:43:24
10 [报告]
发表于 2013-12-27 13:41 |只看该作者
你用的可能是vc6,应该也有类似的菜单项。

我的VS2008如下图:

pn.png (16.14 KB, 下载次数: 68)

pn.png
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP