rust在Ubuntu上编译时解决问题的整理

我今天在编译一段rust程序的时候,遇见了几个问题,现在整理一下。
自己的 Cargo.toml如下:

name = "scrape_url"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
reqwest = { version = "0.11",features = ["blocking"]}
html2md = "0.2"

自己的全部代码在src/main.rs如下:

use std::fs;

fn main() {
  let url = "https://www.baidu.com/";
  let output = "baidu.md";

  println!("获取到的地址: {}", url);
  let body = reqwest::blocking::get(url).unwrap().text().unwrap();

  println!("正在转换中");
  let md = html2md::parse_html(&body);

  fs::write(output, md.as_bytes()).unwrap();
  println!("md文件放在{}.", output);
}

使用的命令是cargo run之后全部的描述如下:

 Updating crates.io index
  Downloaded cfg-if v1.0.0
  Downloaded bytes v1.1.0
  Downloaded futures-io v0.3.21
  Downloaded hashbrown v0.11.2
  Downloaded foreign-types v0.3.2
  Downloaded url v2.2.2
  Downloaded pin-utils v0.1.0
  Downloaded rand_pcg v0.2.1
  Downloaded proc-macro2 v1.0.36
  Downloaded try-lock v0.2.3
  Downloaded tower-service v0.3.1
  Downloaded utf-8 v0.7.6
  Downloaded want v0.3.0
  Downloaded autocfg v1.1.0
  Downloaded form_urlencoded v1.0.1
  Downloaded phf v0.8.0
  Downloaded tinyvec v1.5.1
  Downloaded tracing v0.1.31
  Downloaded futures-sink v0.3.21
  Downloaded quote v1.0.15
  Downloaded pkg-config v0.3.24
  Downloaded once_cell v1.9.0
  Downloaded slab v0.4.5
  Downloaded serde v1.0.136
  Downloaded ryu v1.0.9
  Downloaded tokio-util v0.6.9
  Downloaded regex v1.5.4
  Downloaded unicode-xid v0.2.2
  Downloaded bitflags v1.3.2
  Downloaded num_cpus v1.13.1
  Downloaded parking_lot_core v0.8.5
  Downloaded smallvec v1.8.0
  Downloaded unicode-normalization v0.1.19
  Downloaded unicode-bidi v0.3.7
  Downloaded foreign-types-shared v0.1.1
  Downloaded futures-task v0.3.21
  Downloaded futures-util v0.3.21
  Downloaded xml5ever v0.16.2
  Downloaded tinyvec_macros v0.1.0
  Downloaded hyper v0.14.17
  Downloaded mac v0.1.1
  Downloaded phf_shared v0.8.0
  Downloaded mime v0.3.16
  Downloaded markup5ever_rcdom v0.1.0
  Downloaded memchr v2.4.1
  Downloaded native-tls v0.2.8
  Downloaded openssl v0.10.38
  Downloaded matches v0.1.9
  Downloaded phf_codegen v0.8.0
  Downloaded new_debug_unreachable v1.0.4
  Downloaded rand_chacha v0.2.2
  Downloaded pin-project-lite v0.2.8
  Downloaded reqwest v0.11.9
  Downloaded tokio v1.17.0
  Downloaded regex-syntax v0.6.25
  Downloaded encoding_rs v0.8.30
  Downloaded libc v0.2.118
  Downloaded ppv-lite86 v0.2.16
  Downloaded precomputed-hash v0.1.1
  Downloaded hyper-tls v0.5.0
  Downloaded httparse v1.6.0
  Downloaded parking_lot v0.11.2
  Downloaded markup5ever v0.10.1
  Downloaded ipnet v2.3.1
  Downloaded indexmap v1.8.0
  Downloaded idna v0.2.3
  Downloaded log v0.4.14
  Downloaded lock_api v0.4.6
  Downloaded httpdate v1.0.2
  Downloaded html5ever v0.25.1
  Downloaded h2 v0.3.11
  Downloaded phf_generator v0.8.0
  Downloaded lazy_static v1.4.0
  Downloaded itoa v1.0.1
  Downloaded instant v0.1.12
  Downloaded http-body v0.4.4
  Downloaded http v0.2.6
  Downloaded html2md v0.2.13
  Downloaded string_cache v0.8.3
  Downloaded percent-encoding v2.1.0
  Downloaded getrandom v0.1.16
  Downloaded futf v0.1.5
  Downloaded futures-core v0.3.21
  Downloaded futures-channel v0.3.21
  Downloaded fnv v1.0.7
  Downloaded cc v1.0.73
  Downloaded tracing-core v0.1.22
  Downloaded tokio-native-tls v0.3.0
  Downloaded tendril v0.4.2
  Downloaded string_cache_codegen v0.5.1
  Downloaded siphasher v0.3.9
  Downloaded serde_urlencoded v0.7.1
  Downloaded scopeguard v1.1.0
  Downloaded rand_core v0.5.1
  Downloaded phf_shared v0.10.0
  Downloaded openssl-probe v0.1.5
  Downloaded openssl-sys v0.9.72
  Downloaded mio v0.8.0
  Downloaded base64 v0.13.0
  Downloaded aho-corasick v0.7.18
  Downloaded syn v1.0.86
  Downloaded time v0.1.44
  Downloaded socket2 v0.4.4
  Downloaded rand v0.7.3
  Downloaded 104 crates (7.1 MB) in 4.93s (largest was `encoding_rs` at 1.4 MB)
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.118
   Compiling log v0.4.14
   Compiling getrandom v0.1.16
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.36
   Compiling siphasher v0.3.9
   Compiling unicode-xid v0.2.2
   Compiling memchr v2.4.1
   Compiling ppv-lite86 v0.2.16
   Compiling lazy_static v1.4.0
   Compiling pin-project-lite v0.2.8
   Compiling serde v1.0.136
   Compiling cc v1.0.73
   Compiling pkg-config v0.3.24
   Compiling futures-core v0.3.21
   Compiling parking_lot_core v0.8.5
   Compiling bytes v1.1.0
   Compiling smallvec v1.8.0
   Compiling new_debug_unreachable v1.0.4
   Compiling scopeguard v1.1.0
   Compiling futures-task v0.3.21
   Compiling mac v0.1.1
   Compiling itoa v1.0.1
   Compiling syn v1.0.86
   Compiling futures-util v0.3.21
   Compiling fnv v1.0.7
   Compiling openssl v0.10.38
   Compiling foreign-types-shared v0.1.1
   Compiling utf-8 v0.7.6
   Compiling precomputed-hash v0.1.1
   Compiling httparse v1.6.0
   Compiling futures-sink v0.3.21
   Compiling futures-io v0.3.21
   Compiling slab v0.4.5
   Compiling once_cell v1.9.0
   Compiling tinyvec_macros v0.1.0
   Compiling bitflags v1.3.2
   Compiling percent-encoding v2.1.0
   Compiling native-tls v0.2.8
   Compiling matches v0.1.9
   Compiling futures-channel v0.3.21
   Compiling pin-utils v0.1.0
   Compiling hashbrown v0.11.2
   Compiling try-lock v0.2.3
   Compiling openssl-probe v0.1.5
   Compiling encoding_rs v0.8.30
   Compiling unicode-bidi v0.3.7
   Compiling tower-service v0.3.1
   Compiling httpdate v1.0.2
   Compiling regex-syntax v0.6.25
   Compiling ryu v1.0.9
   Compiling base64 v0.13.0
   Compiling ipnet v2.3.1
   Compiling mime v0.3.16
   Compiling instant v0.1.12
   Compiling indexmap v1.8.0
   Compiling phf_shared v0.8.0
   Compiling phf_shared v0.10.0
   Compiling tracing-core v0.1.22
   Compiling openssl-sys v0.9.72
   Compiling lock_api v0.4.6
   Compiling futf v0.1.5
   Compiling http v0.2.6
   Compiling foreign-types v0.3.2
   Compiling tinyvec v1.5.1
   Compiling form_urlencoded v1.0.1
   Compiling phf v0.8.0
   Compiling tracing v0.1.31
   Compiling tendril v0.4.2
