Skip to content

Conversation

@giordano
Copy link
Contributor

@Alexander-Barth could you please checkout this branch and tell me if this works for you? JuliaPackaging/Yggdrasil#887 will be blocked for a while because of a bug in BinaryBuilder, so directly patching the wrapper may be the fastest thing to do.

@giordano giordano requested a review from jlbuild April 17, 2020 22:59
@Alexander-Barth
Copy link
Contributor

Still no luck, I get the same error:

(test-project) pkg> st
Status `~/test-project/Project.toml`
  [739be429] MbedTLS v1.0.2
  [c8ffd9c3] MbedTLS_jll v2.16.0+2 [`~/.julia/dev/MbedTLS_jll`]
(test-project) pkg> build MbedTLS_jll
julia> using MbedTLS_jll
julia> MbedTLS_jll.libmbedtls
ERROR: UndefVarError: libmbedtls not defined

It seems that MbedTLS_jll looks for these wrapper files:

julia> map(p -> joinpath(DIR, "wrappers", replace(triplet(p), "arm-" => "armv7l-") * ".jl"), platforms)
13-element Array{String,1}:
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/armv7l-linux-gnueabihf.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/x86_64-linux-gnu.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/aarch64-linux-musl.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/powerpc64le-linux-gnu.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/x86_64-apple-darwin14.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/x86_64-linux-musl.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/x86_64-w64-mingw32.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/i686-linux-gnu.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/aarch64-linux-gnu.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/i686-linux-musl.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/x86_64-unknown-freebsd11.1.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/i686-w64-mingw32.jl"
 "/home/pi/.julia/dev/MbedTLS_jll/src/wrappers/armv7l-linux-musleabihf.jl"

The first file does not exists (but arm-linux-gnueabihf.jl does exists).
So when I do the reverse substitution "armv7l-" => "arm-" (and likewise during the include), it works then!

diff --git a/src/MbedTLS_jll.jl b/src/MbedTLS_jll.jl
index fd8844f..716cefb 100644
--- a/src/MbedTLS_jll.jl
+++ b/src/MbedTLS_jll.jl
@@ -34,7 +34,7 @@ artifacts = Pkg.Artifacts.load_artifacts_toml(artifacts_toml; pkg_uuid=UUID("c8f
 platforms = [Pkg.Artifacts.unpack_platform(e, "MbedTLS", artifacts_toml) for e in artifacts["MbedTLS"]]
 
 # Filter platforms based on what wrappers we've generated on-disk
-filter!(p -> isfile(joinpath(@__DIR__, "wrappers", replace(triplet(p), "arm-" => "armv7l-") * ".jl")), platforms)
+filter!(p -> isfile(joinpath(@__DIR__, "wrappers", replace(triplet(p), "armv7l-" => "arm-") * ".jl")), platforms)
 
 # From the available options, choose the best platform
 best_platform = select_platform(Dict(p => triplet(p) for p in platforms))
@@ -44,7 +44,7 @@ if best_platform === nothing
     @debug("Unable to load MbedTLS; unsupported platform $(triplet(platform_key_abi()))")
 else
     # Load the appropriate wrapper
-    include(joinpath(@__DIR__, "wrappers", "$(best_platform).jl"))
+    include(joinpath(@__DIR__, "wrappers", "$(replace(best_platform,"armv7l-" => "arm-")).jl"))
 end
 
 end  # module MbedTLS_jll

The following tests now works:

julia> using MbedTLS, MbedTLS_jll; MbedTLS.SSLConfig()
[ Info: Precompiling MbedTLS [739be429-bea8-5141-9913-cc70e7f3736d]
MbedTLS.SSLConfig()

julia> MbedTLS_jll.libmbedtls
"libmbedtls.so.12"

Alternatively, it also work by renaming (or copying) file wrapper files:

pi@wetter:~/.julia/dev/MbedTLS_jll/src/wrappers $ mv arm-linux-gnueabihf.jl armv7l-linux-gnueabihf.jl
pi@wetter:~/.julia/dev/MbedTLS_jll/src/wrappers $ mv arm-linux-musleabihf.jl armv7l-linux-musleabihf.jl 

@giordano
Copy link
Contributor Author

Mind doing a PR?

@Alexander-Barth
Copy link
Contributor

Sure, I made the PR here:
#2

@giordano giordano closed this Apr 18, 2020
@giordano giordano deleted the mg/fix-armv7l branch April 18, 2020 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants