ureq icon indicating copy to clipboard operation
ureq copied to clipboard

`cargo test` requires mbedtls

Open jsha opened this issue 3 years ago • 5 comments

When I run cargo test on my local machine, which doesn't have mbedtls installed, I get the errors below. I'm a bit surprised this can happen. As far as I know, our GitHub Actions tests don't have mbedtls installed, right? How are they passing?

I think by default, developing ureq should not require mbedtls. If that means turning off compilation for the mbedtls example, we should do that. But maybe we can hide it behind a feature flag?

$ cargo test
   Compiling num-integer v0.1.44
   Compiling mbedtls-sys-auto v2.28.0
   Compiling ureq v2.4.0 (/home/jsha/rust/ureq)
error: failed to run custom build command for `mbedtls-sys-auto v2.28.0`

Caused by:
  process didn't exit successfully: `/home/jsha/rust/ureq/target/debug/build/mbedtls-sys-auto-3dbdf7aca8ddbadb/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=threading_component="pthread"
  cargo:rustc-cfg=std_component="fs"
  cargo:rustc-cfg=std_component="net"
  cargo:rustc-cfg=std_component="entropy"
  cargo:rustc-cfg=time_component="libc"
  cargo:platform-components=threading_component=pthread,std_component=fs,std_component=net,std_component=entropy,time_component=libc
  cargo:rerun-if-env-changed=RUST_MBEDTLS_SYS_SOURCE
  cargo:rerun-if-changed=vendor/CMakeLists.txt
  cargo:rerun-if-changed=vendor/include/mbedtls/config_psa.h
  cargo:rerun-if-changed=vendor/include/mbedtls/platform_time.h
  cargo:rerun-if-changed=vendor/include/mbedtls/platform_util.h
  cargo:rerun-if-changed=vendor/include/mbedtls/bignum.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md.h
  cargo:rerun-if-changed=vendor/include/mbedtls/threading.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecp.h
  cargo:rerun-if-changed=vendor/include/mbedtls/rsa.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecdsa.h
  cargo:rerun-if-changed=vendor/include/mbedtls/asn1.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pk.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509.h
  cargo:rerun-if-changed=vendor/include/mbedtls/cipher.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509_crl.h
  cargo:rerun-if-changed=vendor/include/mbedtls/aes.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_ciphersuites.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509_crt.h
  cargo:rerun-if-changed=vendor/include/mbedtls/dhm.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecdh.h
  cargo:rerun-if-changed=vendor/include/mbedtls/oid.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ctr_drbg.h
  cargo:rerun-if-changed=vendor/include/mbedtls/hmac_drbg.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md5.h
  cargo:rerun-if-changed=vendor/include/mbedtls/sha1.h
  cargo:rerun-if-changed=vendor/include/mbedtls/sha256.h
  cargo:rerun-if-changed=vendor/include/mbedtls/sha512.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecjpake.h
  cargo:rerun-if-changed=vendor/include/mbedtls/psa_util.h
  cargo:rerun-if-changed=vendor/include/mbedtls/net_sockets.h
  cargo:rerun-if-changed=vendor/include/mbedtls/havege.h
  cargo:rerun-if-changed=vendor/include/mbedtls/poly1305.h
  cargo:rerun-if-changed=vendor/include/mbedtls/chacha20.h
  cargo:rerun-if-changed=vendor/include/mbedtls/xtea.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509_csr.h
  cargo:rerun-if-changed=vendor/include/mbedtls/version.h
  cargo:rerun-if-changed=vendor/include/mbedtls/timing.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_ticket.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_internal.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_cookie.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_cache.h
  cargo:rerun-if-changed=vendor/include/mbedtls/rsa_internal.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ripemd160.h
  cargo:rerun-if-changed=vendor/include/mbedtls/platform.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pkcs5.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pkcs12.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pk_internal.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pem.h
  cargo:rerun-if-changed=vendor/include/mbedtls/padlock.h
  cargo:rerun-if-changed=vendor/include/mbedtls/nist_kw.h
  cargo:rerun-if-changed=vendor/include/mbedtls/net.h
  cargo:rerun-if-changed=vendor/include/mbedtls/memory_buffer_alloc.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md_internal.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md4.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md2.h
  cargo:rerun-if-changed=vendor/include/mbedtls/hkdf.h
  cargo:rerun-if-changed=vendor/include/mbedtls/gcm.h
  cargo:rerun-if-changed=vendor/include/mbedtls/error.h
  cargo:rerun-if-changed=vendor/include/mbedtls/entropy_poll.h
  cargo:rerun-if-changed=vendor/include/mbedtls/entropy.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecp_internal.h
  cargo:rerun-if-changed=vendor/include/mbedtls/des.h
  cargo:rerun-if-changed=vendor/include/mbedtls/debug.h
  cargo:rerun-if-changed=vendor/include/mbedtls/constant_time.h
  cargo:rerun-if-changed=vendor/include/mbedtls/cmac.h
  cargo:rerun-if-changed=vendor/include/mbedtls/cipher_internal.h
  cargo:rerun-if-changed=vendor/include/mbedtls/chachapoly.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ccm.h
  cargo:rerun-if-changed=vendor/include/mbedtls/camellia.h
  cargo:rerun-if-changed=vendor/include/mbedtls/bn_mul.h
  cargo:rerun-if-changed=vendor/include/mbedtls/blowfish.h
  cargo:rerun-if-changed=vendor/include/mbedtls/base64.h
  cargo:rerun-if-changed=vendor/include/mbedtls/asn1write.h
  cargo:rerun-if-changed=vendor/include/mbedtls/aria.h
  cargo:rerun-if-changed=vendor/include/mbedtls/arc4.h
  cargo:rerun-if-changed=vendor/include/mbedtls/aesni.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_driver_wrappers.c
  cargo:rerun-if-changed=vendor/library/mps_reader.h
  cargo:rerun-if-changed=vendor/library/ssl_tls13_keys.c
  cargo:rerun-if-changed=vendor/library/ecp_curves.c
  cargo:rerun-if-changed=vendor/library/pkcs12.c
  cargo:rerun-if-changed=vendor/library/ecp_invasive.h
  cargo:rerun-if-changed=vendor/library/ccm.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_driver_wrappers.h
  cargo:rerun-if-changed=vendor/library/version_features.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_its.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_hash.h
  cargo:rerun-if-changed=vendor/library/asn1parse.c
  cargo:rerun-if-changed=vendor/library/arc4.c
  cargo:rerun-if-changed=vendor/library/md2.c
  cargo:rerun-if-changed=vendor/library/ssl_tls.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_client.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_se.h
  cargo:rerun-if-changed=vendor/library/chachapoly.c
  cargo:rerun-if-changed=vendor/library/ssl_cli.c
  cargo:rerun-if-changed=vendor/library/debug.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_invasive.h
  cargo:rerun-if-changed=vendor/library/cipher.c
  cargo:rerun-if-changed=vendor/library/ssl_srv.c
  cargo:rerun-if-changed=vendor/library/cipher_wrap.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_ecp.c
  cargo:rerun-if-changed=vendor/library/constant_time_internal.h
  cargo:rerun-if-changed=vendor/library/rsa.c
  cargo:rerun-if-changed=vendor/library/psa_its_file.c
  cargo:rerun-if-changed=vendor/library/mps_trace.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_aead.h
  cargo:rerun-if-changed=vendor/library/x509write_csr.c
  cargo:rerun-if-changed=vendor/library/ripemd160.c
  cargo:rerun-if-changed=vendor/library/dhm.c
  cargo:rerun-if-changed=vendor/library/chacha20.c
  cargo:rerun-if-changed=vendor/library/constant_time.c
  cargo:rerun-if-changed=vendor/library/aesni.c
  cargo:rerun-if-changed=vendor/library/pkcs5.c
  cargo:rerun-if-changed=vendor/library/ssl_msg.c
  cargo:rerun-if-changed=vendor/library/ssl_tls13_keys.h
  cargo:rerun-if-changed=vendor/library/ecdh.c
  cargo:rerun-if-changed=vendor/library/pk_wrap.c
  cargo:rerun-if-changed=vendor/library/check_crypto_config.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_mac.c
  cargo:rerun-if-changed=vendor/library/pkwrite.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_aead.c
  cargo:rerun-if-changed=vendor/library/constant_time_invasive.h
  cargo:rerun-if-changed=vendor/library/x509_crt.c
  cargo:rerun-if-changed=vendor/library/oid.c
  cargo:rerun-if-changed=vendor/library/hmac_drbg.c
  cargo:rerun-if-changed=vendor/library/aes.c
  cargo:rerun-if-changed=vendor/library/gcm.c
  cargo:rerun-if-changed=vendor/library/bignum.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_slot_management.c
  cargo:rerun-if-changed=vendor/library/md5.c
  cargo:rerun-if-changed=vendor/library/x509_create.c
  cargo:rerun-if-changed=vendor/library/CMakeLists.txt
  cargo:rerun-if-changed=vendor/library/Makefile
  cargo:rerun-if-changed=vendor/library/ecdsa.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_rsa.h
  cargo:rerun-if-changed=vendor/library/camellia.c
  cargo:rerun-if-changed=vendor/library/threading.c
  cargo:rerun-if-changed=vendor/library/ctr_drbg.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_slot_management.h
  cargo:rerun-if-changed=vendor/library/cmac.c
  cargo:rerun-if-changed=vendor/library/ssl_ciphersuites.c
  cargo:rerun-if-changed=vendor/library/ecjpake.c
  cargo:rerun-if-changed=vendor/library/net_sockets.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_rsa.c
  cargo:rerun-if-changed=vendor/library/x509_crl.c
  cargo:rerun-if-changed=vendor/library/version.c
  cargo:rerun-if-changed=vendor/library/timing.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_se.c
  cargo:rerun-if-changed=vendor/library/.gitignore
  cargo:rerun-if-changed=vendor/library/poly1305.c
  cargo:rerun-if-changed=vendor/library/havege.c
  cargo:rerun-if-changed=vendor/library/platform.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_cipher.h
  cargo:rerun-if-changed=vendor/library/error.c
  cargo:rerun-if-changed=vendor/library/sha256.c
  cargo:rerun-if-changed=vendor/library/platform_util.c
  cargo:rerun-if-changed=vendor/library/base64.c
  cargo:rerun-if-changed=vendor/library/nist_kw.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_core.h
  cargo:rerun-if-changed=vendor/library/pem.c
  cargo:rerun-if-changed=vendor/library/pk.c
  cargo:rerun-if-changed=vendor/library/x509.c
  cargo:rerun-if-changed=vendor/library/ecp.c
  cargo:rerun-if-changed=vendor/library/entropy.c
  cargo:rerun-if-changed=vendor/library/ssl_cookie.c
  cargo:rerun-if-changed=vendor/library/ssl_ticket.c
  cargo:rerun-if-changed=vendor/library/common.h
  cargo:rerun-if-changed=vendor/library/mps_reader.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_cipher.c
  cargo:rerun-if-changed=vendor/library/certs.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_hash.c
  cargo:rerun-if-changed=vendor/library/sha1.c
  cargo:rerun-if-changed=vendor/library/x509write_crt.c
  cargo:rerun-if-changed=vendor/library/mps_common.h
  cargo:rerun-if-changed=vendor/library/rsa_internal.c
  cargo:rerun-if-changed=vendor/library/padlock.c
  cargo:rerun-if-changed=vendor/library/pkcs11.c
  cargo:rerun-if-changed=vendor/library/memory_buffer_alloc.c
  cargo:rerun-if-changed=vendor/library/asn1write.c
  cargo:rerun-if-changed=vendor/library/mps_trace.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_ecp.h
  cargo:rerun-if-changed=vendor/library/md.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_random_impl.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_storage.c
  cargo:rerun-if-changed=vendor/library/ssl_cache.c
  cargo:rerun-if-changed=vendor/library/md4.c
  cargo:rerun-if-changed=vendor/library/mps_error.h
  cargo:rerun-if-changed=vendor/library/entropy_poll.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_mac.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_storage.h
  cargo:rerun-if-changed=vendor/library/pkparse.c
  cargo:rerun-if-changed=vendor/library/psa_crypto.c
  cargo:rerun-if-changed=vendor/library/xtea.c
  cargo:rerun-if-changed=vendor/library/aria.c
  cargo:rerun-if-changed=vendor/library/hkdf.c
  cargo:rerun-if-changed=vendor/library/x509_csr.c
  cargo:rerun-if-changed=vendor/library/sha512.c
  cargo:rerun-if-changed=vendor/library/blowfish.c
  cargo:rerun-if-changed=vendor/library/des.c
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
  CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
  CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-linux-gnu = None
  CMAKE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "/home/jsha/.cargo/registry/src/github.com-1ecc6299db9ec823/mbedtls-sys-auto-2.28.0/vendor" "-DENABLE_PROGRAMS=OFF" "-DENABLE_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/home/jsha/rust/ureq/target/debug/build/mbedtls-sys-auto-8e84f013bc10bd40/out" "-DCMAKE_C_FLAGS= -DMBEDTLS_CONFIG_FILE=\"\\\"/home/jsha/rust/ureq/target/debug/build/mbedtls-sys-auto-8e84f013bc10bd40/out/config.h\\\"\" -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"

  --- stderr
  thread 'main' panicked at '
  failed to execute command: No such file or directory (os error 2)
  is `cmake` not installed?

  build script failed, must exit now', /home/jsha/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

