1、开发编译器

ubuntu16 64位

2、下载安装包

openssl-0.9.8e.tar.gz

3、解压

tar -vxf openssl-0.9.8e.tar.gz

4、配置选项 (Configuration Options)

./Configure linux-elf no-asm --prefix=/work/my/code/openssl

 注意:--pefix 是绝对路径不能相对路径(如:../openssl)

5、编译

make

出现错误1:

gcc -I.. -I../include  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall   -c -o rc5test.o rc5test.c
rc5test.c:1:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 dummytest.c
          ^
<builtin>: recipe for target 'rc5test.o' failed
make[1]: *** [rc5test.o] Error 1
make[1]: Leaving directory '/work/my/code/openssl-0.9.8e_linux_porting-master/test'
Makefile:241: recipe for target 'build_tests' failed
make: *** [build_tests] Error 1
解决办法:

hjx@ubuntu16:/work/my/code/openssl-0.9.8e$ cd test/
hjx@ubuntu16:/work/my/code/openssl-0.9.8e/test$ ls
bctest       ecdhtest.c    ideatest.c     P1ss.cnf     sha256t.c    testp7.pem    treq
bftest.c     ecdhtest.o    ideatest.o     P2ss.cnf     sha512t.c    testreq2.pem  treq.com
bntest       ecdsatest     igetest.c      pkcs7-1.pem  shatest.c    testrsa.pem   trsa
bntest.c     ecdsatest.c   Makefile       pkcs7.pem    ssltest.c    tests.com     trsa.com
bntest.o     ecdsatest.o   maketests.com  r160test.c   Sssdsa.cnf   testsid.pem   tsid
CAss.cnf     ectest        md2test        randtest.c   Sssrsa.cnf   testss        tsid.com
CAssdh.cnf   ectest.c      md2test.c      rc2test      tcrl         testss.com    tverify.com
CAssdsa.cnf  ectest.o      md2test.o      rc2test.c    tcrl.com     testssl       tx509
CAssrsa.cnf  enginetest.c  md4test        rc2test.o    testca       testssl.com   tx509.com
casttest.c   evp_test.c    md4test.c      rc4test      testca.com   testsslproxy  Uss.cnf
destest.c    evptests.txt  md4test.o      rc4test.c    test.cnf     testx509.pem  v3-cert1.pem
dhtest.c     exptest.c     md5test        rc4test.o    testcrl.pem  times         v3-cert2.pem
dsatest.c    hmactest      md5test.c      rc5test.c    testenc      tpkcs7        VMSca-response.1
dummytest    hmactest.c    md5test.o      rmdtest.c    testenc.com  tpkcs7.com    VMSca-response.2
dummytest.c  hmactest.o    mdc2test.c     rsa_test.c   testgen      tpkcs7d
ecdhtest     ideatest      methtest.c     sha1test.c   testgen.com  tpkcs7d.com
hjx@ubuntu16:/work/my/code/openssl-0.9.8e/test$ rm rc5test.c 
hjx@ubuntu16:/work/my/code/openssl-0.9.8er/test$ make

出现错误2:

gcc -I.. -I../include  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall   -c -o mdc2test.o mdc2test.c
mdc2test.c:1:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 dummytest.c
          ^
<builtin>: recipe for target 'mdc2test.o' failed
make[2]: *** [mdc2test.o] Error 1
make[2]: Leaving directory '/work/my/code/openssl-0.9.8e_linux_porting-master/test'
Makefile:241: recipe for target 'build_tests' failed
make[1]: *** [build_tests] Error 1
make[1]: Leaving directory '/work/my/code/openssl-0.9.8e_linux_porting-master'
Makefile:100: recipe for target 'top' failed
make: *** [top] Error 2
解决方法:

hjx@ubuntu16:/work/my/code/openssl-0.9.8e_linux_porting-master/test$ rm mdc2test.c
hjx@ubuntu16:/work/my/code/openssl-0.9.8e_linux_porting-master/test$ make

问题出现的原因是:

mdc2test.c rc5test.c没有连接到 dummytest.c文件

删除前:

lrwxrwxrwx 1 hjx hjx      11 9月  22 13:56 rc5test.c
lrwxrwxrwx 1 hjx hjx      11 9月  22 14:04 mdc2test.c

删除编译后:

lrwxrwxrwx 1 hjx hjx      11 9月  22 13:56 rc5test.c -> dummytest.c
lrwxrwxrwx 1 hjx hjx      11 9月  22 14:04 mdc2test.c -> dummytest.c

6、安装

make install

出现错误

cms.pod around line 457: Expected text after =item, not a number
cms.pod around line 461: Expected text after =item, not a number
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number
cms.pod around line 474: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 69.
make: *** [install_docs] Error 1

解决方法:

rm-f /usr/bin/pod2man

重新安装编译。

7、安装结果

root@ubuntu16:/work/my/code/openssl# ls
bin  include  lib  ssl
root@ubuntu16:/work/my/code/openssl# ls include/
openssl
root@ubuntu16:/work/my/code/openssl# ls include/openssl/
aes.h       bn.h        crypto.h   dtls1.h   e_os2.h     kssl.h     obj_mac.h      pem.h        rc2.h        ssl23.h  symhacks.h   x509.h
asn1.h      buffer.h    des.h      ebcdic.h  err.h       lhash.h    ocsp.h         pkcs12.h     rc4.h        ssl2.h   tls1.h       x509v3.h
asn1_mac.h  cast.h      des_old.h  ecdh.h    evp.h       md2.h      opensslconf.h  pkcs7.h      ripemd.h     ssl3.h   tmdiff.h     x509_vfy.h
asn1t.h     comp.h      dh.h       ecdsa.h   hmac.h      md4.h      opensslv.h     pq_compat.h  rsa.h        ssl.h    txt_db.h
bio.h       conf_api.h  dsa.h      ec.h      idea.h      md5.h      ossl_typ.h     pqueue.h     safestack.h  stack.h  ui_compat.h
blowfish.h  conf.h      dso.h      engine.h  krb5_asn.h  objects.h  pem2.h         rand.h       sha.h        store.h  ui.h
root@ubuntu16:/work/my/code/openssl# 
root@ubuntu16:/work/my/code/openssl# ls lib/
engines  libcrypto.a  libssl.a  pkgconfig
root@ubuntu16:/work/my/code/openssl# 
root@ubuntu16:/work/my/code/openssl# ls bin/
c_rehash  openssl
root@ubuntu16:/work/my/code/openssl# 
root@ubuntu16:/work/my/code/openssl# 









Logo

更多推荐