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

MbedTLS source build fixes #39131

Merged
merged 3 commits into from
Jan 13, 2021
Merged

MbedTLS source build fixes #39131

merged 3 commits into from
Jan 13, 2021

Conversation

omus
Copy link
Member

@omus omus commented Jan 6, 2021

Fixes two issues with the MbedTLS sources builds:

  • Fixes the sed call to work on macOS
  • Applies the MbedTLS patch once only

From the macOS man page for sed:

-i extension
        Edit files in-place, saving backups with the specified extension.  If a zero-length extension is given, no backup will be saved.  It is not recommended to
        give a zero-length extension when in-place editing files, as you risk corruption or partial content in situations where disk space is exhausted, etc.

This syntax is also supported on Linux

@omus omus added the domain:building Build system, or building Julia or its dependencies label Jan 6, 2021
@omus omus changed the title Revise build sed call to work on macOS WIP: Revise build sed call to work on macOS Jan 6, 2021
@omus
Copy link
Member Author

omus commented Jan 6, 2021

Looks like building mbedtls from sources has a couple of issues which I'll take care of here.

@omus omus changed the title WIP: Revise build sed call to work on macOS MbedTLS source build fixes Jan 6, 2021
deps/mbedtls.mk Outdated Show resolved Hide resolved
@omus
Copy link
Member Author

omus commented Jan 11, 2021

Failure on aarch64 appears unrelated.

Test Failed at /buildworker/worker/tester_linuxaarch64/build/share/julia/test/abstractarray.jl:1274
  Expression: copyto!(fill(0.0, 5), ntuple(randtype, 7))
    Expected: ArgumentError
      Thrown: BoundsError

I'll rebase these changes and see if they pass on another CI run.

@omus
Copy link
Member Author

omus commented Jan 12, 2021

Some additional details about the failures. Without the sed fix for macOS the following error is seen:

$ make -C deps extract-mbedtls
...
sed "s|//#define MBEDTLS_MD4_C|#define MBEDTLS_MD4_C|" -i /Users/omus/Development/Julia/x86/latest-src/deps/srccache/mbedtls-2.24.0/include/mbedtls/config.h
sed: -i: No such file or directory
... # all 3808 lines from mbedtls/config.h
make: *** [/Users/omus/Development/Julia/x86/latest-src/deps/srccache/mbedtls-2.24.0/source-extracted] Error 1

Without the fix to apply the MbedTLS patch only once the following error occurs when attempting to compile MbedTLS more than once:

$ make -C deps compile-mbedtls
...
[100%] Linking C executable test_suite_aes.cbc
[100%] Built target test_suite_aes.cbc
echo 1 > scratch/mbedtls-2.24.0/build-compiled

$ make -C deps compile-mbedtls
# Apply workaround for CMake 3.18.2 bug (https://github.com/ARMmbed/mbedtls/pull/3691).
# This patch merged upstream shortly after MBedTLS's 2.25.0 minor release, so chances
# are it will be included at least in their next minor release (2.26.0?).
cd /Users/omus/Development/Julia/x86/latest-src/deps/srccache/mbedtls-2.24.0 && \
		patch -p1 -f < /Users/omus/Development/Julia/x86/latest-src/deps/patches/mbedtls-cmake-findpy.patch
patching file CMakeLists.txt
Hunk #1 FAILED at 17.
1 out of 1 hunk FAILED -- saving rejects to file CMakeLists.txt.rej
make: *** [/Users/omus/Development/Julia/x86/latest-src/deps/srccache/mbedtls-2.24.0/mbedtls-cmake-findpy.patch-applied] Error 1

@omus
Copy link
Member Author

omus commented Jan 12, 2021

The CMAKE_MACOSX_RPATH change suppresses the following warning:

$ make -C deps compile-mbedtls
...
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   mbedcrypto
   mbedtls
   mbedx509

This warning is for project developers.  Use -Wno-dev to suppress it.
...

@omus omus requested a review from staticfloat January 13, 2021 17:21
@staticfloat staticfloat merged commit 492096f into master Jan 13, 2021
@staticfloat staticfloat deleted the cv/sed-fix branch January 13, 2021 18:55
@Sacha0
Copy link
Member

Sacha0 commented Jan 20, 2021

Thanks for these fixes Curtis! I just spent the last long while tracking down an issue due to the @$ transposition, biting us on the 1.6 candidate. I'll add a backport tag.

@Sacha0 Sacha0 added the backport 1.6 Change should be backported to release-1.6 label Jan 20, 2021
Sacha0 pushed a commit that referenced this pull request Jan 20, 2021
KristofferC pushed a commit that referenced this pull request Jan 21, 2021
(cherry picked from commit 492096f)
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Feb 1, 2021
KristofferC pushed a commit that referenced this pull request Feb 1, 2021
(cherry picked from commit 492096f)
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
(cherry picked from commit 492096f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants