最近在编译openssl-1.1.0f的时候,执行config以后,会提示

target already defined - linux-x86_64 (offending arg: linux-x86_64)


或者在config通过以后,编译的时候提示

cc1: error: unrecognized command line option "-m64"

目前找到两种解决办法

方法一

1、执行config命令

./Configure --prefix=$(pwd)/output shared no-asm linux-armv4

目前目标平台可支持目前支持的包括

BS2000-OSD BSD-generic32 BSD-generic64 BSD-ia64 BSD-sparc64 BSD-sparcv8
BSD-x86 BSD-x86-elf BSD-x86_64 Cygwin Cygwin-i386 Cygwin-i486 Cygwin-i586
Cygwin-i686 Cygwin-x86 Cygwin-x86_64 DJGPP MPE/iX-gcc OS390-Unix QNX6
QNX6-i386 UEFI UWIN VC-CE VC-WIN32 VC-WIN64A VC-WIN64A-masm VC-WIN64I aix-cc
aix-gcc aix64-cc aix64-gcc android android-armeabi android-mips android-x86
android64 android64-aarch64 bsdi-elf-gcc cc darwin-i386-cc darwin-ppc-cc
darwin64-debug-test-64-clang darwin64-ppc-cc darwin64-x86_64-cc dist gcc
haiku-x86 haiku-x86_64 hpux-ia64-cc hpux-ia64-gcc hpux-parisc-cc
hpux-parisc-gcc hpux-parisc1_1-cc hpux-parisc1_1-gcc hpux64-ia64-cc
hpux64-ia64-gcc hpux64-parisc2-cc hpux64-parisc2-gcc hurd-x86 ios-cross
ios64-cross iphoneos-cross irix-mips3-cc irix-mips3-gcc irix64-mips4-cc
irix64-mips4-gcc linux-aarch64 linux-alpha-gcc linux-aout linux-arm64ilp32
linux-armv4 linux-c64xplus linux-elf linux-generic32 linux-generic64
linux-ia64 linux-mips32 linux-mips64 linux-ppc linux-ppc64 linux-ppc64le
linux-sparcv8 linux-sparcv9 linux-x32 linux-x86 linux-x86-clang linux-x86_64
linux-x86_64-clang linux32-s390x linux64-mips64 linux64-s390x linux64-sparcv9
mingw mingw64 nextstep nextstep3.3 purify qnx4 sco5-cc sco5-gcc
solaris-sparcv7-cc solaris-sparcv7-gcc solaris-sparcv8-cc solaris-sparcv8-gcc
solaris-sparcv9-cc solaris-sparcv9-gcc solaris-x86-gcc solaris64-sparcv9-cc
solaris64-sparcv9-gcc solaris64-x86_64-cc solaris64-x86_64-gcc tru64-alpha-cc
tru64-alpha-gcc uClinux-dist uClinux-dist64 unixware-2.0 unixware-2.1
unixware-7 unixware-7-gcc vms-alpha vms-alpha-p32 vms-alpha-p64 vms-ia64
vms-ia64-p32 vms-ia64-p64 vos-gcc vxworks-mips vxworks-ppc405 vxworks-ppc60x
vxworks-ppc750 vxworks-ppc750-debug vxworks-ppc860 vxworks-ppcgen
vxworks-simlinux debug debug-erbridge debug-linux-ia32-aes debug-linux-pentium
debug-linux-ppro debug-test-64-clang

选择其中一个替换linux-armv4

2、编译

 
  1. make clean

  2. make CC="/path/to/cross/compiler/arm-none-linux-gnueabi-gcc" AR="/path/to/cross/compiler/arm-none-linux-gnueabi-ar r" RANLIB="/path/to/cross/compiler/arm-none-linux-gnueabi-ranlib"

  3. make install


 

方法二

1、执行config命令

./config --prefix=$(pwd)/output -shared no-asm  --cross-compile-prefix=/path/to/cross/compiler/arm-none-linux-gnueabi- 

2、修改Makefile

1) 修改platform和CONFIGURE_ARGS,把其中的linux-x86_64修改成你需要编译的平台选项,目前支持的包括

BS2000-OSD BSD-generic32 BSD-generic64 BSD-ia64 BSD-sparc64 BSD-sparcv8
BSD-x86 BSD-x86-elf BSD-x86_64 Cygwin Cygwin-i386 Cygwin-i486 Cygwin-i586
Cygwin-i686 Cygwin-x86 Cygwin-x86_64 DJGPP MPE/iX-gcc OS390-Unix QNX6
QNX6-i386 UEFI UWIN VC-CE VC-WIN32 VC-WIN64A VC-WIN64A-masm VC-WIN64I aix-cc
aix-gcc aix64-cc aix64-gcc android android-armeabi android-mips android-x86
android64 android64-aarch64 bsdi-elf-gcc cc darwin-i386-cc darwin-ppc-cc
darwin64-debug-test-64-clang darwin64-ppc-cc darwin64-x86_64-cc dist gcc
haiku-x86 haiku-x86_64 hpux-ia64-cc hpux-ia64-gcc hpux-parisc-cc
hpux-parisc-gcc hpux-parisc1_1-cc hpux-parisc1_1-gcc hpux64-ia64-cc
hpux64-ia64-gcc hpux64-parisc2-cc hpux64-parisc2-gcc hurd-x86 ios-cross
ios64-cross iphoneos-cross irix-mips3-cc irix-mips3-gcc irix64-mips4-cc
irix64-mips4-gcc linux-aarch64 linux-alpha-gcc linux-aout linux-arm64ilp32
linux-armv4 linux-c64xplus linux-elf linux-generic32 linux-generic64
linux-ia64 linux-mips32 linux-mips64 linux-ppc linux-ppc64 linux-ppc64le
linux-sparcv8 linux-sparcv9 linux-x32 linux-x86 linux-x86-clang linux-x86_64
linux-x86_64-clang linux32-s390x linux64-mips64 linux64-s390x linux64-sparcv9
mingw mingw64 nextstep nextstep3.3 purify qnx4 sco5-cc sco5-gcc
solaris-sparcv7-cc solaris-sparcv7-gcc solaris-sparcv8-cc solaris-sparcv8-gcc
solaris-sparcv9-cc solaris-sparcv9-gcc solaris-x86-gcc solaris64-sparcv9-cc
solaris64-sparcv9-gcc solaris64-x86_64-cc solaris64-x86_64-gcc tru64-alpha-cc
tru64-alpha-gcc uClinux-dist uClinux-dist64 unixware-2.0 unixware-2.1
unixware-7 unixware-7-gcc vms-alpha vms-alpha-p32 vms-alpha-p64 vms-ia64
vms-ia64-p32 vms-ia64-p64 vos-gcc vxworks-mips vxworks-ppc405 vxworks-ppc60x
vxworks-ppc750 vxworks-ppc750-debug vxworks-ppc860 vxworks-ppcgen
vxworks-simlinux debug debug-erbridge debug-linux-ia32-aes debug-linux-pentium
debug-linux-ppro debug-test-64-clang

2) 删除所有"-m64"参数

3、编译

 
  1. make

  2. make install

编译完成后的程序会放在当前目录的output目录下。

上述两种方法,个人推荐第一种。

openssl交叉编译问题 - 代码先锋网 (codeleading.com)

GitHub 加速计划 / ope / openssl
25.13 K
9.99 K
下载
传输层安全性/安全套接层及其加密库
最近提交(Master分支:1 个月前 )
fd39d1c8 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/25095) 3 个月前
ae87c488 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/25095) 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