Closed wb0gaz closed 4 years ago
This problem turns out to be the way libev.a was generated when I retrieved it using apt.
I downloaded libev from the file repository area of
http://software.schmorp.de/pkg/libev.html
then did ./configure followed by make.
At this point in a directory .lib is the file libev.a, which is far larger than the same file installed using apt. This verison of libev.a was successfully linked using gcc command, and the resulting copy of example, while much larger (several hundred kilobytes), is indeed static as I wanted, and does run on a machine with no other installation of libev or libuwsc.
I am closing this issue as there is no remaining problem in this area.
I need to build example (from example.c) in partially static configuration, without libev.so and without libuwsc.so, which will not be available on a target system (that is, I will copy binary "example" to target system, but the target system will not have installed libev or libuwsc.)
Host (where I will build) is Ubuntu 18.04, 64-bit. Target (where I will execute) is Ubuntu 18.04, 64-bit, but has no shared libraries for libev and libuwsc.
I tested libuwsc initially as cloned from github - it works well (I tested example to communicate OK with existing websocket echo server.)
On host (where I will build), I tried changing cmake command from cmake .. to this:
cmake .. -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF
The result build process is now:
Now, example (binary) grows from 13408 to 42616 bytes, but when I move example binary to target system (target does not have libev or libuwsc intalled), executing ./example results:
./example: error while loading shared libraries: libev.so.4: cannot open shared object file: No such file or directory
The source system (where I am building) has libev.a (static) and libev.so (shared), but resulting binary example still is referencing libev.so, so it cannot start.
I am not expert on cmake, I think my problem is with with cmake.
Thank you for any help!