“CPU you selected does not support x86-64 instruction set” error on Cygwin-x64

后端 未结 3 852
梦谈多话
梦谈多话 2020-12-20 02:33

I\'m trying to install openssl in cygwin by following these instructions: I dowloaded the latest tarball from this site http://www.openssl.org/source/, and put it in C:\\cyg

相关标签:
3条回答
  • 2020-12-20 03:12

    It would seem that 1.0.1 does not have support for Cygwin/x64.

    This thread indicates that the necessary patches have been pulled into the 1.0.2 branch.

    0 讨论(0)
  • 2020-12-20 03:13

    Here's a "mee too" answer because things have changed a bit. Cygwin-x64 support was cut-in in May 2015 under Issue 3110: Adding support for x86_64 Cygwin.

    However, config still selects the i686 version of the library to build. Also see Issue #4326: Failed to configure for Cygwin-x64 in the OpenSSL bug tracker.

    To build OpenSSL 1.0.2 on Cygwin-x64, you have to use Configure and select the triplet. Below is the soup-to-nuts recipe.

    $ 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
    

    Then:

    $ ./Configure Cygwin-x86_64 shared no-ssl2 no-ssl3 --openssldir="$HOME/ssl"
    ...
    $ make depend
    ...
    $ make
    ...
    $ make install_sw
    

    install_sw installs the headers in $OPENSSLDIR/include, and the libraries in $OPENSSLDIR/lib. It does not install the man pages.

    You then compile and link with:

    $ gcc -I "$HOME/ssl/include" test.c -o test.exe "$HOME/ssl/lib/libcrypto.a" "$HOME/ssl/lib/libssl.a"
    

    Linking against libcrypto.a and libssl.a means you avoid library path problems. Things will "just work" for you.


    Also, if you need this for OpenSSL 1.0.1, then you can copy/paste the triplet's settings from 1.0.2's Configure (from line 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",
    

    If you want config to "just work" for 1.0.1, then add the following. Be sure the line for Cygwin-x86_64 was added to 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" ;;
    
    0 讨论(0)
  • 2020-12-20 03:18

    here is one post you can refer to. the basic idea is that specifying -march=x86-64 and avoid using assembly language. assembly language is not as portable as c language.

    0 讨论(0)
提交回复
热议问题