dtrace: failed to compile script Preprocessor not found - gcc

I'm trying to test this script from oracle to get active NFS clients on Ubuntu 10.04, but I can' get it to run.
To achieve that, I first installed dtrace following these instructions. This is what I've done exactly:
apt-get install bison flex zlib1g-dev libelf-dev binutils-dev libdw-dev libc6-dev-i386
wget ftp://crisp.dyndns-server.com/pub/release/website/dtrace/dtrace-20121009.tar.bz2
tar xfj dtrace-20121009.tar.bz2
cd dtrace-20121009
make all
make install
make load
However, I get this warning when compiling:
=================================================================
=== You need /usr/lib/libdwarf.a and /usr/lib/libbfd.a installed to build.
===
=== apt-get install binutils-dev
=== apt-get install libdw-dev
===
=== Without these, we will not build ctfconvert (needed for
=== SDT structure definitions).
=================================================================
cd cmd/instr ; make --no-print-directory
cd usdt/c ; make --no-print-directory
tools/mkdriver.pl all
Executing: /usr/src/dtrace/dtrace-20121009/tools/make-me
make -C /lib/modules/2.6.38-16-server/build M=/usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver
CC [M] /usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver/systrace.o
LD [M] /usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver/dtracedrv.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] /usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver/dtracedrv.ko
tools/mkctf.sh
build/ctfconvert not available - so not building the linux.ctf file
NOTE: The build is complete, but build/ctfconvert is not available.
This means you will get run time errors from the io.d and sched.d files
due to undefined kernel structure definitions. Simply delete or rename
these files until a fix can be put in place to handle older
distros which do not have the required libdwarf dependencies.
(Typical error is references to undefined struct definitions such
as dtrace_cpu_t).
sync
I've installed libdw-dev and binutils-dev, but taking a look at the makefile, it seems it looks for libdwarf.so, and libdw on my system is named libdw.so.
To circunvent this, I create a symlink with ln -s /usr/lib/libdw.so /usr/lib/libdwarf.so. After doing so, compiling fails.
cd cmd/ctfconvert ; make --no-print-directory
gcc -g -I. -I../../ -I../../libctf -I../../common -I../../uts/common -I../../linux -I/usr/include/libdwarf -c dwarf.c
In file included from dwarf.c:94:
/usr/include/dwarf.h:56: error: expected identifier before numeric constant
/usr/include/dwarf.h:136: error: expected identifier before numeric constant
/usr/include/dwarf.h:321: error: expected identifier before numeric constant
/usr/include/dwarf.h:461: error: expected identifier before numeric constant
/usr/include/dwarf.h:517: error: expected identifier before numeric constant
make[3]: *** [../../build/ctfconvert.obj/dwarf.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [do_cmds] Error 2
tools/bug.sh
make: *** [all] Error 1
So, let's undo that. I remove the symlink, compile again, run make install and make load and hope everything is fine. And everything seems to be fine.
But, then I try to run the script mentioned above, and it fails:
# ./get_ngs_clients.d
dtrace: failed to compile script ./get_ngs_clients.d: Preprocessor not found
I have no clue on what's going on. I have gcc installed, just in case.
# dpkg -l | grep gcc
ii gcc 4:4.4.3-1ubuntu1 The GNU C compiler
ii gcc-4.4 4.4.3-4ubuntu5.1 The GNU C compiler
ii gcc-4.4-base 4.4.3-4ubuntu5.1 The GNU Compiler Collection (base package)
ii gcc-4.4-multilib 4.4.3-4ubuntu5.1 The GNU C compiler (multilib files)
ii gcc-multilib 4:4.4.3-1ubuntu1 The GNU C compiler (multilib files)
ii lib32gcc1 1:4.4.3-4ubuntu5.1 GCC support library (32 bit Version)
ii libgcc1 1:4.4.3-4ubuntu5.1 GCC support library

If you do not have libdwarf.a on your system, the ctfconvert tool will not build. (libdwarf.a and libdw.a are not the same).
If ctfconvert does not build, then any of your own, or the dtrace etc/*.d scripts may not load. (Dtrace force loads these scripts for you automatically, which is annoying). Any script which relies on structure definitions will then fail.
As of May 2013, I am looking at seeing what it takes to update to libdw.a since this seems to be the modern replacement for libdwarf.
(posted by the 'author' of DTrace/Linux).

Have you tried to add --enable-dtrace=false to /.configure?
Or maybe --with-dtrace=false?
That should do the trick I think...

Related

OCaml: How do I compile/make a program which has file extensions .ml.x?

I have downloaded a project which contains the following files:
assert.mli
assert.ml
deque.ml
deque.mli
eventloop.ml
eventloop.mli
g.ml
gctx.ml
gctx.mli
gdemo.html
gdemo.ml
gdemo.mli
g-js.ml.x
g-native.ml.x
lightbulb.html
lightbulb.ml
lightbulb.mli
Makefile
paint.html
paint.ml
paint.mli
widget.ml
widget.mli
widgetTest.ml
widgetTest.mli
I can compile some of the files that do not depend on other files by doing
$ ocamlc assert.mli assert.ml
for instance. However, eventloop.ml depends on widget.ml and widget.ml depends on gctx.ml. gctx seems to depend on a module G which I believe is a graphics library. When I peek inside g-js.ml.x I see it confirmed that this file is importing a fixed version of the graphics library. However, I have no clue how to use this file. I tried a few guesses in the terminal but to no avail. One example guess was
$ ocamlc g-js.ml.x g.ml
I tried googling "how to compile ocaml ".ml.x"" but didn't come up with anything and I'm not sure if I should be searching for anything else, or if there just isn't much out there about how to handle these files.
I also tried in the terminal $ make -f Makefile and got the error
+ ocamlfind ocamldep -package js_of_ocaml-lwt.graphics -package js_of_ocaml-lwt -package js_of_ocaml -modules gdemo.mli > gdemo.mli.depends
ocamlfind: Package `js_of_ocaml-lwt.graphics' not found
Command exited with code 2.
Compilation unsuccessful after building 1 target (0 cached) in 00:00:00.
Makefile:51: recipe for target 'gdemo.byte' failed
make: *** [gdemo.byte] Error 10
Looking up this error, other people found it fixed by updating OPAM's libraries and especially updating cppo_ocamlbuild but that didn't fix it for me.
Edit: After following some instructions in the comments, I get a new error message when trying to make the Makefile:
rm -rf g.ml
cp g-js.ml.x g.ml
ocamlbuild -use-ocamlfind -pkg js_of_ocaml -pkg js_of_ocaml-lwt -pkg js_of_ocaml-lwt.graphics gdemo.byte
Failure: ocamlfind not found on path, but -no-ocamlfind not used.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.
Makefile:51: recipe for target 'gdemo.byte' failed
make: *** [gdemo.byte] Error 2

Using mingw-w64 and ./configure --host=i686-w64-mingw32.static, make fails and Makefile CC variable looks wrong

I am new to compiling.
I am trying to compile iperf3 for Windows 10 because there is no official Windows distribution of iperf3 and for the learning experience. I am trying to do so on the new Windows Subsystem for Linux feature via Bash on Ubuntu on Windows, also for the learning experience.
I installed mingw-w64, which should give me the proper compiler and environment necessary for cross-compiling:
sudo apt-get install mingw-w64
This put two directories into my /usr directory:
i686-w64-mingw32
x86_64-w64-mingw32
It also put a bunch of things that look like compilers into /usr/bin.
I unzipped the .tar.gz file from iperf3 and navigated into it. Then, I run ./configure --host=i686-w64-mingw32.static and it completes without errors.
I note that the output of the command has a worrisome line: checking for i686-w64-mingw32.static-gcc... no
I note that the Makefile's CC variable is set to gcc, which doesn't sound like the proper compiler.
Then, I run make. It fails with errors:
collect2: error: ld returned 1 exit status
make[2]: *** [iperf3] Error 1
make[2]: Leaving directory `/home/snip/iperf3/iperf-3.1.4/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/snip/iperf3/iperf-3.1.4/src'
make: *** [all-recursive] Error 1
I also see the line: libtool: warning: undefined symbols not allowed in i686-w64-mingw32.static shared libraries; building static only
I think that the ./configure is not working correctly since it appears to have not found the right compiler for my --host argument and put it in the Makefile.
What am I doing wrong?
EDIT:
I changed the command to ./configure --host=i686-w64-mingw32 per comments and it completes without error. But no makefile is created so make yields make: *** No targets specified and no makefile found. Stop.
What am I doing wrong, now?
EDIT 2:
Looks like the ./configure actually is failing. Last line of its output is nanosleep() required for timing operations., which seems to mean that its missing a library for nanosleep.
How do I get nanosleep?
mingw doesn't support nanosleep. So programs using it cannot be compiled using mingw-w64.

Installing PythonMagick with boost on osx

I am trying to install PythonMagick following these instructions. https://gist.github.com/tomekwojcik/2778301
When I get to $ make I get this error
Making all in pythonmagick_src
CXX libpymagick_la-_DrawableFillRule.lo
_DrawableFillRule.cpp:3:10: fatal error: 'boost/python.hpp' file not found
#include <boost/python.hpp>
^
1 error generated.
make[1]: *** [libpymagick_la-_DrawableFillRule.lo] Error 1
make: *** [all-recursive] Error 1
How do I get PythonMagick installed in my project? Any way that will work. I can't find useful instructions anywhere on the internet.
Make sure you have boost-python brew boost-python. Note the version number, as you'll need to replace 1.59.0 below with the correct version.
$ BOOST_ROOT=/usr/local/Cellar/boost/1.59.0
$ ./configure
Edit Makefile and pythonmagick_src/Makefile to include the boost library. You are looking for two lines: DEFAULT_INCLUDES and LDFLAGS. You'll add boost paths to the end of those lines, making them look something like this:
DEFAULT_INCLUDES = -I. -I$(top_builddir)/config -I/usr/local/Cellar/boost/1.59.0/include
LDFLAGS = -L/usr/local/Cellar/boost-python/1.59.0/lib
That should resolve the compile/link errors.

Install nullfs on Debian

I am using a java program. It automatically creates log files in a directory, but I am doing that myself a different way with tee. I cannot find an easy way to disable the logs, so I am resorting to using nullfs.
I cloned it with
git clone https://github.com/xrgtn/nullfs.git
and I ran
make nul1fs
as instructed. It terminates within a second, with the following output:
cc "-lfuse" nul1fs.c -o nul1fs
nul1fs.c:13:18: fatal error: fuse.h: No such file or directory
compilation terminated.
make: *** [nul1fs] Error 1
I tried apt-get source fuse and copying fuse.h into the nullfs directory, but nothing changed.
I have FUSE installed. I'm running Debian wheezy x86_64.
You need the development package of FUSE, which contains the fuse.h you're missing. Do a apt-get install libfuse-dev and it should work.
Copying the header file in the source directory did not work, because in nul1fs.c you'll notice that fuse.h is included with angle brackets. This means, the header file will be searched in the system-wide include paths. That usually means /usr/include.
Note that you then may run into this error:
$ make nul1fs
cc "-lfuse" nul1fs.c -o nul1fs
/tmp/ccbt0X7c.o: In function `main':
nul1fs.c:(.text+0x3c3): undefined reference to `fuse_main_real'
collect2: error: ld returned 1 exit status
make: *** [nul1fs] Error 1
It's a documented bug with a workaround: put the linker flags after the file lists. I.e. compile nul1fs with:
cc nul1fs.c -o nul1fs -lfuse
and not with make nul1fs, which boils down to
cc -lfuse nul1fs.c -o nul1fs

What is the issue with Ubuntu (12.10) and GCC 4.7/4.8?

Since several versions of GCC and Ubuntu I am experiencing annoying issues with paths and naming of several header and object files that are necessary for the installation of GCC.
Description: After installing ubuntu (e.g. in my case 12.04) and installing all prerequisites of the gcc, I run the following commands:
sudo mkdir /usr/local/stow/gcc-4.8.0
./configure --prefix /usr/local/stow/gcc-4.8.0
make
sudo make install
For the sake of completeness, the rest of the installation procedure:
cd /usr/local/stow
sudo stow -t /usr/local/ gcc-4.8.0
gcc -v
However, this simple and proper way of installing gcc has some issues during the 'make' step with the following error messages:
1.) The problem with 'stubs.h'
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
which can be fixed with the following commands added to ~/.bashrc:
if [ -z "$CPATH"]; then
export CPATH="/usr/include/i386-linux-gnu"
else
export CPATH=$CPATH:"/usr/include/i386-linux-gnu"
fi
2.) The problem with 'crti.o', 'crtn.o', and 'crt1.o'
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtn.o: No such file or directory
/usr/bin/ld: cannot find crt1.o: No such file or directory
which can be fixed with the very ugly solution:
sudo ln -s /usr/lib/i386-linux-gnu/crti.o /usr/lib/i386-linux-gnu/crtn.o /usr/lib/i386-linux-gnu/crt1.o /usr/lib
since - and I don't know why - the following commands do not solve the problem during linking steps of 'sudo make install'
if [ -z "$LIBRARY_PATH"]; then
export LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LIBRARY_PATH=$LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
if [ -z "$LD_LIBRARY_PATH"]; then
export LD_LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
(With these solutions I could compile GCC-4.7.2 on Ubuntu 12.04. - I have still issues compiling GCC-4.8.0 on Ubuntu 12.04, but that's different topic.)
My questions are: Does anybody know the reason/background that we have these issues? Does anybody know a proper solution? (With "proper solution" I mean a solution that does not require setting environment variables or symbolic linking libraries to different directories. To me these kind of changes are ugly, since they require changes to the system that one may not be able to trace back or redo.)
In the root folder of your GCC source execute ./contrib/download_prerequisites script.
These are the issues i encountered while compiling GCC 4.8.0 on Ubuntu 12.04 with solutions.
This might help you.
Compilation guide for compiling GCC 4.8 on ubuntu 12.04
ERROR 1
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
SOLUTION
Download and install gmp version >=4.3.2 package because mpc needs higher version
download the source code from gmplib.org
compile the source code and install
while compiling gmp see ERROR 2 for help
Installed gmp version 5.1.1
Download and install mpfr package
Installed mpfr version 3.1.2
Download and install mpc package
Installed mpc version 1.0
Download the packages from
http://ftp.gnu.org
ERROR 2
Error while compiling gmp library
checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin
SOLUTION
sudo apt-get install m4
http://ubuntuforums.org/showthread.php?t=850491
ERROR 3
Cannot find g++ compiler
I got this error because I installed the OS recently and had not installed the compilers.
SOLUTION
sudo apt-get install build-essential
This installs all the standard build essential software
ERROR 4
checking for i686-pc-linux-gnu-gcc... /home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/xgcc -B/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/suhastheju/projects/gcc/gcc-4.8.0/i686-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
Though gcc documentation specify , that , we can provide the path of gmp
and mpfr installtion through –with-gmp and –with-mpfr flag ,
but unfortunately , i tried to give the path but it didnt work.
I am not in position to say final word about , this , whether it is a bug
in build script or something else , but bellow is the solution of the problem.
while building , add gmp and mpfr installation path in LD_LIBRARY_PATH environment
variable. Do as follows
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
If you have the libraries in different path, add the path where libraries are present
ERROR 5
libbackend.a(tree-vect-data-refs.o):tree-vect-data-refs.c:(.text+0x87da): more undefined references to `vector_type_mode(tree_node const*)' follow
collect2: error: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
recompiled the source code from begining, It worked magically
make clean all
ERROR 6
/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/../.././gcc/gcov.c:416: undefined reference to `gcc_init_libintl()'
collect2: ld returned 1 exit status
make[3]: *** [gcov] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
SOLUTION
Added -I/usr/include

Resources