Comments (6)
Hello,
Post here the full command and full output of how you compiled the ipfs library, as well as the output of nm --demangle ./lib/libipfs-http-client.so
from cpp-ipfs-http-client.
I use Ubuntu 18.04.4 LTS
I have already installed dependencies including:
-gcc,c++,g++: version 7.5.0
-Curl: download source and install (./configure && make && make install)
-JSON: download Json from github
-Cmake version 3.15.2. Compiled as the guidance of the following link: https://vasild.github.io/cpp-ipfs-http-client/
After finishing the installation, in the folder installed, having two folders: include, lib.
Then, I create the file myprog.cc as the guidance in this folder. And compile with the command:
c++ -std=c++11 -I./include -L./lib -lipfs-http-client myprog.cc -o myprog
The full output is:
/tmp/cctPIZ8r.o: In function `main':
myprog.cc:(.text+0x4f): undefined reference to `ipfs::Client::Client(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long)'
myprog.cc:(.text+0x78): undefined reference to `ipfs::Client::~Client()'
collect2: error: ld returned 1 exit status
I also attach the file containing the full output of the command: nm --demangle ./lib/libipfs-http-client.so
nm_command.txt
And the file myprog.cc
myprog.cc.txt
Thank you very much for your help!!!
from cpp-ipfs-http-client.
Your library seems to be healthy (based on the nm output), it should link. Try to provide the shared library directly: c++ -std=c++11 -I./include ./lib/libipfs-http-client.so myprog.cc -o myprog
. Or build a static library and try to link with it cmake -DBUILD_SHARED_LIBS:BOOL=OFF ...
.
from cpp-ipfs-http-client.
I have already run in the two ways, but can't solve these errors.
can you give me the installation guidance (maybe on Debian, Centos, Windows, ..)?
Thank you!
from cpp-ipfs-http-client.
This works for me (curl is installed system-wide in /usr/local
):
~$ mkdir /tmp/ipfs
~$ cd /tmp/ipfs
/tmp/ipfs$ git clone https://github.com/vasild/cpp-ipfs-http-client.git
/tmp/ipfs$ git clone https://github.com/nlohmann/json.git
/tmp/ipfs$ mkdir build
# build static library
/tmp/ipfs$ cd build
/tmp/ipfs/build$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/ipfs/install -DJSON_FOR_MODERN_CXX_INCLUDE_DIR:PATH=/tmp/ipfs/json/include ../cpp-ipfs-http-client
/tmp/ipfs/build$ make -j4
/tmp/ipfs/build$ make install
/tmp/ipfs/build$ ls -l /tmp/ipfs/install/lib/
-rw-r--r-- 1 vd vd 1803892 Mar 25 10:53 libipfs-http-client.a
/tmp/ipfs/build$ cd ..
/tmp/ipfs$ cat > myprog.cc <<EOF
> #include "ipfs/client.h"
>
> int main(int argc, char** argv) {
> ipfs::Client a("localhost", 5001);
> return 0;
> }
> EOF
/tmp/ipfs$ c++ -std=c++11 -I./json/include -I./install/include -L./install/lib -L/usr/local/lib -lipfs-http-client -lcurl myprog.cc -o myprog
# build shared library
/tmp/ipfs$ rm -fr build/* install
/tmp/ipfs$ cd build
/tmp/ipfs$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/ipfs/install -DJSON_FOR_MODERN_CXX_INCLUDE_DIR:PATH=/tmp/ipfs/json/include -DBUILD_SHARED_LIBS:BOOL=ON ../cpp-ipfs-http-client
/tmp/ipfs$ make -j4
/tmp/ipfs$ make install
/tmp/ipfs/build$ ls -l /tmp/ipfs/install/lib/
lrwxr-xr-x 1 vd vd 24 Mar 25 11:00 libipfs-http-client.so -> libipfs-http-client.so.0
lrwxr-xr-x 1 vd vd 28 Mar 25 11:00 libipfs-http-client.so.0 -> libipfs-http-client.so.0.4.0
-rwxr-xr-x 1 vd vd 986664 Mar 25 11:00 libipfs-http-client.so.0.4.0
/tmp/ipfs$ c++ -std=c++11 -I./json/include -I./install/include -L./install/lib -lipfs-http-client myprog.cc -o myprog
You must be doing something different or your system is somehow broken.
Good luck!
from cpp-ipfs-http-client.
The Errors have solved. maybe my system is broken.
I used "# build shared library" and before running the command ./myprog
I execute the command: export LD_LIBRARY_PATH=/tmp/ipfs/install/lib/
Thank you very much!
from cpp-ipfs-http-client.
Related Issues (20)
- ObjectData function not thread safe HOT 2
- Client crash when copy HOT 2
- Host a local server with this implementation? HOT 1
- CMake is excessive for this small program HOT 1
- Support for go-ipfs v0.5 HOT 1
- Which methods are missing
- Unable to catch IPFS connection issues
- Missing timeout option/setting HOT 1
- GitHub Actions HOT 6
- Reduce test time of 2 testcases HOT 1
- Discussion: Backwards incompatible interface change HOT 2
- Issue with client.FilesAdd(...) HOT 2
- Use infura with cpp-ipfs HOT 3
- Moving to cURL multi API HOT 6
- Suspecting downgraded performance HOT 1
- Could be nice to generate/install pkg-config file HOT 3
- #include <nlohmann/adl_serializer.hpp> not installed HOT 1
- coud support the asynchronous non-blocking send?
- Replace Deprecated /api/v0/dht endpoints by /api/v0/routing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpp-ipfs-http-client.