Setup ubuntu Multipass Environment

Hi Joseph I finally figured it out my clang version was 3.13.2 and I upgrded it to 3.20.3 and it finally got me going. I think some hints on dependencies may be useful for versions and so on.

thanks for all your help and look forward to your course next week.

Hurray I got my first compile done and environment ready on debianā€¦ thanks now I can start getting some work done

Once I did a clean and rebuilt the distribution I was able to link the libzt.so, prior to the clean I was getting .so linking errors as below.

clang pingable-node.c -o pingable-node -Iā€¦/ā€¦/libzt/include -Lā€¦/ā€¦/dist/linux-x64-host-release/lib -lzt

compiles great but complains when I execute the binary pingable-node: error while loading shared libraries: libzt.so: cannot open shared object file: No such file or directory

I included the /lib/libzt.so location in the path but when i run the binary complains about not finding the libzt.so

Glad youā€™ve made progress. Iā€™ll test that dependency and update the docs, thanks.

An important concept: A shared library (.so) isnā€™t linked, but rather loaded at runtime. A static library (.a) is linked at compile-time. Basically think of a static library as a set of object (.o) files all smashed together. How it operates is very different than a shared library.

So,

clang pingable-node.c -o pingable-node -Iā€¦/ā€¦/libzt/include -Lā€¦/ā€¦/dist/linux-x64-host-release/lib -lzt

Is actually trying to link against libzt.a found at the location specified with -L

In order to use a shared library libzt.so/dylib you need to explicitly load it using something like dlopen, but I wouldnā€™t recommend that. Iā€™d just focus on using the libzt.a static library.

Are you able to build the libzt.a file?

1 Like

Btw, I think this page is a really good resource if one wants to get acquainted with the different library types: Linux Tutorial - Static, Shared Dynamic and Loadable Linux Libraries

But I would just try to get the libzt.a linking working first. Thatā€™s easiest. Iā€™ll be doing a little extended Q&A session on discord after the talk so I can help you get this sorted out if the above doesnā€™t help.

1 Like

Thanks for the info Joseph, thatā€™s really helpful and looking forward to your conference. I am happy to have it stable and working, I was able to make some minor modifications and chack that I was compiling ok with a few new printf statements. The .so .a clear up why I was getting the errors thanks.

I have taken a break to reset my head lol. I will take a look at that page, I have a few talented programmers and I am reviewing from an architecture point of view. I hope your tutorial helps others to get going, it just takes a bit of patience.

I will have a go at the static library and take a fresh look some time through the week. Many thanks for all the quick responses, very much appreciated.

Hi,Iā€™ve spent my time porting the zerotier(Libzt) on ESP32 using ESP-IDF framework these days.But Iā€™ve enconunter serveral problems on CMake cross compile for this project.
Iā€™ve finish the component with some struggling & debuging on CMake.Everything goes fine(ESP-IDF built finish) until cross build for libzt(100ERROR,36WARNING!)ā€¦haha
The compiler says ā€˜Mutexā€™ does not name a type ā€˜ (Maybe The thread lock in FreeRTOS isā€™t compatible with libzt itself)
Anyone could help me these errors?OR you can go on for my works on the project,thanks

the project is https://github.com/zhzhzhy/Zerotier-Espressif

I looked at this some tikme bback and you may have to find a compatible library that interacts with lwip for it to work natively. Iā€™m not ure if the architecture is suited for MCU, depends on what you want to achieve, it will be use case specific. Thanks for posting the git repo will try and take a look as I am always interested in zerotier.