error: failed to run custom build command for `openssl-sys v0.9.72`

Caused by:
  process didn't exit successfully: `/root/scrape_url/target/debug/build/openssl-sys-a9db19d7be43a3ce/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: "Could not run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`\nThe pkg-config command could not be found.\n\nMost likely, you need to install a pkg-config package for your OS.\nTry `apt install pkg-config`, or `yum install pkg-config`,\nor `pkg install pkg-config` depending on your distribution.\n\nIf you've already installed it, ensure the pkg-config command is one of the\ndirectories in the PATH environment variable.\n\nIf you did not expect this build to link to a pre-installed system library,\nthen check documentation of the openssl-sys crate for an option to\nbuild the library from source, or disable features or dependencies\nthat require pkg-config."

  --- stderr
  thread 'main' panicked at '

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.72


  It looks like you're compiling on Linux and also targeting Linux. Currently this requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config` could not be found. If you have OpenSSL installed you can likely fix this by installing `pkg-config`.

  ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.72/build/find_normal.rs:180: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

我觉得这是没有设置代理的错误,于是我使用export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static设置一下代理。再次执行cargo run,出现了下边的描述:

`  Compiling openssl-sys v0.9.72
   Compiling http-body v0.4.4
error: failed to run custom build command for `openssl-sys v0.9.72`

Caused by:
  process didn't exit successfully: `/root/scrape_url/target/debug/build/openssl                                                                                                             -sys-a9db19d7be43a3ce/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: "Could not run `\"pkg-config\" \"--libs\" \"--cflags\" \"                                                                                                             openssl\"`\nThe pkg-config command could not be found.\n\nMost likely, you need                                                                                                              to install a pkg-config package for your OS.\nTry `apt install pkg-config`, or `                                                                                                             yum install pkg-config`,\nor `pkg install pkg-config` depending on your distribu                                                                                                             tion.\n\nIf you've already installed it, ensure the pkg-config command is one of                                                                                                              the\ndirectories in the PATH environment variable.\n\nIf you did not expect thi                                                                                                             s build to link to a pre-installed system library,\nthen check documentation of                                                                                                              the openssl-sys crate for an option to\nbuild the library from source, or disabl                                                                                                             e features or dependencies\nthat require pkg-config."

  --- stderr
  thread 'main' panicked at '

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for th                                                                                                             e
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.72


  It looks like you're compiling on Linux and also targeting Linux. Currently th                                                                                                             is
  requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-confi                                                                                                             g`
  could not be found. If you have OpenSSL installed you can likely fix this by
  installing `pkg-config`.

  ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.72/bu                                                                                                             ild/find_normal.rs:180: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`

