How to install sqlx-cli in Pop!_OS 22.04

How to fix the installation issue on Pop!_OS

uname -r
6.5.4-76060504-generic

lsb_release -a
No LSB modules are available.
Distributor ID:	Pop
Description:	Pop!_OS 22.04 LTS
Release:	22.04
Codename:	jammy
code-warp/ch_07  🍣 main 📝 ×6🛤️  ×1🦀 v1.72.1 
➜ cargo install sqlx-cli  
    Updating crates.io index
  Installing sqlx-cli v0.7.2
    Updating crates.io index
   Compiling proc-macro2 v1.0.69
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.149
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling serde v1.0.188
   Compiling typenum v1.17.0
   Compiling const-oid v0.9.5
   Compiling pkg-config v0.3.27
   Compiling vcpkg v0.2.15
   Compiling futures-core v0.3.28
   Compiling smallvec v1.11.1
   Compiling libm v0.2.8
   Compiling generic-array v0.14.7
   Compiling subtle v2.5.0
   Compiling once_cell v1.18.0
   Compiling num-traits v0.2.17
   Compiling pin-project-lite v0.2.13
   Compiling memchr v2.6.4
   Compiling lock_api v0.4.10
   Compiling slab v0.4.9
   Compiling ahash v0.8.3
   Compiling scopeguard v1.2.0
   Compiling futures-task v0.3.28
   Compiling futures-channel v0.3.28
   Compiling futures-sink v0.3.28
   Compiling tinyvec_macros v0.1.1
   Compiling quote v1.0.33
   Compiling tinyvec v1.6.0
   Compiling parking_lot_core v0.9.8
   Compiling log v0.4.20
   Compiling syn v2.0.38
   Compiling cc v1.0.83
   Compiling futures-util v0.3.28
   Compiling getrandom v0.2.10
   Compiling mio v0.8.8
   Compiling num_cpus v1.16.0
   Compiling socket2 v0.5.4
   Compiling rand_core v0.6.4
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling unicode-normalization v0.1.22
   Compiling pin-utils v0.1.0
   Compiling zeroize v1.6.0
   Compiling foreign-types-shared v0.1.1
   Compiling futures-io v0.3.28
   Compiling bytes v1.5.0
   Compiling crossbeam-utils v0.8.16
   Compiling allocator-api2 v0.2.16
   Compiling ppv-lite86 v0.2.17
   Compiling serde_json v1.0.107
   Compiling openssl v0.10.57
   Compiling base64ct v1.6.0
   Compiling unicode-bidi v0.3.13
   Compiling hashbrown v0.14.1
   Compiling openssl-sys v0.9.93
   Compiling rand_chacha v0.3.1
   Compiling foreign-types v0.3.2
   Compiling num-integer v0.1.45
   Compiling crossbeam-queue v0.3.8
   Compiling minimal-lexical v0.2.1
   Compiling paste v1.0.14
   Compiling pem-rfc7468 v0.7.0
   Compiling utf8parse v0.2.1
   Compiling ryu v1.0.15
   Compiling percent-encoding v2.3.0
   Compiling byteorder v1.5.0
   Compiling cpufeatures v0.2.9
   Compiling thiserror v1.0.49
   Compiling itoa v1.0.9
   Compiling native-tls v0.2.11
   Compiling form_urlencoded v1.2.0
   Compiling der v0.7.8
   Compiling nom v7.1.3
error: failed to run custom build command for `openssl-sys v0.9.93`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installM1Aus7/release/build/openssl-sys-b4e4395cdce60005/build-script-main` (exit status: 101)
  --- stdout
  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: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1
  error: could not find system library 'openssl' required by the 'openssl-sys' crate

  --- stderr
  Package openssl was not found in the pkg-config search path.
  Perhaps you should add the directory containing `openssl.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'openssl' found


  --- 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.93

  ', /home/marmota/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.93/build/find_normal.rs:190:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `sqlx-cli v0.7.2`, intermediate artifacts can be found at `/tmp/cargo-installM1Aus7`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

fix is

