jami
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ring] how to compile/link to libring.a (statically)


From: Stepan Salenikovich
Subject: [Ring] how to compile/link to libring.a (statically)
Date: Thu, 29 Jun 2017 17:03:51 -0400

Hi,
I'm trying to help Houmin with his GSoC project and I'm a bit stumped
on this myself.

We want to compile a simple client which links to the static
libring.a, but are having issues resolving all the undefined
references.

We have a main.cpp:

> #include <dring.h>
> int main(int argc, char *argv [])
> {
>         DRing::version();
>         DRing::init(static_cast<DRing::InitFlag>(0));
> }


And heres a Makefile (obviously adapt it to where you've installed the daemon):

> CC = g++
> CXXFLAGS :=     -I/home/stepan/ring-project/install/daemon/include/dring \
>                 -L/home/stepan/ring-project/install/daemon/lib
> LIBS := -lring
> all: ring-iot
> ring-iot: main.cpp
>         $(CC) -o ring-iot main.cpp $(CXXFLAGS) $(LIBS)
> clean:
>         rm -f *~ *.o ring-iot

Running 'make' results in many undefined references. Running 'nm' on
libring.a shows that pretty much all of these are undefined there.
However, some or all of these objects do exist in the dring binary, or
else they are in .so linked to by the dring binary. Does this mean
that in our Makefile we must explicitly link to all the dependencies
(static or dynamic)?

Is there a simpler solution?

Thanks,
-stepan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]