Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to build and add the cpr lib without CMake or any package manager ? #928

Open
ssantos21 opened this issue Jul 13, 2023 · 2 comments

Comments

@ssantos21
Copy link

ssantos21 commented Jul 13, 2023

Is there a way to build and add the cpr lib without CMake or any package manager ?

I ran the following commands as per README:

$ sudo apt install -y libcurl4-openssl-dev
$ git clone https://github.com/libcpr/cpr.git
$ cd cpr && mkdir build && cd build
$ cmake .. -DCPR_USE_SYSTEM_CURL=ON
$ cmake --build .
$ sudo cmake --install .

So created the client.cpp file:

#include <cpr/cpr.h>

int main() {
    cpr::Response r = cpr::Get(cpr::Url{"http://www.httpbin.org/get"},
        cpr::Parameters{{"hello", "world"}});
    return 0;
}

And built it:

g++ -std=c++20 client.cpp -lcpr -lcurl -o client_bin

But when I run .\client_bin I get the error:

./client_bin: error while loading shared libraries: libcpr.so.1: cannot open shared object file: No such file or directory

How can I use this project without relaying on CMake or any package manager ?

OS: Ubuntu 22.04
GCC version: 11.3.0

@ssantos21
Copy link
Author

This was apparently resolved by running ldconfig.

https://stackoverflow.com/a/13132584

@COM8
Copy link
Member

COM8 commented Jul 13, 2023

@ssantos21 I'm glad you solved it! Using ldconfig is something we should document. I will keep this issue open until we have done so.
Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants