All of lore.kernel.org
 help / color / mirror / Atom feed
* Undefined Ref for simple prog
@ 2015-12-03 22:40 Robert LeBlanc
  2015-12-03 23:08 ` Adam C. Emerson
  0 siblings, 1 reply; 3+ messages in thread
From: Robert LeBlanc @ 2015-12-03 22:40 UTC (permalink / raw)
  To: ceph-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I'm trying to do some testing of Ceph components specifically around
the OP queues. I'm trying to use the class in a simple program where I
will do my testing, but I can't resolve one problem. I've had to
include  types.h as forward defining the Formatter class (already
included/forward defined in the base class). This is based on my PR
https://github.com/ceph/ceph/pull/6781 .

//wrr_bench.cc
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "include/types.h"
#include "common/PrioritizedQueue.h"
#include

//namespace ceph {
//  class Formatter;
//}

int main() {
  PrioritizedQueue pq(0,0);
  std::cout << "Running.." << std::endl;
}

I'm compiling with:
$ g++ -std=c++11 -I. wrr_bench.cc -o wrr_bench
/tmp/ccf6wRFo.o: In function `PrioritizedQueue::length() const':
wrr_bench.cc:(.text._ZNK16PrioritizedQueueIjjE6lengthEv[_ZNK16PrioritizedQueueIjjE6lengthEv]+0x5a):
undefined reference to `ceph::__ceph_assert_fail(char const*, char
const*, int, char const*)'
wrr_bench.cc:(.text._ZNK16PrioritizedQueueIjjE6lengthEv[_ZNK16PrioritizedQueueIjjE6lengthEv]+0xfb):
undefined reference to `ceph::__ceph_assert_fail(char const*, char
const*, int, char const*)'
/tmp/ccf6wRFo.o: In function `PrioritizedQueue::empty() const':
wrr_bench.cc:(.text._ZNK16PrioritizedQueueIjjE5emptyEv[_ZNK16PrioritizedQueueIjjE5emptyEv]+0x2e):
undefined reference to `ceph::__ceph_assert_fail(char const*, char
const*, int, char const*)'
wrr_bench.cc:(.text._ZNK16PrioritizedQueueIjjE5emptyEv[_ZNK16PrioritizedQueueIjjE5emptyEv]+0x68):
undefined reference to `ceph::__ceph_assert_fail(char const*, char
const*, int, char const*)'
/tmp/ccf6wRFo.o: In function `PrioritizedQueue::dequeue()':
wrr_bench.cc:(.text._ZN16PrioritizedQueueIjjE7dequeueEv[_ZN16PrioritizedQueueIjjE7dequeueEv]+0x3b):
undefined reference to `ceph::__ceph_assert_fail(char const*, char
const*, int, char const*)'
/tmp/ccf6wRFo.o:wrr_bench.cc:(.text._ZN16PrioritizedQueueIjjE7dequeueEv[_ZN16PrioritizedQueueIjjE7dequeueEv]+0x1b0):
more undefined references to `ceph::__ceph_assert_fail(char const*,
char const*, int, char const*)' follow
collect2: error: ld returned 1 exit status

Including assert.h doesn't help. Any pointers?

Thanks,

- ----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
-----BEGIN PGP SIGNATURE-----
Version: Mailvelope v1.3.0
Comment: https://www.mailvelope.com

wsFcBAEBCAAQBQJWYMTfCRDmVDuy+mK58QAACdUP/RkhdAhkYLM9jzEXss8b
Z003Cz1jnEe9sw+xsMdvaQxU/d0RbhE1Mst1HvfAv9aFCjJbtUf5dYyqCy/6
SnTWIPe79kEVJ61ATTSSbQGCDkMJZiONrnhc2IDdrY4b5N04kYRlG6jQfCr4
s/k7cnu2ReTjIRtQzr+SmAtaqcNt2OyMGjt6Aa+Wu+MyoZ5Z2ELBo63LrjPu
SSVBtKXSajXjz827broyA5zsejLrJzlww0UkwMCwFWZ6bHxKjRD5Xj4r15j0
zh3HcRZZAJk2F7nePXKlpZfh96xmDbc3RJ4HY4ZvYCxxrprFfw9LJ/yE6qix
TfvYMJIeKldQkG8vmNJKrKXQx9Lc1o32uCnOu1A9MMzA9tC4HrHFq69/IvcW
SUMlXqxzw3KPA0PxYwvxCOy3PUMwtAfofZOmBeMCIpIuRJbY+YXhJz55/a7m
8FEC1b7+MR54tpNOuaMeTXjmf5v1ddcMaTMO6L61YMKRoBFLHHMWVeuYeNxt
okzvEnFWvkCvM0bEGMVFt038h3k7BpuxTe0FypKtAUpR1lgvsVKLWMP1y9ai
XRqDB1eV13zxY/LIM3OlXbCDZFgWvycBrRQpScuYJ08SivkSg7ya5q85W4/J
7Bpy5W7HgmUbN+fzqMZ/VPW52ys7fHiWDQRmULR7V35rnngvkQoIBcEmWLPd
mEsp
=N4vu
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Undefined Ref for simple prog
  2015-12-03 22:40 Undefined Ref for simple prog Robert LeBlanc
@ 2015-12-03 23:08 ` Adam C. Emerson
  2015-12-03 23:22   ` Robert LeBlanc
  0 siblings, 1 reply; 3+ messages in thread
From: Adam C. Emerson @ 2015-12-03 23:08 UTC (permalink / raw)
  To: Robert LeBlanc; +Cc: ceph-devel

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

