Intel PIN:Initial Set up of Intel PIN tool - c++

I am new to PIN tool. I just tried to run the example code given in the readme file.
Initially I build using :
$ cd source/tools/ManualExamples
$ make all
It compiled correctly and created Obj-intel64 folder with .so and .o files
but when I compiled $ make inscount0.test
I'm getting the following message:
pavan#pavan-Inspiron-5521:~/Drive/PIN/pin-2.13-61206-gcc.4.4.7-linux/source/tools/ManualExamples$ make inscount0.test
make -C ../../../source/tools/Utils dir obj-intel64/cp-pin
make[1]: Entering directory `/home/pavan/Drive/PIN/pin-2.13-61206-gcc.4.4.7-linux/source/tools/Utils'
mkdir -p obj-intel64
g++ -DTARGET_IA32E -DHOST_IA32E -DFUND_TC_TARGETCPU=FUND_CPU_INTEL64 -DFUND_TC_HOSTCPU=FUND_CPU_INTEL64 -DTARGET_LINUX -DFUND_TC_TARGETOS=FUND_OS_LINUX -DFUND_TC_HOSTOS=FUND_OS_LINUX -O3 -o obj-intel64/cp-pin cp-pin.cpp
make[1]: Leaving directory `/home/pavan/Drive/PIN/pin-2.13-61206-gcc.4.4.7-linux/source/tools/Utils'
../../../pin -t obj-intel64/inscount0.so -- ../../../source/tools/Utils/obj-intel64/cp-pin makefile obj-intel64/inscount0.makefile.copy \
> obj-intel64/inscount0.out 2>&1
make: *** [inscount0.test] Error 127
Regards,
Pavan

To make a particular pin tool, you have to give the command as
$ make obj-intel64/toolname.so
If you want to run the pin tool on some target, let the path to pin binary is $PIN_ROOT and path to pin tools is $PIN_TOOL
$ $PIN_ROOT/pin -t $PIN_TOOL/pintool_folder/obj-intel64/toolname.so -- target

Related

codelite unittest++/UnitTest++.h: no such file or directory

I am trying to do unit testing with C++/Codelite. I have UnitTest++ plugin installed from codelite-plugins package (Ubuntu 18.04). I can also see this:
$ ls -la /usr/include | grep Unit
drwxr-xr-x 3 root root 4096 Mar 2 11:47 UnitTest++
$ sudo dpkg -l | grep unittest++
ii libunittest++-dev 2.0.0-2 amd64 unit testing framework for c++, static library and headers
ii libunittest++2:amd64 2.0.0-2 amd64 unit testing framework for c++, runtime library
So I create a test project in Codelite and I add this:
#include <unittest++/UnitTest++.h> // This line and main are auto-created
TEST(SanityTest)
{
CHECK_EQUAL(1, 1);
}
int main(int argc, char **argv)
{
return UnitTest::RunAllTests();
}
Now I would expect test results after I press CTRL+F5. But when I do, I only get a popup window saying there are no tests:
I also noticed that when I go to Build > Build Project I get an error message:
fatal error: unittest++/UnitTest++.h: No such file or directory
I also found THIS ANSWER and tried different variation of console commands as per answer/comments there, but I always get the same no such file or directory error.
Any idea what I am missing?
EDIT:
Build log as per Stephen's Newell request:
/bin/sh -c '/usr/bin/make -j8 -e -f Makefile'
----------Building project:[ Test - Debug ]----------
make[1]: Entering directory '/home/callmebob/Documents/workspace-codelite/cpp/Test'
/usr/bin/g++ -c "/home/callmebob/Documents/workspace-codelite/cpp/Test/main.cpp" -g -o Debug/main.cpp.o -I. -I/usr/include/unittest++
/home/callmebob/Documents/workspace-codelite/cpp/Test/main.cpp:1:10: fatal error: unittest++/UnitTest++.h: No such file or directory
#include "unittest++/UnitTest++.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Test.mk:95: recipe for target 'Debug/main.cpp.o' failed
make[1]: *** [Debug/main.cpp.o] Error 1
make[1]: Leaving directory '/home/callmebob/Documents/workspace-codelite/cpp/Test'
Makefile:4: recipe for target 'All' failed
make: *** [All] Error 2
====2 errors, 0 warnings====
Also if I right-click the project, go to Settings > Compiler, I can see:
Included Paths = /usr/include/unittest++
Based on your ls output, it looks like you should change your first line to this:
#include <UnitTest++/UnitTest++.h>
I'm not sure why the answer you linked to worked with a lowercase directory name; the examples in the project documentation all use the mixed-case directory name.

building from source Qpid Messaging API (C++, bindings) [Qpid C++ 1.37.0] - missing files

