[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ring] how to compile/link to libring.a (statically)
From: |
Guillaume Roguez |
Subject: |
Re: [Ring] how to compile/link to libring.a (statically) |
Date: |
Fri, 30 Jun 2017 14:07:48 -0400 (EDT) |
Hi Stepan,
libring.a doesn't contains all "contrib" symbols. You have to link them also.
// Guillaume
----- Le 29 Juin 17, à 17:03, Stepan Salenikovich address@hidden a écrit :
> 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