AchillesA / maidsafe-dht

Automatically exported from code.google.com/p/maidsafe-dht
0 stars 0 forks source link

Not Really a Problem but... #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
...what i have to do to add maidsafe library in a cmake file ?

is there any "FindMaidsafe.cmake" file to use FIND_PACKAGE (maidsafe REQUIRED) ?

or what i have to do, to use maidsafedht library in a cmake file ?

greeting
Patrick 

Original issue reported on code.google.com by p.wer...@tu-bs.de on 8 Feb 2011 at 10:41

GoogleCodeExporter commented 9 years ago
i build a cmake file importing all the libs at the end liek this :

TARGET_LINK_LIBRARIES(DHTDTNGUI ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(DHTDTNGUI drawingGUI)
TARGET_LINK_LIBRARIES(DHTDTNGUI maidsafe_dht_d)
TARGET_LINK_LIBRARIES(DHTDTNGUI udt_d)
TARGET_LINK_LIBRARIES(DHTDTNGUI ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(DHTDTNGUI cryptopp_d)
TARGET_LINK_LIBRARIES(DHTDTNGUI protobuf)

and get and error while compiling....
when trying to link DHTDTNGUI
her it is :

/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmaidsafe_dht_d.a(general_me
ssages.pb.cc.o): In function `global constructors keyed to 
65535_0_general_messages.pb.cc':
/home/snakebyte/Desktop/Uni/loccom/maidsafe-dht/src/maidsafe/protobuf/general_me
ssages.pb.cc:1105: undefined reference to `__gcov_init'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmaidsafe_dht_d.a(general_me
ssages.pb.cc.o):(.data.rel+0x24): undefined reference to `__gcov_merge_add'
collect2: ld returned 1 exit status
make[2]: *** [DHTDTNGUI/DHTDTNGUI] Fehler 1
make[1]: *** [DHTDTNGUI/CMakeFiles/DHTDTNGUI.dir/all] Fehler 2
make: *** [all] Fehler 2

Original comment by p.wer...@tu-bs.de on 8 Feb 2011 at 11:59

GoogleCodeExporter commented 9 years ago
seems like it works fine, if i dont use the debug files....
can you tell me why ?

Original comment by p.wer...@tu-bs.de on 9 Feb 2011 at 12:01

GoogleCodeExporter commented 9 years ago
hmm now i tried to compiled it again, using the same flags with Release lib
and get a new error.....

/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmaidsafe_dht.a(kadid.cc.o):
 In function `kad::KadId::KadId(std::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, kad::KadId::EncodingType const&)':
kadid.cc:(.text+0x1c8f): undefined reference to 
`google::LogMessage::LogMessage(char const*, int, int)'
kadid.cc:(.text+0x1cbe): undefined reference to 
`google::LogMessage::~LogMessage()'
kadid.cc:(.text+0x1ce6): undefined reference to 
`google::LogMessage::~LogMessage()'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmaidsafe_dht.a(kadid.cc.o):
 In function `kad::KadId::KadId(std::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, kad::KadId::EncodingType const&)':
kadid.cc:(.text+0x1f7f): undefined reference to 
`google::LogMessage::LogMessage(char const*, int, int)'
kadid.cc:(.text+0x1fae): undefined reference to 
`google::LogMessage::~LogMessage()'
kadid.cc:(.text+0x1fd6): undefined reference to 
`google::LogMessage::~LogMessage()'
collect2: ld returned 1 exit status
make[2]: *** [DHTDTNGUI/DHTDTNGUI] Fehler 1
make[1]: *** [DHTDTNGUI/CMakeFiles/DHTDTNGUI.dir/all] Fehler 2
make: *** [all] Fehler 2

Original comment by p.wer...@tu-bs.de on 9 Feb 2011 at 12:05

GoogleCodeExporter commented 9 years ago
one more thing.

i just created a new source file using all the code you used in your demo app

Original comment by p.wer...@tu-bs.de on 9 Feb 2011 at 12:10

GoogleCodeExporter commented 9 years ago
seems like the error occurs when i use ...

void printf_info(kad::ContactInfo info) {
  kad::Contact ctc(info);
  printf("Node info: %s", ctc.DebugString().c_str());
}

but i dont understand why my compiler dont like it....using standart gcc

Original comment by p.wer...@tu-bs.de on 9 Feb 2011 at 12:13

GoogleCodeExporter commented 9 years ago
To use the maidsafe_dht in a cmake project you can import our cmake list 
directly (use the add_subdir in cmake).

You could also install it and link to it like any lib. 

I think the error your seeing there is caused by the -g flag in the 
cmakelist.txt file for some reason. If you open that up and search for -g or 
-gprof you can remove these from the CXXFLAGS ld help there, but I do not think 
you should get those. Perhaps your not selecting the build/Linux/Debug dir ? or 
maybe you have a strange compiler setup. Anyway the error is a coverage error 
and the flags are set on by default. So OK to remove them.

The Release error, looks like cmake thinks you have google log installed but is 
not linking it for some reason. You can manually remove this dependency in the 
cmakelist as well. 

All in all I would definitely wait fro our next release (were on final run now) 
as this code will be deprecated very soon in favour of the rewrite (huge API 
changes). 

Original comment by irvine.d...@gmail.com on 9 Feb 2011 at 12:17

GoogleCodeExporter commented 9 years ago
Hi Patrick,

First off, the rewrite David mentions is actually hosted on GitHub.  Since the 
codebase is being heavily refactored, the repository is private, but as soon as 
we're done, we'll open the source again.  The changes will provide the ability 
to easily include the DHT's CMakeFile.txt in another project to allow the 
correct dependencies, flags, etc. to be set.

The repo is at http://maidsafe.github.com/MaidSafe-DHT

Regarding your issues:

Again, as David said, the first issue is with gcov.  As an alternative to 
modifying the DHT CMakeLists.txt file, I think adding gcov as another target 
link library in your CMakeLists.txt should fix your first linker problem.  
Coverage info is only gathered when built in Debug mode, so in Release, gcov is 
not needed.

As to the second linker error involving the missing Google Log library (Glog), 
did your CMake run pick up Glog? (i.e. was there a line like "-- Found Google 
Logging library")  If so, the library will be stored in a variable 
${Glog_LIBRARY}.  You should link this also in a target_link_libraries call.

By the way, you can write TARGET_LINK_LIBRARIES(DHTDTNGUI ${QT_LIBRARIES} 
drawingGUI maidsafe_dht_d etc...) all in one command.

Hope this helps.  If not, get back to us.

Cheers,

Fraser.

Original comment by fraser.hutchison@gmail.com on 9 Feb 2011 at 12:35