code-warp/ch_07  🍣 main 📝 ×6🛤️  ×1🦀 v1.72.1 
✖  sudo apt install libssl-dev
Reading package lists... Done
Building dependency tree... Done
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 0 not upgraded.
Need to get 2,372 kB of archives.
After this operation, 12.4 MB of additional disk space will be used.
Get:1 http://apt.pop-os.org/ubuntu jammy-security/main amd64 libssl-dev amd64 3.0.2-0ubuntu1.10 [2,372 kB]
Fetched 2,372 kB in 1s (4,701 kB/s)  
Selecting previously unselected package libssl-dev:amd64.
(Reading database ... 250759 files and directories currently installed.)
Preparing to unpack .../libssl-dev_3.0.2-0ubuntu1.10_amd64.deb ...
Unpacking libssl-dev:amd64 (3.0.2-0ubuntu1.10) ...
Setting up libssl-dev:amd64 (3.0.2-0ubuntu1.10) ...

now it works

code-warp/ch_07  🍣 main 📝 ×6🛤️  ×1🦀 v1.72.1 
➜ cargo install sqlx-cli     
    Updating crates.io index
  Installing sqlx-cli v0.7.2
    Updating crates.io index
   Compiling proc-macro2 v1.0.69
   Compiling unicode-ident v1.0.12
   Compiling autocfg v1.1.0
   Compiling libc v0.2.149
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling serde v1.0.188
   Compiling typenum v1.17.0
   Compiling const-oid v0.9.5
   Compiling pkg-config v0.3.27
   Compiling vcpkg v0.2.15
   Compiling futures-core v0.3.28
   Compiling libm v0.2.8
   Compiling smallvec v1.11.1
   Compiling generic-array v0.14.7
   Compiling subtle v2.5.0
   Compiling once_cell v1.18.0
   Compiling num-traits v0.2.17
   Compiling pin-project-lite v0.2.13
   Compiling memchr v2.6.4
   Compiling lock_api v0.4.10
   Compiling slab v0.4.9
   Compiling ahash v0.8.3
   Compiling futures-channel v0.3.28
   Compiling futures-task v0.3.28
   Compiling quote v1.0.33
   Compiling tinyvec_macros v0.1.1
   Compiling scopeguard v1.2.0
   Compiling futures-sink v0.3.28
   Compiling cc v1.0.83
   Compiling tinyvec v1.6.0
   Compiling syn v2.0.38
   Compiling log v0.4.20
   Compiling parking_lot_core v0.9.8
   Compiling futures-util v0.3.28
   Compiling ppv-lite86 v0.2.17
   Compiling unicode-bidi v0.3.13
   Compiling serde_json v1.0.107
   Compiling futures-io v0.3.28
   Compiling zeroize v1.6.0
   Compiling unicode-normalization v0.1.22
   Compiling getrandom v0.2.10
   Compiling socket2 v0.5.4
   Compiling mio v0.8.8
   Compiling rand_core v0.6.4
   Compiling openssl-sys v0.9.93
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling digest v0.10.7
   Compiling num_cpus v1.16.0
   Compiling allocator-api2 v0.2.16
   Compiling foreign-types-shared v0.1.1
   Compiling crossbeam-utils v0.8.16
   Compiling base64ct v1.6.0
   Compiling openssl v0.10.57
   Compiling bytes v1.5.0
   Compiling pin-utils v0.1.0
   Compiling pem-rfc7468 v0.7.0
   Compiling hashbrown v0.14.1
   Compiling foreign-types v0.3.2
   Compiling rand_chacha v0.3.1
   Compiling num-integer v0.1.45
   Compiling utf8parse v0.2.1
   Compiling percent-encoding v2.3.0
   Compiling byteorder v1.5.0
   Compiling itoa v1.0.9
   Compiling ryu v1.0.15
   Compiling native-tls v0.2.11
   Compiling thiserror v1.0.49
   Compiling crossbeam-queue v0.3.8
   Compiling paste v1.0.14
   Compiling minimal-lexical v0.2.1
   Compiling cpufeatures v0.2.9
   Compiling form_urlencoded v1.2.0
   Compiling parking_lot v0.12.1
   Compiling rand v0.8.5
   Compiling der v0.7.8
   Compiling nom v7.1.3
   Compiling idna v0.4.0
   Compiling tracing-core v0.1.31
   Compiling num-iter v0.1.43
   Compiling openssl-probe v0.1.5
   Compiling spin v0.5.2
   Compiling unicode_categories v0.1.1
   Compiling crc-catalog v2.2.0
   Compiling equivalent v1.0.1
   Compiling crc v3.0.1
   Compiling indexmap v2.0.2
   Compiling lazy_static v1.4.0
   Compiling url v2.4.1
   Compiling futures-intrusive v0.5.0
   Compiling spki v0.7.2
   Compiling sha2 v0.10.8
   Compiling hashlink v0.8.4
   Compiling atoi v2.0.0
   Compiling memoffset v0.6.5
   Compiling hex v0.4.3
   Compiling event-listener v2.5.3
   Compiling dotenvy v0.15.7
   Compiling num-bigint-dig v0.8.4
   Compiling rustix v0.38.18
   Compiling pkcs8 v0.10.2
   Compiling anstyle-parse v0.2.2
   Compiling hmac v0.12.1
   Compiling libsqlite3-sys v0.26.0
   Compiling colorchoice v1.0.0
   Compiling anstyle v1.0.4
   Compiling finl_unicode v1.2.0
   Compiling linux-raw-sys v0.4.10
   Compiling anstyle-query v1.0.0
   Compiling anstream v0.6.4
   Compiling stringprep v0.1.4
   Compiling hkdf v0.12.3
   Compiling pkcs1 v0.7.5
   Compiling sha1 v0.10.6
   Compiling md-5 v0.10.6
   Compiling signature v2.1.0
   Compiling dirs-sys-next v0.1.2
   Compiling spin v0.9.8
   Compiling nibble_vec v0.1.0
   Compiling whoami v1.4.1
   Compiling bitflags v1.3.2
   Compiling unicode-width v0.1.11
   Compiling endian-type v0.1.2
   Compiling camino v1.1.6
   Compiling heck v0.4.1
   Compiling strsim v0.10.0
   Compiling clap_lex v0.5.1
   Compiling semver v1.0.20
   Compiling base64 v0.21.4
   Compiling clap_builder v4.4.6
   Compiling radix_trie v0.2.1
   Compiling nix v0.23.2
   Compiling serde_derive v1.0.188
   Compiling tokio-macros v2.1.0
   Compiling futures-macro v0.3.28
   Compiling openssl-macros v0.1.1
   Compiling tracing-attributes v0.1.26
   Compiling thiserror-impl v1.0.49
   Compiling clap_derive v4.4.2
   Compiling rsa v0.9.2
   Compiling tokio v1.33.0
   Compiling flume v0.11.0
   Compiling dirs-next v2.0.0
   Compiling async-trait v0.1.73
   Compiling anyhow v1.0.75
   Compiling tracing v0.1.37
   Compiling home v0.5.5
   Compiling unicode-segmentation v1.10.1
   Compiling instant v0.1.12
   Compiling iana-time-zone v0.1.57
   Compiling chrono v0.4.31
   Compiling clap v4.4.6
   Compiling clap_complete v4.4.3
   Compiling futures-executor v0.3.28
   Compiling futures v0.3.28
   Compiling tokio-stream v0.1.14
   Compiling backoff v0.4.0
   Compiling console v0.15.7
   Compiling filetime v0.2.22
   Compiling glob v0.3.1
   Compiling bitflags v2.4.0
   Compiling either v1.9.0
   Compiling itertools v0.11.0
   Compiling cargo-platform v0.1.4
   Compiling cargo_metadata v0.14.2
   Compiling sqlformat v0.2.2
   Compiling fd-lock v3.0.13
   Compiling rustyline v9.1.2
   Compiling promptly v0.3.1
   Compiling sqlx-core v0.7.2
   Compiling sqlx-postgres v0.7.2
   Compiling sqlx-mysql v0.7.2
   Compiling sqlx-sqlite v0.7.2
   Compiling sqlx v0.7.2
   Compiling sqlx-cli v0.7.2
    Finished release [optimized] target(s) in 1m 16s
  Installing /home/marmota/.cargo/bin/cargo-sqlx
  Installing /home/marmota/.cargo/bin/sqlx
   Installed package `sqlx-cli v0.7.2` (executables `cargo-sqlx`, `sqlx`)