On 03/12/2015, Robert LeBlanc wrote:
> I'm trying to do some testing of Ceph components specifically around
> the OP queues. I'm trying to use the class in a simple program where I
> will do my testing, but I can't resolve one problem. I've had to
> include  types.h as forward defining the Formatter class (already
> included/forward defined in the base class). This is based on my PR
> https://github.com/ceph/ceph/pull/6781 .

Ceph's assert is infelicitous. The libcommon static library
has the definitions in src/common/assert.cc. It depends on other
things, though, so the easiest thing to do, if you're using autotools, is just
to add a target to one of the Makefile.am scripts (probably in src/test)
that uses CEPH_GLOBAL as its library. If you just copy and modify one
of the targets for the binary tests, your program will get built as part of the
unittests target.

(You'll have to build src/gmock and src/gmock/gtest manually to call make
unittests on its own.)

If you're using cmake, it's simpler. Just copy one of the
add_executable/target_link_libraries pairs in src/test/CMakeLists.txt and modify
as appropriate. Your executable will be built as part of the default CMake
target.

-- 
Senior Software Engineer           Red Hat Storage, Ann Arbor, MI, US
IRC: Aemerson@{RedHat, OFTC, Freenode}
0x80F7544B90EDBFB9 E707 86BA 0C1B 62CC 152C  7C12 80F7 544B 90ED BFB9

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 603 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Undefined Ref for simple prog
  2015-12-03 23:08 ` Adam C. Emerson
@ 2015-12-03 23:22   ` Robert LeBlanc
  0 siblings, 0 replies; 3+ messages in thread
From: Robert LeBlanc @ 2015-12-03 23:22 UTC (permalink / raw)
  To: Robert LeBlanc, ceph-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Yeah, I wound up tracing it that the cc file is elsewhere. I was
hoping that the dependency would be pretty small, but as I resolve
some, more show up. I thought about adding a target, but thought it
would be too much of a pain. It is looking like the easier option
after adding 8 dependencies on the compile line and it looks like
there are many more to go. The exercise has been good for me to better
understand how Ceph is glued together. I might just keep going this
manual route for the education value. Thanks for the reply.
- ----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1


On Thu, Dec 3, 2015 at 4:08 PM, Adam C. Emerson  wrote:
> On 03/12/2015, Robert LeBlanc wrote:
>> I'm trying to do some testing of Ceph components specifically around
>> the OP queues. I'm trying to use the class in a simple program where I
>> will do my testing, but I can't resolve one problem. I've had to
>> include  types.h as forward defining the Formatter class (already
>> included/forward defined in the base class). This is based on my PR
>> https://github.com/ceph/ceph/pull/6781 .
>
> Ceph's assert is infelicitous. The libcommon static library
> has the definitions in src/common/assert.cc. It depends on other
> things, though, so the easiest thing to do, if you're using autotools, is just
> to add a target to one of the Makefile.am scripts (probably in src/test)
> that uses CEPH_GLOBAL as its library. If you just copy and modify one
> of the targets for the binary tests, your program will get built as part of the
> unittests target.
>
> (You'll have to build src/gmock and src/gmock/gtest manually to call make
> unittests on its own.)
>
> If you're using cmake, it's simpler. Just copy one of the
> add_executable/target_link_libraries pairs in src/test/CMakeLists.txt and modify
> as appropriate. Your executable will be built as part of the default CMake
> target.
>
> --
> Senior Software Engineer           Red Hat Storage, Ann Arbor, MI, US
> IRC: Aemerson@{RedHat, OFTC, Freenode}
> 0x80F7544B90EDBFB9 E707 86BA 0C1B 62CC 152C  7C12 80F7 544B 90ED BFB9

-----BEGIN PGP SIGNATURE-----
Version: Mailvelope v1.3.0
Comment: https://www.mailvelope.com

wsFcBAEBCAAQBQJWYM6+CRDmVDuy+mK58QAAqmYP/19mVkKR3P+mIHydYZlc
Hbzxrm7p2qAazfXNanufU/aickuGgob8oc6AOPS0j6Q85KOK86k0zdxy6DhF
6g8bNdT54y+mwpu/CYbaETwI7H+OQspBVdW7u07q17HC+uDTnOL/+SVxKPGu
dnalpuMkwp4Lk84ifT07hBGqd3WBGqYtBt5pMy8wvit4fPUgwklrkmRy+VPn
3PA2qhc16rtFb9PcOzBxrjpcf0FdP+HVFLpulKpw+trjjRsaexcsRK2dDmPa
GA2M9XrXzJ2qG/MWwPFZJAP+XaJ6iy6sxdJOJv5+TqvN0fabvy8rHcCV5GEy
KS2ORsCEt0Ysf68b+KG9F1QdiT90yKgft6m/4KkAztJzO7Yy3QtvXe3dZZ64
uJzumHd+vyvyVndvzWqzqU3s0pQJy4Zk8S4qHEdqtxFdQhKytF4txgr/XFgW
8mFKExyxDl+X7XfxJGSpuiwuR+AwuF7LoA75vr1mdunC5PQ1nKHGIgU/YZ9+
tCxsRmOl7jfp+wdtgcy9feKI4asZ00vXWNHV54iHIzoPScmqSeS2ZnrbPa1Q
eN4nSxLUjBXPbxi9GIEKjnWXUFdf+bIk/o5wyDW02B9Vz1+Myz9A08CC/X4A
UIk29M/m11QsX8bOqC1W8PUc1cqOBXB1HOi+YuP8guXwS+Z+X/3MKJVNtTPu
tZbb
=Dqe4
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-03 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 22:40 Undefined Ref for simple prog Robert LeBlanc
2015-12-03 23:08 ` Adam C. Emerson
2015-12-03 23:22   ` Robert LeBlanc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.