jsha avatar Apr 28 '22 18:04 jsha

yeah. that needs fixing.

algesten avatar Apr 28 '22 22:04 algesten

--- stderr
  thread 'main' panicked at '
  failed to execute command: No such file or directory (os error 2)
  is `cmake` not installed?

Isn't the problem that mbedtls builds some native stuff internally, and that requires cmake?

algesten avatar Apr 30 '22 12:04 algesten

Yes, good point- possible if I had cmake installed, everything would work just fine, because mbedtls probably ships with the native code it needs to build. But even so - I would rather not have a dev dependency on mbedtls. It's one more thing people need to download and build to contribute on ureq, and it's one more thing to go wrong.

It's probably better to make MbedTlsConnector its own package, e.g. ureq-mbedtls. That way no one takes the dependency - even for dev work - unless they need it.

jsha avatar Apr 30 '22 13:04 jsha

Happy to just remove it TBH. It's a nice example of how to implement another TLS library, but my own dev today has been slowed down by it too.

algesten avatar Apr 30 '22 14:04 algesten

It's probably better to make MbedTlsConnector its own package, e.g. ureq-mbedtls. That way no one takes the dependency - even for dev work - unless they need it.

I'm okay with that, as along as there is a CI action to build with it, so that it remains possible to do.

mcr avatar May 02 '22 00:05 mcr