I am trying to build from sources Qpid Messaging API (C++, bindings).
Build is triggered on RHEL and all prerequisites mentioned on link below are installed.
https://git-wip-us.apache.org/repos/asf?p=qpid-cpp.git;a=blob_plain;f=INSTALL.txt;hb=HEAD
yet when reaching step: make all
what i get is this
error:
Linking CXX shared library libqpidclient.so
[ 86%] Built target qpidclient
Scanning dependencies of target qpidmessaging
[ 86%] Building CXX object src/CMakeFiles/qpidmessaging.dir/qpid/messaging/amqp/AddressHelper.cpp.o
In file included from /home/m020390/qpid_cpp/qpid-cpp-1.37.0/src/qpid/messaging/amqp/AddressHelper.cpp:22:0:
/home/m020390/qpid_cpp/qpid-cpp-1.37.0/src/qpid/messaging/amqp/PnData.h:27:27: fatal error: proton/engine.h: No such file or directory
#include <proton/engine.h>
^
compilation terminated.
make[3]: *** [src/CMakeFiles/qpidmessaging.dir/qpid/messaging/amqp/AddressHelper.cpp.o] Error 1
make[2]: *** [src/CMakeFiles/qpidmessaging.dir/all] Error 2
make[1]: *** [examples/messaging/CMakeFiles/client.dir/rule] Error 2
make: *** [client] Error 2
that would indicate that "Qpid proton-c " might be missing but its installed....
any ideas ?
It worked for me using these steps.
$ wget http://apache.claz.org/qpid/proton/0.18.1/qpid-proton-0.18.1.tar.gz
$ tar -xf qpid-proton-0.18.1.tar.gz
$ cd qpid-proton-0.18.1/
$ mkdir bld
$ cd bld
$ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/testprefix
$ make -j8
$ make install
$ cd ../..
$ wget http://apache.claz.org/qpid/cpp/1.37.0/qpid-cpp-1.37.0.tar.gz
$ tar -xf qpid-cpp-1.37.0.tar.gz
$ cd qpid-cpp-1.37.0/
$ mkdir bld
$ cd bld
$ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/testprefix
>>>> Here check for "Found Proton" in the cmake output <<<<
$ make -j8
$ make install
Check that proton/engine.h is where you think it should be. In your case, it looks like that would be /usr/local/include/proton/engine.h.
You can use the following command to see what your include search path is.
cpp -v /dev/null -o /dev/null
As stated in the very INSTALL file you provided the link to:
Note: If Proton is installed in a non-standard location, there are two
ways to locate it:
Recommended: use proton 0.7 or later and use the same install prefix for both Proton and Qpid.
Using pkg-config: set the PKG_CONFIG_PATH environment variable to /lib[64]/pkgconfig before running cmake.
I'd go for method 1 and rebuild Proton specifiyng an install prefix to cmake, this way:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
Then use the same prefix for Qpid (i.e. run cmake again, just like the above).

run qwt example in Qt 5 on linux ubuntu

I cant figure out what I need to do for running example program which use Qwt library.
I download the file qwt-6.1.2.tar.bz2 from here as usual it goes to Download Direcory and I extract the file to this directory. I have now qwt-6.1.2 directory in Downloads directory.
The Qt directory in my machine located in /opt/Qt5.4.1/
How I continue from here?
I try to run qmake:
natile#natile-Precision-T1650:/opt/Qt5.4.1/5.4/gcc_64/bin$ sudo ./qmake /home/natile/Downloads/qwt-6.1.2/qwt.pro
And after I ran make:
natile#natile-Precision-T1650:/opt/Qt5.4.1/5.4/gcc_64/bin$ sudo make
but I get an error:
cd src/ && ( test -e Makefile || /opt/Qt5.4.1/5.4/gcc_64/bin/qmake /home/natile/Downloads/qwt-6.1.2/src/src.pro -o Makefile ) && make -f Makefile
make[1]: Entering directory `/opt/Qt5.4.1/5.4/gcc_64/bin/src'
compiling /home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_abstract_scale_draw.cpp
In file included from /home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_abstract_scale_draw.cpp:19:0:
/home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_scale_map.h:92:5: error: ‘QT_STATIC_CONST’ does not name a type
/home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_scale_map.h:93:5: error: ‘QT_STATIC_CONST’ does not name a type
make[1]: *** [obj/qwt_abstract_scale_draw.o] Error 1
make[1]: Leaving directory `/opt/Qt5.4.1/5.4/gcc_64/bin/src'
make: *** [sub-src-make_first-ordered] Error 2
I understand that I have to run qmake.
I get nothing in the installation URL: http://qwt.sourceforge.net/qwtinstall.html
Please help.
The following approach works good for me:
cd /home/natile/Downloads/qwt-6.1.2/
mkdir build
/opt/Qt5.4.1/5.4/gcc_64/bin/qmake qwt.pro -o build/Makefile QWT_CONFIG="QwtExamples"
cd build
make
cd examples/bin
# Now you can launch any example, like:
./dials

libtool error building thrift 0.9.1 on Ubuntu 13.04

Building thrift 0.9.1 (support C, C++, java, C#, perl, python) on Ubuntu 13.04 I am getting this error.
./configure run without any options, make run without any options...
Making all in test
make[2]: Entering directory `/home/dvb/sw/thrift-0.9.1/test'
Making all in nodejs
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
Making all in cpp
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
Makefile:832: warning: overriding commands for target `gen-cpp/ThriftTest.cpp'
Makefile:829: warning: ignoring old commands for target `gen-cpp/ThriftTest.cpp'
/bin/bash ../../libtool --tag=CXX --mode=link g++ -Wall -g -O2 -L/usr/lib -o libtestgencpp.la ThriftTest_constants.lo ThriftTest_types.lo ../../lib/cpp/libthrift.la -lssl -lcrypto -lrt -lpthread
libtool: link: ar cru .libs/libtestgencpp.a .libs/ThriftTest_constants.o .libs/ThriftTest_types.o
ar: .libs/ThriftTest_constants.o: No such file or directory
make[3]: *** [libtestgencpp.la] Error 1
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dvb/sw/thrift-0.9.1'
make: *** [all] Error 2
dvb#dvb-u13:~/sw/thrift-0.9.1$
While this seems to be a defect in the 0.9.1 release tarball, it is not a problem in the top of tree pulled via git as of this afternoon.
The solution if one encounters this problem is to use a newer version of thrift by getting the source tree directly via git instead of downloading the tarball. The only difference in build is you will need to run bootstrap.sh before configure. This is well documented.
Note two additional helpful bits of data:
1. Configure to build --without-tests (Mike Johnson below - thanks)
2. This issue is fixed in 0.9.2 release (Luke below- thanks!)
I ran into this problem tonight and "fixed" it. The problem is that ar(1) can't find the .o files in the directory test/cpp/.libs. I'm sure that there's some missing magic in the Makefile.am in test/cpp, but I've neither the patience or automake-fu to fix that.
Instead, I just symlinked the .o files from test/cpp to test/cpp/.libs/. That fixes the build of the C++ tests.
cd thrift-0.9.1/test/cpp/.libs
for i in ../*.o; do echo $i; ln -s $i .; done
Thrift was since released with this compile problem. You can choose to skip compiling tests, instead:
./configure --without-tests
You can also try this:
./configure
(cd test/cpp; ln -s . .libs)
make install
This will simply link .libs back to test/cpp. "ar" will find the files there.
David V is right that 0.9.1 is broken but 0.9.2 works. The build instructions seem to be a broken link as well. So here are the commands that worked for me, from a fresh Ubuntu install:
# Install java if you don't have it
sudo apt-get install default-jre
# install build dependencies
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
cd /tmp
curl http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz | tar zx
cd thrift-0.9.2/
./configure
make
sudo make install
#test that it can run
thrift --help
(credit goes to these helpful instructions; I just replaced 0.9.1 with 0.9.2)
I happened to face this problem. You can try cp all test/cpp/*.o to .libs folder.
Or you can skip compiling tests.
cp test/cpp/*.o test/cpp/.libs/

Compiling Festival on MingW32

I'm trying to compile Festival on MingW32, so I can have a Windows binary. I couldn't find the Windows binary on their site. Anyone have one they can post?
If not, here's what I have so far. I did the ./configure and make for it and have the following message:
$ make
config/config:43: ../speech_tools/config/config: No such file or directory
So, I downloaded the speech_tools tar ball and got. Did the ./configure and make to get:
$ make
config/config:156: config/systems/ix86_unknown.mak: No such file or directory
../config/config:156: ../config/systems/ix86_unknown.mak: No such file or directory
make: *** No rule to make target `../config/systems/ix86_unknown.mak'. Stop.
config/rules/modules.mak:133: config/modincludes.inc: No such file or directory
make --no-print-directory -C ./config MADE_FROM_ABOVE=1 MODINCLUDES=1 INCLUDE_EVERYTHING='' modincludes.inc
../config/config:156: ../config/systems/ix86_unknown.mak: No such file or directory
make[1]: *** No rule to make target `../config/systems/ix86_unknown.mak'. Stop.
make: *** [config/modincludes.inc] Error 2
So, I copied config/systems/ix86_CYGWIN32.mak to ix86_unknown.mak and tried again. Now I get this message:
g++ -c -fno-implicit-templates -O3 -Wall -Wno-non-template-friend -Wno-deprecated -DSUPPORT_EDITLINE -I../include slib.cc
In file included from slib.cc:85:
../include/EST_unix.h:53:25: sys/wait.h: No such file or directory
../include/EST_unix.h:54:29: sys/resource.h: No such file or directory
In file included from ../include/EST_String.h:50,
from ../include/siod.h:17,
from slib.cc:88:
../include/EST_iostream.h:54:26: strstream.h: No such file or directory
In file included from ../include/EST_TList.h:50,
from ../include/EST_string_aux.h:43,
from ../include/siod.h:18,
from slib.cc:88:
Where do I get sys/wait.h, sys/resource.h and strstream.h? I'd rather not have to try this whole bit in Cygwin and carry around those annoying DLL's. Any advice?
Windows binaries are available here
You'll get further with a full cygwin install instead of just mingwin, but I can't promise success.
I run Ubuntu and remember having Festival available in the Synaptics repository, implying I just had to double click the name, and the thing installed itself with all its dependencies.
If all else fails, you might want to run a VM with ubuntu or dual boot.