Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openssl,vcpkg-cmake-get-vars] Fix android and emscripten, add feature tools #29966

Merged
merged 19 commits into from
Mar 14, 2023

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Mar 2, 2023

Fixes #29947. (Android regression from #27261.)
Fixes #30037. Fixes #29575. (wasm32-emscripten, broken before #27261.)
Fixes #29674. (arm64-linux, broken before #27261.)
The openssl tool is now an opt-in feature. Resolves #29948. (Not a regression, but changed by #27261.)

Community test success reported for android, ios, wasm-emscripten and mingw triplets.

While fixing Android, I noticed that vcpkg-cmake-get-vars was probably not working correctly with regard to osx deployment targets - we cannot rely on APPLE or ANDROID being set before calling project.

Testing also revealed insufficent handling of quotes in vcpkg-cmake-get-vars with regard to the generated cmake files. This PR adds uniform escaping, and it ports relevant changes from vcpkg-cmake-get-vars to the global script.
Finally it turned out that additional quoting fixes were needed with regard to passing options to tools in vcpkg_configure_make.

Last not least, it generally fixes libpq's openssl version detection in a way which doesn't need to run the (target:zap:) openssl tool.

  • Changes comply with the maintainer guide
  • SHA512s are updated for each updated download
  • The "supports" clause reflects platforms that may be fixed by this new version
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

@LilyWangLL LilyWangLL added the category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. label Mar 2, 2023
@talregev
Copy link
Contributor

talregev commented Mar 2, 2023

@dg0yt
Thank you for the fix!
Openssl is open source. Can you make a fix suggestion to them?

@AenBleidd
Copy link
Contributor

@dg0yt, thank you. I'll try to test this during next two days.

P.S. Sorry I haven't seen you was working on that PR since October. Unfortunately, I don't track all changes that are happening on vcpkg. I only see smth that breaks my CI.
Don't hesitate to ping me next time you'll be working on openssl stuff or smth related to it, I'll try to help you testing it on some community triplets.

@dg0yt dg0yt force-pushed the openssl branch 2 times, most recently from af8102b to 3c17992 Compare March 4, 2023 22:42
@talregev
Copy link
Contributor

talregev commented Mar 5, 2023

This fix doesn't work for android:

Building openssl[core]:armv6-android...
-- [OVERLAY] Loading triplet configuration from: /home/tal/boinc/3rdParty/vcpkg_ports/triplets/ci/armv6-android.cmake
-- Downloading https://github.com/openssl/openssl/archive/openssl-3.0.8.tar.gz -> openssl-openssl-openssl-3.0.8.tar.gz...
-- Extracting source /home/tal/boinc/3rdParty/android/vcpkg/downloads/openssl-openssl-openssl-3.0.8.tar.gz
-- Applying patch disable-apps.patch
-- Applying patch disable-install-docs.patch
-- Applying patch script-prefix.patch
-- Applying patch windows/install-layout.patch
-- Applying patch windows/install-pdbs.patch
-- Applying patch windows/umul128-arm64.patch
-- Applying patch unix/android-cc.patch
-- Applying patch unix/move-openssldir.patch
-- Applying patch unix/no-empty-dirs.patch
-- Applying patch unix/no-static-libs-for-shared.patch
-- Using source at /home/tal/boinc/3rdParty/android/vcpkg/buildtrees/openssl/src/nssl-3.0.8-1c0004bf25.clean
-- Found external ninja('1.11.1.git.kitware.jobserver-1').
-- Getting CMake variables for armv6-android
CMake Warning (dev) at buildtrees/openssl/cmake-get-vars-armv6-android-rel.cmake.log:45:
  Syntax Warning in cmake code at column 55

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  buildtrees/openssl/cmake-get-vars-armv6-android.cmake.log:1 (include)
  ports/openssl/unix/portfile.cmake:34 (include)
  ports/openssl/portfile.cmake:66 (include)
  scripts/ports.cmake:147 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Getting CMake variables for armv6-android-rel
CMake Warning (dev) at buildtrees/openssl/cmake-vars-armv6-android-rel.cmake.log:31:
  Syntax Warning in cmake code at column 55

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  buildtrees/openssl/cmake-vars-armv6-android-release.cmake.log:1 (include)
  scripts/cmake/vcpkg_configure_make.cmake:137 (include)
  ports/openssl/unix/portfile.cmake:103 (vcpkg_configure_make)
  ports/openssl/portfile.cmake:66 (include)
  scripts/ports.cmake:147 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring armv6-android-rel
CMake Warning (dev) at buildtrees/openssl/cmake-vars-armv6-android-rel.cmake.log:31:
  Syntax Warning in cmake code at column 55

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  buildtrees/openssl/cmake-vars-armv6-android-release.cmake.log:1 (include)
  scripts/cmake/vcpkg_build_make.cmake:3 (include)
  scripts/cmake/vcpkg_install_make.cmake:2 (vcpkg_build_make)
  ports/openssl/unix/portfile.cmake:117 (vcpkg_install_make)
  ports/openssl/portfile.cmake:66 (include)
  scripts/ports.cmake:147 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Building armv6-android-rel
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: /usr/bin/make V=1 -j 13 -f Makefile build_sw
    Working Directory: /home/tal/boinc/3rdParty/android/vcpkg/buildtrees/openssl/armv6-android-rel/
    See logs for more information:
      /home/tal/boinc/3rdParty/android/vcpkg/buildtrees/openssl/build-armv6-android-rel-out.log
      /home/tal/boinc/3rdParty/android/vcpkg/buildtrees/openssl/build-armv6-android-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_make.cmake:149 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_make.cmake:2 (vcpkg_build_make)
  ports/openssl/unix/portfile.cmake:117 (vcpkg_install_make)
  ports/openssl/portfile.cmake:66 (include)
  scripts/ports.cmake:147 (include)

