Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Workaround for three known issues in OpenSSL for Android. #814

Merged
merged 3 commits into from
Jun 6, 2017

Conversation

xsacha
Copy link
Contributor

@xsacha xsacha commented Jun 1, 2017

  1. The OpenSSL Configure script runs a s/^-no-/no- script that ruins our CFLAGS input when input from ./config.
    On this line: https://github.com/openssl/openssl/blob/OpenSSL_1_1_0-stable/Configure#L560
    Tracked here: Unsupported option: -no-canonical-prefixes on Android openssl/openssl#3493

  2. The android-* targets use -mandroid that doesn't work on clang.
    To be fixed in future versions with this pull: Build for Android with Clang openssl/openssl#2229

  3. ./config can only set up x86 and armv7 targets. It ignores armv8, mips32, mips64 and x86_64.
    Tracked here: [rt.openssl.org #4536] Android arm-v8/arm64/aarch64 Support openssl/openssl#2490

As a solution, use our CFLAGS on top of a generic linux target and use the main Configure script.

As far as I know, Configure should be used when you are bringing your own CFLAGS and config should be used to automatically set up sane flags.
For Android, the latter is not working very well.

With this change, Android now compiles for all versions of OpenSSL on GCC and Clang.

SYSTEM=android
ARCH=${ANDROID_SSL_ARCH}
${configure_command})
# Using the documented method is currently broken on Clang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this links related to the fact that now we are using ./Configure instead of ./config...

Copy link
Contributor Author

@xsacha xsacha Jun 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is because ./config propogates this bug.
If you change this to ./config you will experience the current failure in Travis with -no-canonical-prefixes or any other -no-* CFLAG

Copy link
Contributor Author

@xsacha xsacha Jun 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed ./Configure back to ./config without changing anything else I get:
***** Unsupported options: no-canonical-prefixes

Using ./Configure, I see -no-canonical-prefixes correctly placed in the arguments to gcc/clang.

There is no other way this script can be written. I am not sure what you are wanting here.

@xsacha xsacha changed the title Workaround two known issues in OpenSSL for Android. Workaround three known issues in OpenSSL for Android. Jun 4, 2017
@xsacha xsacha changed the title Workaround three known issues in OpenSSL for Android. Work around three known issues in OpenSSL for Android. Jun 4, 2017
@xsacha xsacha changed the title Work around three known issues in OpenSSL for Android. Workaround for three known issues in OpenSSL for Android. Jun 4, 2017
@ruslo
Copy link
Owner

ruslo commented Jun 5, 2017

Note: Also dropped outdated check for architecture. Since CMake 3.7+ is requirement of building Android now, the check is redundant

This one kept in case if somebody still maintaining Hunter fork with taka-no-me toolchain support and want to receive latest updates. Anyway it's not related to the current patch, please submit this separately.

I am not sure what you are wanting here

You're using the same code with the same links to documenation as in #807. #807 was closed, why do you expect me to merge this one?

As far as I know, Configure should be used when you are bringing your own CFLAGS and config should be used to automatically set up sane flags

Any link to documentation with this statement? This is main requirement for me. All your arguments have "works for me" type, it's not appropriate.

@xsacha
Copy link
Contributor Author

xsacha commented Jun 5, 2017

There are two generations of build system. First is the build system used in OpenSSL 1.0.2 and below. The instructions below apply to it. Second is the build system for OpenSSL 1.1.0 and above. Its currently available in Master through Git. The instructions are similar, but not the same.
OpenSSL is configured for a particular platform with protocol and behavior options using Configure and config.
https://wiki.openssl.org/index.php/Compilation_and_Installation#Configure_.26_Config
You use Configure and config to tune the compile and installation process through options and switches. The difference between is Configure properly handles the host-arch-compiler triplet, and config does not. config attempts to guess the triplet, so its a lot like autotool's config.guess.
Mac OS X can have issues (its often a neglected platform), and you will have to use Configure:

@ruslo
Copy link
Owner

ruslo commented Jun 5, 2017

@xsacha
Copy link
Contributor Author

xsacha commented Jun 5, 2017

Done

@xsacha
Copy link
Contributor Author

xsacha commented Jun 5, 2017

Although it actually doesn't affect any result, should be using the ANDROID_SSL_ARCH instead of CMAKE_ANDROID_ARCH to determine 32/64 since I work it out anyway.
Fixed.

@ruslo ruslo merged commit 0c2e302 into ruslo:master Jun 6, 2017
@ruslo
Copy link
Owner

ruslo commented Jun 6, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants