Re: [DynInst_API:] Several Dyninst build issues


Date: Fri, 11 Apr 2014 15:52:40 -0700
From: Jim Galarowicz <jeg@xxxxxxxxxxxxx>
Subject: Re: [DynInst_API:] Several Dyninst build issues
Hi Bill,

I have been working on this today.    Comments in each issue area below.

On 04/11/2014 08:51 AM, Bill Williams wrote:
Jim, Englebert:

Taking these in order:

1) Yes, the libiberty you link against must be PIC. I've observed each of the following:

* libiberty.a is present and PIC
* libiberty.a is present and non-PIC; libiberty_pic.a is present and PIC.
* libiberty.so is present and, necessarily, PIC.
* libiberty.a is present and non-PIC; no other libiberty is present.

I'd check whether libiberty_pic.a is present if you're manually specifying the location of binutils. You can of course also go the automatic detect/download/build route.
Yes, this was my mistake in the spec file I created for Dyninst.  It was looking for libiberty.a and manually specifying that, incorrectly.  I fixed this and it used /usr/lib/libiberty_pic.a.  Then I hit issue 2 again.

2) Does /opt/krellroot_v2.1u3/bin/ld work for linking object files built with gcc? Is this the linker you intend to use? You're mixing toolchains here (that linker with /usr/bin/gcc) and I have no idea whether that's deliberate or not, and no idea whether the toolchains in question are compatible.
I don't know exactly what to do with this.  If I need to install binutils, then it is in the krellroot which is used to reference other needed components that might not be installed.  ld gets installed into the krellroot when binutils is built.   You are correct, though.  Manually moving ld to ld-back and rerunning the dyninst build allows it to succeed.


3) libdwarf must be built PIC or shared (we generally go for shared) in order to link--we do not support deferred linking of static libraries into a dyninst-based executable. Grab source and build with --enable-shared, or let Dyninst's CMake do it for you automatically.
We do build libdwarf shared when it is determined we need to build it.   So, I check for libdwarf.so and then for libdwarf.a, but do not check for whether or not libdwarf is compiled with -fPIC.  I found a discussion on the internet that said you can check for that by doing something like this:
> for i in /usr/lib/*.a /usr/local/lib/*.a; do
> objdump --reloc $i 2>/dev/null | grep R_X86_64_32S > /dev/null && echo $i;
> done

So, I tried it on my ubuntu system:

objdump --reloc /usr/lib/libdwarf.a  2>/dev/null | grep R_X86_64_32S
00000000000000a4 R_X86_64_32S      .rodata+0x0000000000000180
000000000000011f R_X86_64_32S      .rodata+0x0000000000000198
00000000000004ba R_X86_64_32S      .rodata+0x0000000000000180
00000000000004c0 R_X86_64_32S      .rodata+0x0000000000000180


jeg@jeg-OptiPlex-GX620:~/OpenSpeedShop_ROOT$ objdump --reloc /usr/lib/libiberty_pic.a 2>/dev/null | grep R_X86_64_32S
jeg@jeg-OptiPlex-GX620:~/OpenSpeedShop_ROOT$ objdump --reloc /usr/lib/libiberty.a 2>/dev/null | grep R_X86_64_32S
00000000000000f5 R_X86_64_32S      .rodata
00000000000004b4 R_X86_64_32S      .rodata+0x00000000000000f0
000000000000071a R_X86_64_32S      .bss+0x0000000000000080
000000000000074f R_X86_64_32S      .bss+0x0000000000000080

To your knowledge is that the best way to check for fPIC libraries?

4) That case should be wrapped in an #if defined(STT_GNU_IFUNC), and it is on the 8.2 branch.

I will download the latest, but 3 and 4 were Dyninst-8.1.2 because I haven't made Dyninst-8.2 default because of the BG/Q asm issues.

Thanks,
Jim G


On 04/11/2014 10:15 AM, Jim Galarowicz wrote:
Hi Dyninst team:

I have several issues to report, all relating to building Dyninst on
different platforms.   I still have Dyninst-8.1.2 the default because
Dyninst-8.2 doesn't build on BG/Q (as issue) and I now I see not on Ubuntu.

I have a potential user (if we can get past these build issues), who
can't get dyninst-8.1.2 to build on two different platforms.  So, I
tried to build Dyninst-8.2 on my ubuntu platform (which is one of
Engelbert's platforms of choice).   I ran into two issues.

*Issue 1: (I got around this by using my own binutils with fPIC enabled.)*

Linking CXX shared library libcommon.so
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libiberty.a(cplus-dem.o):
relocation R_X86_64_32S against `_sch_istable' can not be used when
making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libiberty.a: error
adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [common/libcommon.so.8.2.0] Error 1
make[1]: *** [common/CMakeFiles/common.dir/all] Error 2
make: *** [all] Error 2
error: Bad exit status from
/home/jeg/OpenSpeedShop_ROOT/INSTALL/jeg-OptiPlex-GX620/rpm-tmp.q8MdTd
(%build)

*Issue 2: (haven't gotten around and could use advice)*

Failure of 8.2 version to build with cmake version 2.8.11.2, gcc-4.8.1

+ CXX=g++ CC=gcc CXXFLAGS=-std=c++0x cmake .
-DCMAKE_INSTALL_PREFIX=/home/jeg/OpenSpeedShop_ROOT/BUILDROOT/dyninst-8.2-1.x86_64/opt/krellroot_v2.1u3
-DINSTALL_LIB_DIR=/home/jeg/OpenSpeedShop_ROOT/BUILDROOT/dyninst-8.2-1.x86_64/opt/krellroot_v2.1u3/lib64
-DINSTALL_INCLUDE_DIR=/home/jeg/OpenSpeedShop_ROOT/BUILDROOT/dyninst-8.2-1.x86_64/opt/krellroot_v2.1u3/include/dyninst
-DCMAKE_PREFIX_PATH=/home/jeg/OpenSpeedShop_ROOT/BUILDROOT/dyninst-8.2-1.x86_64/opt/krellroot_v2.1u3
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DLIBDWARF_LIBRARIES=/opt/krellroot_v2.1u3/lib
-DLIBDWARF_INCLUDE_DIR=/opt/krellroot_v2.1u3/include
-DLIBELF_LIBRARIES=/opt/krellroot_v2.1u3/lib
-DLIBELF_INCLUDE_DIR=/opt/krellroot_v2.1u3/include -DPATH_BOOST=
-DIBERTY_LIBRARY=/opt/krellroot_v2.1u3/lib/libiberty.a
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61
(message):
   The C compiler "/usr/bin/gcc" is not able to compile a simple test
program.
   It fails with the following output:
    Change Dir:
/home/jeg/OpenSpeedShop_ROOT/BUILD/jeg-OptiPlex-GX620/dyninst-8.2/CMakeFiles/CMakeTmp
   Run Build Command:/usr/bin/make "cmTryCompileExec3894022312/fast"
   /usr/bin/make -f CMakeFiles/cmTryCompileExec3894022312.dir/build.make
   CMakeFiles/cmTryCompileExec3894022312.dir/build
   make[1]: Entering directory
`/home/jeg/OpenSpeedShop_ROOT/BUILD/jeg-OptiPlex-GX620/dyninst-8.2/CMakeFiles/CMakeTmp'
   /usr/bin/cmake -E cmake_progress_report
/home/jeg/OpenSpeedShop_ROOT/BUILD/jeg-OptiPlex-GX620/dyninst-8.2/CMakeFiles/CMakeTmp/CMakeFiles
   1
   Building C object
   CMakeFiles/cmTryCompileExec3894022312.dir/testCCompiler.c.o
   /usr/bin/gcc -o
CMakeFiles/cmTryCompileExec3894022312.dir/testCCompiler.c.o
   -c
/home/jeg/OpenSpeedShop_ROOT/BUILD/jeg-OptiPlex-GX620/dyninst-8.2/CMakeFiles/CMakeTmp/testCCompiler.c
   Linking C executable cmTryCompileExec3894022312
   /usr/bin/cmake -E cmake_link_script
   CMakeFiles/cmTryCompileExec3894022312.dir/link.txt --verbose=1
   /usr/bin/gcc
CMakeFiles/cmTryCompileExec3894022312.dir/testCCompiler.c.o -o
   cmTryCompileExec3894022312 -rdynamic
   /opt/krellroot_v2.1u3/bin/ld: this linker was not configured to use
   sysroots
   collect2: error: ld returned 1 exit status
   make[1]: *** [cmTryCompileExec3894022312] Error 1
   make[1]: Leaving directory
`/home/jeg/OpenSpeedShop_ROOT/BUILD/jeg-OptiPlex-GX620/dyninst-8.2/CMakeFiles/CMakeTmp'
   make: *** [cmTryCompileExec3894022312/fast] Error 2

*  Issue 3: (Engelbert's ubuntu issue):*

hi jim,
another error has shown up which has to do with libdwarf.so. I did "sudo
apt-get install libdwarf-dev" but this brought me no relief... Here' the
error:
...
../../common/src/arch-x86.C: In member function 'bool
NS_x86::instruction::isNop() const':
../../common/src/arch-x86.C:5972:8: warning: variable
'displacement_location' set but not used [-Wunused-but-set-variable]
     int displacement_location = 0;
         ^
../../common/src/arch-x86.C:5973:8: warning: variable
'displacement_size' set but not used [-Wunused-but-set-variable]
     int displacement_size = 0;
         ^
Compiling ../../common/src/arch-power.C
In file included from ../../common/src/arch-power.C:32:0:
../../common/h/arch-power.h: In constructor
'NS_power::instruction::instruction(const void*)':
../../common/h/arch-power.h:782:34: warning: cast from type 'const
void*' to type 'NS_power::instructUnion*' casts away qualifiers
[-Wcast-qual]
        insn_ = *((instructUnion *)ptr);
                                   ^
Compiling ../../common/src/debug_common.C
Compiling ../../common/src/VariableLocation.C
Compiling ../../common/src/Buffer.C
Updating build voucher information: V_libcommon
common build voucher being constructed for libcommon: BUILD#0
      $common: v8.1.2-1 libcommon #0 2014/04/11 11:18
etijskens@bert-macbookpro-ubuntu $
Compiling V_libcommon.o
Linking libcommon.so.8.1.2
Making symlink libcommon.so.8.1.2 to libcommon.so.8.1
Making symlink libcommon.so.8.1 to libcommon.so
make[1]: Leaving directory
`/home/etijskens/software/openspeedshop-release-2.1/BUILD/bert-MacBookPro-ubuntu/dyninst-8.1.2/common/x86_64-unknown-linux2.4'
make[1]: Entering directory
`/home/etijskens/software/openspeedshop-release-2.1/BUILD/bert-MacBookPro-ubuntu/dyninst-8.1.2/dwarf/x86_64-unknown-linux2.4'
../../make.library.tmpl:254: DEPENDS: No such file or directory
Building depends files
make[1]: Leaving directory
`/home/etijskens/software/openspeedshop-release-2.1/BUILD/bert-MacBookPro-ubuntu/dyninst-8.1.2/dwarf/x86_64-unknown-linux2.4'
make[1]: Entering directory
`/home/etijskens/software/openspeedshop-release-2.1/BUILD/bert-MacBookPro-ubuntu/dyninst-8.1.2/dwarf/x86_64-unknown-linux2.4'
Compiling ../src/dwarfResult.C
Compiling ../src/dwarfExprParser.C
Compiling ../src/dwarfFrameParser.C
Compiling ../src/dwarfHandle.C
Updating build voucher information: V_libdynDwarf
dynDwarf build voucher being constructed for libdynDwarf: BUILD#0
      $dynDwarf: v8.1.2-1 libdynDwarf #0 2014/04/11 11:18
etijskens@bert-macbookpro-ubuntu $
Compiling V_libdynDwarf.o
Linking libdynDwarf.so.8.1.2
/usr/bin/ld: /usr/lib/libdwarf.a(dwarf_alloc.o): relocation R_X86_64_32S
against `.rodata' can not be used when making a shared object; recompile
with -fPIC
/usr/lib/libdwarf.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libdynDwarf.so.8.1.2] Error 1
make[1]: Leaving directory
`/home/etijskens/software/openspeedshop-release-2.1/BUILD/bert-MacBookPro-ubuntu/dyninst-8.1.2/dwarf/x86_64-unknown-linux2.4'
make: *** [dwarf] Error 2
error: Bad exit status from
/home/etijskens/software/openspeedshop-release-2.1/INSTALL/bert-MacBookPro-ubuntu/rpm-tmp.Dm8RP9
(%build)


*Issue 4:  (Engelbert's second issue on a non-ubuntu platform):*

tried installing the latest version of open speed shop
(rc-openspeedshop-release-2.1-u3.tar.gz) on a scientific linux (using
gcc 4.8.1) but get the error below
i used this command to get it going

$ ./install-tool --build-offline --openss-prefix $VSC_DATA/oss-2.1
--with-openmpi
/apps/antwerpen/turing/harpertown/software/OpenMPI/1.6.5-GCC-4.8.1
...
Compiling ../src/emitElf.C
In file included from
/data/antwerpen/201/vsc20170/oss-2.1/include/boost/tuple/tuple.hpp:33:0,
                  from ../src/emitElfStatic.h:47,
                  from ../src/emitElf.C:40:
/data/antwerpen/201/vsc20170/oss-2.1/include/boost/tuple/detail/tuple_basic.hpp:
In function ‘typename boost::tuples::access_traits<typename
boost::tuples::element<N, boost::tuples::cons<HT, TT>
 >::type>::const_type boost::tuples::get(const boost::tuples::cons<HT,
TT>&)’:
/data/antwerpen/201/vsc20170/oss-2.1/include/boost/tuple/detail/tuple_basic.hpp:228:45:
warning: typedef ‘cons_element’ locally defined but not used
[-Wunused-local-typedefs]
    typedef BOOST_DEDUCED_TYPENAME impl::type cons_element;
                                              ^
../src/emitElf.C: In function ‘int elfSymType(Dyninst::SymtabAPI::Symbol*)’:
../src/emitElf.C:171:39: error: ‘STT_GNU_IFUNC’ was not declared in this
scope
       case Symbol::ST_INDIRECT: return STT_GNU_IFUNC;
                                        ^
make[1]: *** [emitElf.o] Error 1
make[1]: Leaving directory
`/data/antwerpen/201/vsc20170/openspeedshop-release-2.1/BUILD/r2e2cn03/dyninst-8.1.2/symtabAPI/x86_64-unknown-linux2.4'
make: *** [symtabAPI] Error 2
error: Bad exit status from
/user/antwerpen/201/vsc20170/data/openspeedshop-release-2.1/INSTALL/r2e2cn03/rpm-tmp.55545
(%build)


RPM build errors:
     Macro %target_prefix has empty body
     Macro %target_prefix has empty body
     Bad exit status from
/user/antwerpen/201/vsc20170/data/openspeedshop-release-2.1/INSTALL/r2e2cn03/rpm-tmp.55545
(%build)
DYNINST FAILED TO BUILD - TERMINATING BUILD SCRIPT.  Please check for
errors.  sys=r2e2cn03


Any help will be greatly appreciated.

Thanks
Jim G



_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api




[← Prev in Thread] Current Thread [Next in Thread→]