buildtrees.zip

one of the errors in the log:

In file included from ../src/nssl-3.0.8-1c0004bf25.clean/crypto/aes/aes_ecb.c:10:
In file included from /usr/include/assert.h:35:
In file included from /usr/include/features.h:392:
/usr/include/features-time64.h:20:10: fatal error: 'bits/wordsize.h' file not found
#include <bits/wordsize.h>
         ^~~~~~~~~~~~~~~~~

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 5, 2023

Show buildtrees/openssl/cmake-vars-armv6-android-rel.cmake.log.
armv6-android: not even a community triplet.

@talregev
Copy link
Contributor

talregev commented Mar 5, 2023

Show buildtrees/openssl/cmake-vars-armv6-android-rel.cmake.log. armv6-android: not even a community triplet.

armv6 not added as a community triplet and support added here:
https://github.com/microsoft/vcpkg/blob/master/scripts/toolchains/android.cmake#L14

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 5, 2023

Again, show buildtrees/openssl/cmake-vars-armv6-android-rel.cmake.log.
That triplet doesn't work with NDK 23c or NDK r25:

CMake Error at /<NDK_ROOT>/build/cmake/android-legacy.toolchain.cmake:164 (message):
  armeabi is no longer supported.  Use armeabi-v7a.

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 5, 2023

Got it from your zip:

set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES "-lm "/home/tal/boinc/3rdParty/android/android-ndk-r15c/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++.a" "-latomic"")

Obviously broken. But I'm not convinced that this is related to this PR.

@talregev
Copy link
Contributor

talregev commented Mar 5, 2023

it working with ndk r15c

@talregev
Copy link
Contributor

talregev commented Mar 5, 2023

Got it from your zip:

set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES "-lm "/home/tal/boinc/3rdParty/android/android-ndk-r15c/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++.a" "-latomic"")

Obviously broken. But I'm not convinced that this is related to this PR.

This is a suggestion for fix?

@talregev
Copy link
Contributor

talregev commented Mar 5, 2023

Got it from your zip:

set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES "-lm "/home/tal/boinc/3rdParty/android/android-ndk-r15c/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++.a" "-latomic"")

Obviously broken. But I'm not convinced that this is related to this PR.

I added this workaround for armv6-android triplet, and I get the same error.

@talregev
Copy link
Contributor

talregev commented Mar 5, 2023

armv6 was working before your change here:
#27261

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 5, 2023

This is a suggestion for fix?

No. I was only pointing at the line which was reported as syntax error.

I added this workaround for armv6-android triplet, and I get the same error.

This is not how things work. And if we know that the syntax is broken, it is probably not helpful to add it anywhere.

The error can be reproduced in master with openssl:arm-android and NDK r18b. (Even this NDK doesn't support armv6-android.) It is not a regression.

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 5, 2023

armv6 was working before your change here: #27261

So it is a regression from this PR. But the issue is not in the scripts modified by that PR but used since that PR.

@Neumann-A
Copy link
Contributor

Maybe helpful note: vcpkg might to pass compiler flags via CC etc instead of CFLAGS etc. in the future. So you can just deactivate whatever the internal buildsystem of a port would add.

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 7, 2023

Maybe helpful note: vcpkg might to pass compiler flags via CC etc instead of CFLAGS etc. in the future. So you can just deactivate whatever the internal buildsystem of a port would add.

For openssl, it doesn't help too much because it ignores CC for some triplets.
It also doesn't help with another general problem: You cannot pass quoted arguments ("-I/with space") via variables ( CFLAGS, CC) which war substituted when make is executed.

@dg0yt dg0yt changed the title [openssl,vcpkg-cmake-get-vars] Fix Android, add feature tools [openssl,vcpkg-cmake-get-vars] Fix android and emscripten, add feature tools Mar 7, 2023
@dg0yt dg0yt marked this pull request as ready for review March 7, 2023 06:42
@talregev
Copy link
Contributor

talregev commented Mar 7, 2023

@dg0yt Thank you for these fixes. I can confirm that it working for all android triplets and wasm32-emscripten.

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 7, 2023

@m-kuhn Do you openssl on android, ios or emscripten? (In particular ios wasn't tested yet AFAICT.)

@m-kuhn
Copy link
Contributor

m-kuhn commented Mar 7, 2023

@m-kuhn Do you openssl on android, ios or emscripten? (In particular ios wasn't tested yet AFAICT.)

Ios and android (r25), yes. Should I give this PR a testrun?

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 7, 2023

@m-kuhn That would be great.. There is some room for unintented side effects.

@m-kuhn
Copy link
Contributor

m-kuhn commented Mar 8, 2023

It builds and links fine, thank you for asking.

@LilyWangLL LilyWangLL added the info:reviewed Pull Request changes follow basic guidelines label Mar 10, 2023
@talregev
Copy link
Contributor

talregev commented Mar 13, 2023

May I ask why we put this pr on hold?

@AenBleidd
Copy link
Contributor

@Neumann-A, any chance to get this merged this week?

@Neumann-A
Copy link
Contributor

@AenBleidd i don't have any power here so i am the wrong person to mention for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
8 participants