#Unable to compile actix-web project in Ubuntu 22.04

6 messages · Page 1 of 1 (latest)

orchid glacier
#

Hi! I'm new to rust and try to create a REST API server using actix-web framework, however I got this error when I run cargo run. Please help

Compiling actix-web-boilerplate v0.1.0 (/root/projects/actix-web-boilerplate)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/rustcxSWYtT/symbols.o" "/root/projects/actix-web-boilerplate/target/debug/deps/actix_web_boilerplate-871756d604c32986.1065j4b0asqh1xa9.rcgu.o" "/root/projects/actix-web-boilerplate/target/debug/deps/actix_web_boilerplate-871756d604c32986.10e43iee2tpw44xu.rcgu.o" "/root/projects/actix-web-boilerplate/target/debug/deps/actix_web_boilerplate-871756d604c32986.11hkbx0tv2dz6zlg.rcgu.o" "/root/projects/actix-web-boilerplate/target/debug/deps/actix_web_boilerplate-...<long error message>...ate/target/debug/deps/actix_web_boilerplate-871756d604c32986" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lpq
          collect2: error: ld returned 1 exit status
          

error: could not compile `actix-web-boilerplate` due to previous error

This is my Cargo.toml

[package]
name = "actix-web-boilerplate"
version = "0.1.0"

[dependencies]
actix = "0.13"
actix-web = "4.0"
r2d2 = "0.8.9"
serde = "1.0.137"
serde_derive = "1.0.137"
serde_json = "1.0.80"
actix-rt = "2.7.0"
config = "0.13.1"
lazy_static = "1.4.0"

[dependencies.diesel]
features = ["postgres", "r2d2"]
version = "1.4.8"
dry frost
#

ugh, postgres

#

you need to install libpq

#

I think it was sudo apt install libpq-dev

#

I've had the same problem before ferrisballSweat

orchid glacier
#

Ah thanks, it works