发现与上次的描述有些不一样,但错误还是相同的。我觉得是没有安装好libssl-dev导致的。
所以我使用sudo apt install libssl-dev安装,出现下边的提示:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libssl-dev

最后的解决方案是使用sudo apt-get update,出现了下面的提示:

Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal InRelease [265 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports InRelease [108 kB                                                                                                             ]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security InRelease [114 kB]
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu focal/multiverse Sources [174 kB]
Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe Sources [9,707 kB]
Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu focal/restricted Sources [6,472 B                                                                                                             ]
Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu focal/main Sources [847 kB]
Get:9 http://mirrors.cloud.aliyuncs.com/ubuntu focal/main i386 Packages [718 kB]
Get:10 http://mirrors.cloud.aliyuncs.com/ubuntu focal/main amd64 Packages [970 k                                                                                                             B]
Get:11 http://mirrors.cloud.aliyuncs.com/ubuntu focal/main Translation-en [506 k                                                                                                             B]
Get:12 http://mirrors.cloud.aliyuncs.com/ubuntu focal/main amd64 c-n-f Metadata                                                                                                              [29.5 kB]
Get:13 http://mirrors.cloud.aliyuncs.com/ubuntu focal/restricted amd64 Packages                                                                                                              [22.0 kB]
Get:14 http://mirrors.cloud.aliyuncs.com/ubuntu focal/restricted i386 Packages [                                                                                                             8,112 B]
Get:15 http://mirrors.cloud.aliyuncs.com/ubuntu focal/restricted Translation-en                                                                                                              [6,212 B]
Get:16 http://mirrors.cloud.aliyuncs.com/ubuntu focal/restricted amd64 c-n-f Met                                                                                                             adata [392 B]
Get:17 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe amd64 Packages [8                                                                                                             ,628 kB]
Get:18 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe i386 Packages [4,                                                                                                             642 kB]
Get:19 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe Translation-en [5                                                                                                             ,124 kB]
Get:20 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe amd64 c-n-f Metad                                                                                                             ata [265 kB]
Get:21 http://mirrors.cloud.aliyuncs.com/ubuntu focal/multiverse i386 Packages [                                                                                                             74.7 kB]
Get:22 http://mirrors.cloud.aliyuncs.com/ubuntu focal/multiverse amd64 Packages                                                                                                              [144 kB]
Get:23 http://mirrors.cloud.aliyuncs.com/ubuntu focal/multiverse Translation-en                                                                                                              [104 kB]
Get:24 http://mirrors.cloud.aliyuncs.com/ubuntu focal/multiverse amd64 c-n-f Met                                                                                                             adata [9,136 B]
Get:25 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/multiverse Sources                                                                                                              [19.1 kB]
Get:26 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main Sources [463                                                                                                              kB]
Get:27 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/universe Sources [                                                                                                             225 kB]
Get:28 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/restricted Sources                                                                                                              [32.9 kB]
Get:29 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main i386 Packages                                                                                                              [605 kB]
Get:30 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main amd64 Package                                                                                                             s [1,581 kB]
Get:31 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main Translation-e                                                                                                             n [304 kB]
Get:32 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main amd64 c-n-f M                                                                                                             etadata [14.7 kB]
Get:33 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/restricted i386 Pa                                                                                                             ckages [23.1 kB]
Get:34 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/restricted amd64 P                                                                                                             ackages [810 kB]
Get:35 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/restricted Transla                                                                                                             tion-en [115 kB]
Get:36 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/restricted amd64 c                                                                                                             -n-f Metadata [500 B]
Get:37 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/universe amd64 Pac                                                                                                             kages [904 kB]
Get:38 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/universe i386 Pack                                                                                                             ages [668 kB]
Get:39 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/universe Translati                                                                                                             on-en [200 kB]
Get:40 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/universe amd64 c-n                                                                                                             -f Metadata [20.1 kB]
Get:41 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/multiverse amd64 P                                                                                                             ackages [23.7 kB]
Get:42 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/multiverse i386 Pa                                                                                                             ckages [8,432 B]
Get:43 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/multiverse Transla                                                                                                             tion-en [7,312 B]
Get:44 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/multiverse amd64 c                                                                                                             -n-f Metadata [580 B]
Get:45 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/main Sources [6,                                                                                                             584 B]
Get:46 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/universe Sources                                                                                                              [8,372 B]
Get:47 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/main amd64 Packa                                                                                                             ges [42.0 kB]
Get:48 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/main i386 Packag                                                                                                             es [34.5 kB]
Get:49 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/main Translation                                                                                                             -en [10.0 kB]
Get:50 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/main amd64 c-n-f                                                                                                              Metadata [864 B]
Get:51 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/restricted amd64                                                                                                              c-n-f Metadata [116 B]
Get:52 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/universe i386 Pa                                                                                                             ckages [11.7 kB]
Get:53 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/universe amd64 P                                                                                                             ackages [21.6 kB]
Get:54 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/universe Transla                                                                                                             tion-en [15.0 kB]
Get:55 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/universe amd64 c                                                                                                             -n-f Metadata [716 B]
Get:56 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports/multiverse amd64                                                                                                              c-n-f Metadata [116 B]
Get:57 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/restricted Source                                                                                                             s [32.9 kB]
Get:58 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/main Sources [201                                                                                                              kB]
Get:59 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/universe Sources                                                                                                              [83.7 kB]
Get:60 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/main amd64 Packag                                                                                                             es [1,247 kB]
Get:61 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/main i386 Package                                                                                                             s [379 kB]
Get:62 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/main Translation-                                                                                                             en [219 kB]
Get:63 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/main amd64 c-n-f                                                                                                              Metadata [9,556 B]
Get:64 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/restricted i386 P                                                                                                             ackages [21.7 kB]
Get:65 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/restricted amd64                                                                                                              Packages [757 kB]
Get:66 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/restricted Transl                                                                                                             ation-en [108 kB]
Get:67 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/restricted amd64                                                                                                              c-n-f Metadata [504 B]
Get:68 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/universe i386 Pac                                                                                                             kages [534 kB]
Get:69 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/universe amd64 Pa                                                                                                             ckages [678 kB]
Get:70 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/universe Translat                                                                                                             ion-en [116 kB]
Get:71 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security/universe amd64 c-                                                                                                             n-f Metadata [13.1 kB]
Fetched 43.2 MB in 7s (6,283 kB/s)
Reading package lists... Done

再使用sudo apt install libssl-dev出现下边的提示:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  libssl-doc
The following NEW packages will be installed:
  libssl-dev
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 1,584 kB of archives.
After this operation, 8,009 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main amd64 libssl-dev amd64 1.1.1f-1ubuntu2.10 [1,584 kB]
Fetched 1,584 kB in 0s (7,513 kB/s)
Selecting previously unselected package libssl-dev:amd64.
(Reading database ... 113809 files and directories currently installed.)
Preparing to unpack .../libssl-dev_1.1.1f-1ubuntu2.10_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1f-1ubuntu2.10) ...
Setting up libssl-dev:amd64 (1.1.1f-1ubuntu2.10) ...

使用cargo run出现了下边的提示:

Compiling openssl-sys v0.9.72
   Compiling http-body v0.4.4
error: failed to run custom build command for `openssl-sys v0.9.72`

Caused by:
  process didn't exit successfully: `/root/scrape_url/target/debug/build/openssl-sys-a9db19d7be43a3ce/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: "Could not run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`\nThe pkg-config command could not be found.\n\nMost likely, you need to install a pkg-config package for your OS.\nTry `apt install pkg-config`, or `yum install pkg-config`,\nor `pkg install pkg-config` depending on your distribution.\n\nIf you've already installed it, ensure the pkg-config command is one of the\ndirectories in the PATH environment variable.\n\nIf you did not expect this build to link to a pre-installed system library,\nthen check documentation of the openssl-sys crate for an option to\nbuild the library from source, or disable features or dependencies\nthat require pkg-config."

  --- stderr
  thread 'main' panicked at '

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.72


  It looks like you're compiling on Linux and also targeting Linux. Currently this
  requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
  could not be found. If you have OpenSSL installed you can likely fix this by
  installing `pkg-config`.

  ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.72/build/find_normal.rs:180: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

这是因为没有清理以前的缓存所致,使用rm -rf Cargo.lock target/清理。使用cargo run出现下边的提示:

Updating crates.io index
error: failed to get `html2md` as a dependency of package `scrape_url v0.1.0 (/root/scrape_url)`

Caused by:
  failed to load source for dependency `html2md`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)

我以为是git没有安装的缘故,所以又使用sudo apt-get install git安装git,结果出现的提示跟上边从Updating crates.io indexnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish…
error: build failed
一样,完全没有任何变化。
使用apt install pkg-config安装pkg-config,出现的提示如下:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  pkg-config
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 45.5 kB of archives.
After this operation, 195 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal/main amd64 pkg-config amd64 0.29.1-0ubuntu4 [45.5 kB]
Fetched 45.5 kB in 0s (1,794 kB/s)
Selecting previously unselected package pkg-config.
(Reading database ... 114870 files and directories currently installed.)
Preparing to unpack .../pkg-config_0.29.1-0ubuntu4_amd64.deb ...
Unpacking pkg-config (0.29.1-0ubuntu4) ...
Setting up pkg-config (0.29.1-0ubuntu4) ...
Processing triggers for man-db (2.9.1-1) ...

使用cargo run出现下边的提示:

    Updating crates.io index
error: failed to get `html2md` as a dependency of package `scrape_url v0.1.0 (/root/scrape_url)`

Caused by:
  failed to load source for dependency `html2md`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)

我使用vim ${HOME}/.cargo/config命令后按i填上去下边的内容:

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 指定镜像
replace-with = 'sjtu' # 使用source.ustc来替代
# 若 replace-with = 'tuna'的话,就是使用清华大学的镜像来设置国内下载依赖包地址

# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# 中国科学技术大学
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"

# rustcc社区
[source.rustcc]
registry = "https://code.aliyun.com/rustcc/crates.io-index.git"

