Hi, Mauricio,

The issue is that we link the api-static library to produce the libbcc
shared library.
During the linking process, not-referenced symbols in api-static library get
dropped.

I have a patch for this.
https://github.com/iovisor/bcc/pull/1455
It should resolve your issue.

Thanks


On Wed, Nov 22, 2017 at 6:29 AM, Mauricio Vasquez via iovisor-dev
<[email protected]> wrote:
> Dear All,
>
> I have been using libbcc with a C++ application without problems for a
> while. However, when I tried this with bcc master I got some linker errors.
>
> Even with a basic example I get the same errors:
>
> test_overflow.cpp:
>
> #include <bcc/BPF.h>
> #include <iostream>
>
> const std::string BPF_PROGRAM1 = R"(
> BPF_TABLE("array", int, uint64_t, myarray, 1);
> )";
>
> int main(void) {
>   ebpf::BPF bpf1;
>   ebpf::StatusTuple res(0);
>
>   res = bpf1.init(BPF_PROGRAM1);
>   if (res.code() != 0) {
>     std::cout << "error on init " << std::endl;
>     return -1;
>   }
>
> }
>
> g++ test_overflow.cpp -lbcc --std=c++11
>
> test_overflow.cpp:(.text+0x8b): undefined reference to
> `ebpf::BPF::init(std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > > > const&, std::vector<ebpf::USDT,
> std::allocator<ebpf::USDT> > const&)'
> test_overflow.cpp:(.text+0x120): undefined reference to `ebpf::BPF::~BPF()'
> test_overflow.cpp:(.text+0x185): undefined reference to `ebpf::BPF::~BPF()'
>
> The last commit to work is https://github.com/iovisor/bcc/commit/dcb77e6
> (Remove unused shared_table.h), has something changed on the compilation
> system?
>
> Thanks,
>
> Mauricio
>
>
>
>
>
> _______________________________________________
> iovisor-dev mailing list
> [email protected]
> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to