On Feb 23, 2013, at 12:17 PM, mkfs <[email protected]> wrote:
> When linking to libdyinst on Ubuntu (12.04 64-bit), the BPatch
> constructor is not found, and the destructor has unresolved symbols:
>
> bash$ g++ -Wall -I/usr/include/dyninst -L/usr/lib -ldyninstAPI
> -lcommon dyninst_test.cpp
Try reordering the compilation line to put your source file first and the
libraries second. The Ubuntu linker is a single-pass system and so things need
to be specified in dependence order.
>
> bash$ nm /usr/lib/libdyninstAPI.so | grep -e 'BPatch[0-9]\+BPatch'
> 00000000000f0790 T _ZN6BPatch11BPatch_dtorEv
> bash$ nm /usr/lib/libdyninstAPI.so | grep -e 'BPatch[0-9]\+bpatch_printf'
> bash$
The 8.0 version of Dyninst uses a global locking system implemented in a header
file, so I'd expect those symbols to be missing. It's confusing but works.
> ...although it should be noted that the same error happened without
> the "--enable-gnu-demangler" flag. The '--with-libdwarf-static' flag
> is necessary to fix the following error when linking to libdwarf on a
> 64-bit system "relocation R_X86_64_32S against `.rodata' can not be
> used when making a shared object"
Are you building libdwarf from source or using the package? I believe the
package just provides a .a, which you wouldn't be able to link dynamically.
Drew
>
> Given that this happens both with the .deb files and a build from the
> tarball, it seems to be a problem with the Ubuntu build (possibly on
> 64-bit systems) -- or else I am doing something fundamentally wrong
> when trying to compile against it.
>
> Has anyone successfully linked to dyninst 8.0 on a 64-bit Ubuntu 12.04
> (or greater) system, and if so, how?
>
> System info:
>
> bash$ lsb_release -a
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 12.04.2 LTS
> Release: 12.04
> Codename: precise
> bash$ uname -a
> Linux glider 3.5.0-18-generic #29-Ubuntu SMP Thu Oct 25 07:26:14 UTC
> 2012 x86_64 x86_64 x86_64 GNU/Linux
>
> bash$ g++ --version
> g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
> Copyright (C) 2011 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> bash$ ldd --version
> ldd (Ubuntu EGLIBC 2.15-0ubuntu10.3) 2.15
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> Written by Roland McGrath and Ulrich Drepper.
>
>
> The test code, cat dyninst_test.cpp, is as follows:
>
> bash$ cat dyninst_test.cpp
> using namespace std;
> // no such namespace:
> //using namespace Dyninst;
>
> #include "BPatch.h"
> BPatch bpatch;
> int main(int argc, char ** argv) {
> // this doesn't work either:
> //BPatch * bpatch = new BPatch();
> //if (!bpatch) return -1;
> return 0;
> }
> _______________________________________________
> Dyninst-api mailing list
> [email protected]
> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
--
Andrew Bernat
Paradyn Project
[email protected]
http://www.cs.wisc.edu/~bernat
_______________________________________________
Dyninst-api mailing list
[email protected]
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api