ESC之后,然后按“:”输入“wq”保存,又输入cargo run出现下边的提示:

   Updating `sjtu` index
  Downloaded precomputed-hash v0.1.1 (registry `sjtu`)
  Downloaded phf v0.8.0 (registry `sjtu`)
  Downloaded new_debug_unreachable v1.0.4 (registry `sjtu`)
  Downloaded tinyvec_macros v0.1.0 (registry `sjtu`)
  Downloaded phf_codegen v0.8.0 (registry `sjtu`)
  Downloaded phf_shared v0.10.0 (registry `sjtu`)
  Downloaded phf_shared v0.8.0 (registry `sjtu`)
  Downloaded matches v0.1.9 (registry `sjtu`)
  Downloaded base64 v0.13.0 (registry `sjtu`)
  Downloaded tendril v0.4.2 (registry `sjtu`)
  Downloaded bitflags v1.3.2 (registry `sjtu`)
  Downloaded h2 v0.3.11 (registry `sjtu`)
  Downloaded percent-encoding v2.1.0 (registry `sjtu`)
  Downloaded hashbrown v0.11.2 (registry `sjtu`)
  Downloaded aho-corasick v0.7.18 (registry `sjtu`)
  Downloaded openssl v0.10.38 (registry `sjtu`)
  Downloaded regex-syntax v0.6.25 (registry `sjtu`)
  Downloaded lazy_static v1.4.0 (registry `sjtu`)
  Downloaded phf_generator v0.8.0 (registry `sjtu`)
  Downloaded futures-core v0.3.21 (registry `sjtu`)
  Downloaded tracing v0.1.31 (registry `sjtu`)
  Downloaded lock_api v0.4.6 (registry `sjtu`)
  Downloaded rand_pcg v0.2.1 (registry `sjtu`)
  Downloaded proc-macro2 v1.0.36 (registry `sjtu`)
  Downloaded cc v1.0.73 (registry `sjtu`)
  Downloaded form_urlencoded v1.0.1 (registry `sjtu`)
  Downloaded encoding_rs v0.8.30 (registry `sjtu`)
  Downloaded tokio-native-tls v0.3.0 (registry `sjtu`)
  Downloaded smallvec v1.8.0 (registry `sjtu`)
  Downloaded unicode-xid v0.2.2 (registry `sjtu`)
  Downloaded futures-io v0.3.21 (registry `sjtu`)
  Downloaded html5ever v0.25.1 (registry `sjtu`)
  Downloaded markup5ever v0.10.1 (registry `sjtu`)
  Downloaded openssl-probe v0.1.5 (registry `sjtu`)
  Downloaded time v0.1.44 (registry `sjtu`)
  Downloaded idna v0.2.3 (registry `sjtu`)
  Downloaded parking_lot_core v0.8.5 (registry `sjtu`)
  Downloaded url v2.2.2 (registry `sjtu`)
  Downloaded rand_chacha v0.2.2 (registry `sjtu`)
  Downloaded fnv v1.0.7 (registry `sjtu`)
  Downloaded httparse v1.6.0 (registry `sjtu`)
  Downloaded quote v1.0.15 (registry `sjtu`)
  Downloaded tokio v1.17.0 (registry `sjtu`)
  Downloaded libc v0.2.118 (registry `sjtu`)
  Downloaded http v0.2.6 (registry `sjtu`)
  Downloaded getrandom v0.1.16 (registry `sjtu`)
  Downloaded mime v0.3.16 (registry `sjtu`)
  Downloaded try-lock v0.2.3 (registry `sjtu`)
  Downloaded hyper-tls v0.5.0 (registry `sjtu`)
  Downloaded pkg-config v0.3.24 (registry `sjtu`)
  Downloaded ryu v1.0.9 (registry `sjtu`)
  Downloaded syn v1.0.86 (registry `sjtu`)
  Downloaded futf v0.1.5 (registry `sjtu`)
  Downloaded string_cache_codegen v0.5.1 (registry `sjtu`)
  Downloaded want v0.3.0 (registry `sjtu`)
  Downloaded html2md v0.2.13 (registry `sjtu`)
  Downloaded memchr v2.4.1 (registry `sjtu`)
  Downloaded parking_lot v0.11.2 (registry `sjtu`)
  Downloaded indexmap v1.8.0 (registry `sjtu`)
  Downloaded http-body v0.4.4 (registry `sjtu`)
  Downloaded tinyvec v1.5.1 (registry `sjtu`)
  Downloaded xml5ever v0.16.2 (registry `sjtu`)
  Downloaded markup5ever_rcdom v0.1.0 (registry `sjtu`)
  Downloaded itoa v1.0.1 (registry `sjtu`)
  Downloaded string_cache v0.8.3 (registry `sjtu`)
  Downloaded cfg-if v1.0.0 (registry `sjtu`)
  Downloaded httpdate v1.0.2 (registry `sjtu`)
  Downloaded pin-project-lite v0.2.8 (registry `sjtu`)
  Downloaded autocfg v1.1.0 (registry `sjtu`)
  Downloaded foreign-types-shared v0.1.1 (registry `sjtu`)
  Downloaded tower-service v0.3.1 (registry `sjtu`)
  Downloaded futures-task v0.3.21 (registry `sjtu`)
  Downloaded once_cell v1.9.0 (registry `sjtu`)
  Downloaded futures-sink v0.3.21 (registry `sjtu`)
  Downloaded pin-utils v0.1.0 (registry `sjtu`)
  Downloaded log v0.4.14 (registry `sjtu`)
  Downloaded mio v0.8.0 (registry `sjtu`)
  Downloaded slab v0.4.5 (registry `sjtu`)
  Downloaded native-tls v0.2.8 (registry `sjtu`)
  Downloaded num_cpus v1.13.1 (registry `sjtu`)
  Downloaded foreign-types v0.3.2 (registry `sjtu`)
  Downloaded socket2 v0.4.4 (registry `sjtu`)
  Downloaded hyper v0.14.17 (registry `sjtu`)
  Downloaded unicode-bidi v0.3.7 (registry `sjtu`)
  Downloaded rand v0.7.3 (registry `sjtu`)
  Downloaded unicode-normalization v0.1.19 (registry `sjtu`)
  Downloaded bytes v1.1.0 (registry `sjtu`)
  Downloaded instant v0.1.12 (registry `sjtu`)
  Downloaded regex v1.5.4 (registry `sjtu`)
  Downloaded futures-channel v0.3.21 (registry `sjtu`)
  Downloaded mac v0.1.1 (registry `sjtu`)
  Downloaded futures-util v0.3.21 (registry `sjtu`)
  Downloaded ppv-lite86 v0.2.16 (registry `sjtu`)
  Downloaded tokio-util v0.6.9 (registry `sjtu`)
  Downloaded ipnet v2.3.1 (registry `sjtu`)
  Downloaded utf-8 v0.7.6 (registry `sjtu`)
  Downloaded serde_urlencoded v0.7.1 (registry `sjtu`)
  Downloaded openssl-sys v0.9.72 (registry `sjtu`)
  Downloaded siphasher v0.3.9 (registry `sjtu`)
  Downloaded reqwest v0.11.9 (registry `sjtu`)
  Downloaded tracing-core v0.1.22 (registry `sjtu`)
  Downloaded rand_core v0.5.1 (registry `sjtu`)
  Downloaded scopeguard v1.1.0 (registry `sjtu`)
  Downloaded serde v1.0.136 (registry `sjtu`)
  Downloaded 104 crates (7.1 MB) in 1.19s (largest was `encoding_rs` at 1.4 MB)
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.118
   Compiling log v0.4.14
   Compiling getrandom v0.1.16
   Compiling autocfg v1.1.0
   Compiling siphasher v0.3.9
   Compiling proc-macro2 v1.0.36
   Compiling memchr v2.4.1
   Compiling unicode-xid v0.2.2
   Compiling lazy_static v1.4.0
   Compiling ppv-lite86 v0.2.16
   Compiling pin-project-lite v0.2.8
   Compiling pkg-config v0.3.24
   Compiling cc v1.0.73
   Compiling serde v1.0.136
   Compiling parking_lot_core v0.8.5
   Compiling bytes v1.1.0
   Compiling futures-core v0.3.21
   Compiling scopeguard v1.1.0
   Compiling new_debug_unreachable v1.0.4
   Compiling smallvec v1.8.0
   Compiling syn v1.0.86
   Compiling itoa v1.0.1
   Compiling futures-task v0.3.21
   Compiling mac v0.1.1
   Compiling foreign-types-shared v0.1.1
   Compiling fnv v1.0.7
   Compiling utf-8 v0.7.6
   Compiling openssl v0.10.38
   Compiling precomputed-hash v0.1.1
   Compiling futures-util v0.3.21
   Compiling once_cell v1.9.0
   Compiling futures-io v0.3.21
   Compiling slab v0.4.5
   Compiling bitflags v1.3.2
   Compiling httparse v1.6.0
   Compiling tinyvec_macros v0.1.0
   Compiling futures-sink v0.3.21
   Compiling native-tls v0.2.8
   Compiling pin-utils v0.1.0
   Compiling futures-channel v0.3.21
   Compiling percent-encoding v2.1.0
   Compiling hashbrown v0.11.2
   Compiling matches v0.1.9
   Compiling openssl-probe v0.1.5
   Compiling try-lock v0.2.3
   Compiling encoding_rs v0.8.30
   Compiling unicode-bidi v0.3.7
   Compiling tower-service v0.3.1
   Compiling httpdate v1.0.2
   Compiling ryu v1.0.9
   Compiling regex-syntax v0.6.25
   Compiling mime v0.3.16
   Compiling base64 v0.13.0
   Compiling ipnet v2.3.1
   Compiling instant v0.1.12
   Compiling phf_shared v0.8.0
   Compiling phf_shared v0.10.0
   Compiling indexmap v1.8.0
   Compiling tracing-core v0.1.22
   Compiling openssl-sys v0.9.72
   Compiling lock_api v0.4.6
   Compiling futf v0.1.5
   Compiling foreign-types v0.3.2
   Compiling http v0.2.6
   Compiling tinyvec v1.5.1
   Compiling form_urlencoded v1.0.1
   Compiling phf v0.8.0
   Compiling tracing v0.1.31
   Compiling tendril v0.4.2
   Compiling unicode-normalization v0.1.19
   Compiling want v0.3.0
   Compiling http-body v0.4.4
   Compiling mio v0.8.0
   Compiling socket2 v0.4.4
   Compiling num_cpus v1.13.1
   Compiling time v0.1.44
   Compiling quote v1.0.15
   Compiling aho-corasick v0.7.18
   Compiling idna v0.2.3
   Compiling serde_urlencoded v0.7.1
   Compiling parking_lot v0.11.2
   Compiling tokio v1.17.0
   Compiling rand_core v0.5.1
   Compiling regex v1.5.4
   Compiling url v2.2.2
   Compiling string_cache v0.8.3
   Compiling rand_chacha v0.2.2
   Compiling rand_pcg v0.2.1
   Compiling tokio-util v0.6.9
   Compiling html5ever v0.25.1
   Compiling rand v0.7.3
   Compiling h2 v0.3.11
   Compiling tokio-native-tls v0.3.0
   Compiling phf_generator v0.8.0
   Compiling string_cache_codegen v0.5.1
   Compiling phf_codegen v0.8.0
   Compiling markup5ever v0.10.1
   Compiling hyper v0.14.17
   Compiling xml5ever v0.16.2
   Compiling markup5ever_rcdom v0.1.0
   Compiling hyper-tls v0.5.0
   Compiling html2md v0.2.13
   Compiling reqwest v0.11.9
   Compiling scrape_url v0.1.0 (/root/scrape_url)
    Finished dev [unoptimized + debuginfo] target(s) in 4m 06s
     Running `target/debug/scrape_url`
获取到的地址: https://www.baidu.com/
正在转换中
md文件放在baidu.md.

这就是运行成功了,成功解决问题。我感觉最开始的问题就是有两点:第一点是我应该使用sudo apt-get update更新安装源,第二点是需要设置cargo的国内代理。这篇文章是为了记录下来所遇到的问题以及我解决问题的思路,所以不想落下一个细节,因而比较琐碎。

你可能感兴趣的:(rust学习,rust,开发语言,后端)