-
Notifications
You must be signed in to change notification settings - Fork 21
Mac & Linux Install
This library currently uses C++11.
It has the following depencies:
- C++ Requests built by ourselves
- JSON For Modern C++ built by ourselves
- Keccak Code Package built by ourselves
The library is based on cmake
for the compilation. In order to build the library, follow these steps:
# Clone the project
git clone --recursive https://github.com/thibault-martinez/iota.lib.cpp.git
# Go inside the project directory
cd iota.lib.cpp
# Get dependencies submodule
git submodule update --init
# Create a build directory and move into it
mkdir build && cd build
# Generate the Makefile using CMake
cmake .. -DCMAKE_BUILD_TYPE=Release
# Build the library
make
# Install the library
make install
Then, you just have to include <iota/iota>
in your source files and link the iota
library with your project.
Please refer to this page of the wiki.
If at some point your compilation terminates with an output similar to:
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
_Curl_ossl_cleanup in openssl.c.o
_Curl_ossl_close_all in openssl.c.o
"_SSL_COMP_free_compression_methods", referenced from:
_Curl_ossl_cleanup in openssl.c.o
"_SSL_CTX_set_alpn_protos", referenced from:
_ossl_connect_step1 in openssl.c.o
"_SSL_CTX_set_next_proto_select_cb", referenced from:
_ossl_connect_step1 in openssl.c.o
"_SSL_get0_alpn_selected", referenced from:
_ossl_connect_step2 in openssl.c.o
Then you may be in one of the following cases:
- You do not have openSSL installed on your system
- You do have openSSL installed on your system, but it is an old version or a broken package
- You do have multiple openSSL versions installed on your system, including a valid package, but it the linker is using the wrong openSSL library.
This is particularly true on MacOS systems where an old openSSL package is shipped (second case in the list above).
To solve it, you would need to install or re-install the openSSL package and make sure that your PATH contains the path to your openSSL installation.
If you do have multiple openSSL libraries installed, make sure that the path to the most recent one appears before any other path in your PATH environment variable.
You can install openSSL as follow:
- on MacOS: brew install openssl && brew link openssl
- on Linux:apt-get install libssl-dev
For Mac users, if brew fails to link openSSL with a message similar to:
Warning: Refusing to link: openSSL
Linking keg-only OpenSSL means you may end up linking against the insecure,
deprecated system version while using the headers from the Homebrew version.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
You can do one of the following:
- Refer to https://github.com/dotnet/cli/issues/3964
- Add the path to the OpenSSL library to your PATH environment variable, as explained above. The path is given in the error output (in the current example, /usr/local/opt/openssl/lib).
For more information about this issue, you can refer to:
- https://github.com/thibault-martinez/iota.lib.cpp/issues/154
- https://github.com/topcpporg/cinatra/issues/13
- https://github.com/warmcat/libwebsockets/issues/683
- https://stackoverflow.com/questions/45878493/how-to-fix-undefined-symbols-for-architecture-x86-64-boost-asio-1-58
- https://stackoverflow.com/questions/12592328/err-remove-thread-state-linker-error-on-libcurl-usage
Need more information? Open an issue.