1

As I am currently working on an application that uses the iota.c library, I have been using the example from last years master branch of this repo, which worked fine up until now, but seems to stop working. Transactions are failing and I don't know if this is the result of the chrysalis update. However, I want to update my lib adapter to the newest "dev" commit as the repository has some working example application which are also working fine. When building and linking the iota.c lib (which produces 7 static lib files) to my own app though, I get a some undefined references. After looking into the iota.c cmake recipes it looks like, the examples are linking the object files of the source files directly with the example app and not from the static library.

Is that something that might be fixed soon?

I know that the iota.c library is still under development, but the iota roadmap does not say when a beta is released.

I appreciate your help.

1

you mainly get 4 static libs providing different needs for applications:

  • libiota_crypto.a
  • libiota_core.a
  • libiota_client.a
  • libiota_wallet.a

In general, the client application links with libiota_client.a to interact with nodes directly. Examples link with libiota_wallet.a demonstrating wallet functionality and some tests link with libiota_client.a in the repo.

Please check your CMake script making sure targets link to the correct lib.

8
  • Thanks Sam for you quick feedback. I've already tried to use the code from your "wallet_get_balance" example and linked to the libiota_client.a. The examples work fine. However, using "nm libiota_client" on the lib file shows that many symbols are defined but not referenced e.g. "byte_buf_clonen". Looking into the cmake recipe of the tests, I can still see, that the they are compiled using the source code and not by linking the static library. Thats why compilation does not fail. I assume, that some source files are missing when "iota_client" is compiled. Maybe I'm wrong though. – emDave May 10 at 17:51
  • byte_buf_clonen is part of libiota_core.a. seems your script didn't link dependency libs. don't know your cmake configuration and running operating system but iota.c can be imported as an external lib via FetchContent module, it will auto-link dependency libs. see github.com/oopsmonk/iota_cmder/blob/chrysalis/CMakeLists.txt – Sam Chen May 11 at 6:07
  • Thanks. FetchContent is not compatibe with my dependency management though. Just to make it a bit more clear. I am building the library and installing them by CMAKE_INSTALL_PREFIX in /opt/iota.c. I would expect, that when I include the header files and link the libraries, that I can use them. However, when trying to execute wallet_create (just an example) I still get an undefined reference in the lib files. Even though I link all four lib files to my main app. There are a lot of ways to make a dependency management but using the installation path should be a standard option. I use Ubuntu – emDave May 16 at 7:41
  • By the way: With this library version, everything worked find: github.com/iotaledger/iota.c/tree/master/cclient/api/examples – emDave May 16 at 7:44
  • the flexibility of CMake allows the designer to have diverse configurations on the application and libraries. iota.c library is designed for building the application in a sandbox, FetchContent helps to solve dependency issues as well. In your case, linking all dependent libraries is needed in cmake script, the error indicates missing libs. I don't have a problem when iota.c installed in /opt/iota.c on Ubuntu. – Sam Chen May 19 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.