Compiling libptrace - compilation

Trying to compile libptrace (http://sourceforge.net/projects/libptrace/). The project has not advertised any preferred means of requesting support (Unfortunately, this project hasn't indicated the best way to get help). Anywho, the problem I'm running into is as follows:
% ./build.sh
% ...[SUCCESS]
% ./configure
% ...[SUCCESS]
% make
Making all in src
make[2]: Entering directory `/home/xxx/build/libptrace-git.git/src'
make[2]: *** No rule to make target `../lib/libgnu.la', needed by `libptrace.la'. Stop.
make[2]: Leaving directory `/home/xxx/build/libptrace-git.git/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/xxx/build/libptrace-git.git'
make: *** [all] Error 2
%
If you google libptrace and libgnu.la, you get zero hits. Grepping for it in the source take fresh out of git, you get:
% grep -sre libgnu.la *
src/Makefile.in:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile.in:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile.am:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile:libptrace_la_LIBADD = ../lib/libgnu.la
I have no idea how to generate a libtool archive file, and source doesn't seem to have any make targets or scripts otherwise to do so.
An note on admin: please add the tag `libptrace' to this question - obviously a very popular topic - I can't do so as I don't meet the 1.5K point count :(
In response to Mel's amendment to build.sh, Here are the new errors generated on `make':
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src -g -O2 -Wall -MT test-linux-dlsym.o -MD -MP -MF .deps/test-linux-dlsym.Tpo -c -o test-linux-dlsym.o test-linux-dlsym.c
mv -f .deps/test-linux-dlsym.Tpo .deps/test-linux-dlsym.Po
/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -Wall -o test-linux-dlsym test-linux-dlsym.o ../../src/libptrace.la
libtool: link: gcc -g -O2 -Wall -o .libs/test-linux-dlsym test-linux-dlsym.o ../../src/.libs/libptrace.so -Wl,-rpath -Wl,/usr/local/lib
test-linux-dlsym.o: In function `main':
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:24: undefined reference to `ptrace_elf_get_link_map_head'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:40: undefined reference to `ptrace_elf_get_link_map_next'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:31: undefined reference to `ptrace_elf_get_symtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:32: undefined reference to `ptrace_elf_get_strtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:33: undefined reference to `ptrace_elf_get_hash'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:34: undefined reference to `ptrace_elf_get_hash_chains'
collect2: ld returned 1 exit status
make[2]: *** [test-linux-dlsym] Error 1
make[2]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git/tests/linux'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git'
make: *** [all] Error 2

This is gnulib: http://www.gnu.org/software/gnulib/
It can be install in Debian with apt-get install gnulib

builds on Ubuntu 10.10, gnulib is required as noted above and probably a whole bunch of build tools (autoconf, automake)
below patch fixes a link error which occurs when building git cc97c9e3d830bd1d567011ec099846343cef547a
diff --git a/src/Makefile.am b/src/Makefile.am
index 6de8cf2..5f8d9bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
## -23,8 +23,8 ## endif
if TARGET_LINUX
libptrace_la_SOURCES += libptrace_linux.c libptrace_linux.h \
libptrace_wrapper.c libptrace_wrapper.h \
- libptrace_linux_procfs.c libptrace_linux_procfs.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_linux_procfs.c libptrace_linux_procfs.h \
+ libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_linux.h libptrace_wrapper.h
if TARGET_I386
libptrace_la_SOURCES += libptrace_linux_x86.c libptrace_linux_x86.h
## -38,8 +38,8 ## endif
if TARGET_FREEBSD
libptrace_la_SOURCES += libptrace_freebsd.c libptrace_freebsd.h \
- libptrace_wrapper.c libptrace_wrapper.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_wrapper.c libptrace_wrapper.h \
+ libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_freebsd.h libptrace_wrapper.h
if TARGET_I386
libptrace_la_SOURCES += libptrace_freebsd_x86.c libptrace_freebsd_x86.h

First of all, this only works on linux. If you want this to work on other systems, you will need to write a src/libptrace_config.h header in configure.ac as can be seen by grep COMPILE_HDR configure.ac.
Secondly, the following patch is all I need to get the point where the generated header is missing on my system. Of course gnulib needs to be installed and gnulib-tool must be in $PATH.
diff --git a/build.sh b/build.sh
index 81caf8a..cc195c4 100755
--- a/build.sh
+++ b/build.sh
## -1,7 +1,7 ##
#!/bin/sh
# Import gnulib modules which we use
-gnulib-tool --import stdint
+gnulib-tool --libtool --import stdint
# Update timestamp to make sure autoconf rebuilds everything.
touch configure.ac

Related

cross-compile iperf from x86_64 for ARM64 target

I want to cross compile iperf-2.0.5 from my x86_64 ubuntu linux machine for a ARM64 target. Therefore I installed the cross compiler:
sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
then I tried to configure:
./configure --build=aarch64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --enable-static --disable-shared
which gives me this warning: configure: WARNING: unrecognized options: --enable-static, --disable-shared
apart from this warning i'm not getting any errors but I'm not sure how to verify that the build and host parameters are selected correctly.
When I run make I get the following error.
make all-recursive
make[1]: Entering directory '/home/recherma/Documents/iperf-2.0.5'
Making all in compat
make[2]: Entering directory '/home/recherma/Documents/iperf-2.0.5/compat'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -Wall -O2 -MT delay.o -MD -MP -MF ".deps/delay.Tpo" -c -o delay.o delay.cpp; \
then mv -f ".deps/delay.Tpo" ".deps/delay.Po"; else rm -f ".deps/delay.Tpo"; exit 1; fi
In file included from /usr/include/c++/9/stdlib.h:36,
from ../include/headers.h:78,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/cstdlib:151:11: error: ‘::malloc’ has not been declared
151 | using ::malloc;
| ^~~~~~
In file included from ../include/headers.h:78,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/stdlib.h:65:12: error: ‘std::malloc’ has not been declared
65 | using std::malloc;
| ^~~~~~
In file included from /usr/include/c++/9/cmath:42,
from /usr/include/c++/9/math.h:36,
from ../include/headers.h:85,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/bits/cpp_type_traits.h:214:12: error: redefinition of ‘struct std::__is_integer<int>’
214 | struct __is_integer<int>
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/cpp_type_traits.h:138:12: note: previous definition of ‘struct std::__is_integer<int>’
138 | struct __is_integer<bool>
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:273: delay.o] Error 1
make[2]: Leaving directory '/home/recherma/Documents/iperf-2.0.5/compat'
make[1]: *** [Makefile:252: all-recursive] Error 1
make[1]: Leaving directory '/home/recherma/Documents/iperf-2.0.5'
make: *** [Makefile:190: all] Error 2
So I guess the configuration failed. Does anyone know now to configure it correctly?
EDIT:
I think --host should be changed to aarch64-unknown-linux-gnu. But this changes nothing and I get the exact same errors.
Try removing DAST_CHECK_BOOL from configure.ac and try reconfigure again.
If that didn't help, after configure, comment #define bool int in config.h and try rebuild.

u-boot-fw-utils_2019.07.bb:do_compile) failed with exit code '1' - RAUC(Yocto)

I am integrating the software update mechanism RAUC in my yocto project for my device. I followed these instructions in README file and I read the rauc documentation. Unfortunately I couldn't make it work and I got this error: u-boot-fw-utils_2019.07.bb:do_compile) failed with exit code '1'
The log.do_compile file content is :
DEBUG: Executing shell function do_compile
NOTE: make -j 16 CROSS_COMPILE=arm-poky-linux-gnueabi- CC=arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0=/usr/src/debug/u-boot-fw-utils/1_2019.07-r0 -fdebug-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0=/usr/src/debug/u-boot-fw-utils/1_2019.07-r0 -fdebug-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot= -fdebug-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now HOSTCC=gcc -isystem/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/lib -L/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/lib -Wl,-rpath,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/bsp/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 V=1 tx6q-1036_mfg_config tx6q-1036_config
set -e; \
for i in tx6q-1036_mfg_config tx6q-1036_config; do \
make -f ./Makefile $i; \
done
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig tx6q-1036_mfg_config
scripts/kconfig/conf --defconfig=arch/../configs/tx6q-1036_mfg_defconfig Kconfig
***
*** Can't find default configuration "arch/../configs/tx6q-1036_mfg_defconfig"!
***
scripts/kconfig/Makefile:128: recipe for target 'tx6q-1036_mfg_defconfig' failed
make[2]: *** [tx6q-1036_mfg_defconfig] Error 1
Makefile:516: recipe for target 'tx6q-1036_mfg_config' failed
make[1]: *** [tx6q-1036_mfg_config] Error 2
Makefile:498: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2
ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
ERROR: Execution of '/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/temp/run.do_compile.25964' failed with exit code 1:
set -e; \
for i in tx6q-1036_mfg_config tx6q-1036_config; do \
make -f ./Makefile $i; \
done
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig tx6q-1036_mfg_config
scripts/kconfig/conf --defconfig=arch/../configs/tx6q-1036_mfg_defconfig Kconfig
***
*** Can't find default configuration "arch/../configs/tx6q-1036_mfg_defconfig"!
***
scripts/kconfig/Makefile:128: recipe for target 'tx6q-1036_mfg_defconfig' failed
make[2]: *** [tx6q-1036_mfg_defconfig] Error 1
Makefile:516: recipe for target 'tx6q-1036_mfg_config' failed
make[1]: *** [tx6q-1036_mfg_config] Error 2
Makefile:498: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2
WARNING: exit code 1 from a shell command.
Anybody could help in this.
Are you aware of the meta-rauc-community project? In order to make Rauc work with your board in yocto, you either need to add the necessary meta-rauc-community layer or extend support to the board. There are some bbappends that u-boot uses in order to permit the use of Rauc.
To address your specific issue though, it appears as if the defconfig u-boot requires is missing. This error doesn't seem to be related to rauc as far as I can tell. Are you sure you're setting the correct UBOOT_MACHINE in your machine config file?
I fixed that, the problem was with u-boot-fw-utils in the karo-bsp zeus release, I upgraded to the Hardknott release and u-boot-fw-utils compiles fine.

fatal error: png.h: No such file or directory(MiddleBury Evaluation)

I am testing stereo algorithm in MiddleBury Stereo Evaluation
One of step was to compile the tools in code/as follows.
cd code/imageLib
make
cd ..
make
cd ..
In this case, there is error in first make as follows,
$ make
g++ -O3 -W -Wall -g -c -o ImageIOpng.o ImageIOpng.cpp
ImageIOpng.cpp:19:17: fatal error: png.h: No such file or directory
compilation terminated.
make: *** [<builtin>: ImageIOpng.o] Error 1
and, regarding second make,
$ make
g++ -g -O3 -W -Wall -IimageLib ii.cpp -LimageLib -lImg.i686-g -lpng -lz -o ii
/usr/lib/gcc/i686-pc-cygwin/5.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lImg.i686-g
/usr/lib/gcc/i686-pc-cygwin/5.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lpng
collect2: error: ld returned 1 exit status
make: *** [<builtin>: ii] Error 1
In previous step, make worked fine.
So, what was the problem? I downloaded sample algorithm and did not edit/change contents in any file.
png.h is part of libpng16-devel and the specific include
directory must be added to the include path of your project.
$ cygcheck -l libpng16-devel |grep png.h
/usr/include/libpng16/png.h

lack of the file (cholrl.a) during make

I install Lapack-3.6.1 on Ubutun.There is a problem during make, lack of the file (cholrl.a). The error message is this.
make[1]: Leaving directory '/usr/local/src/lapack-3.6.1/BLAS/SRC' ( cd
SRC/VARIANTS ; make) make[1]: Entering directory
'/usr/local/src/lapack-3.6.1/SRC/VARIANTS' gfortran -O2 -frecursive
-c cholesky/RL/cpotrf.f -o cholesky/RL/cpotrf.o gfortran -O2 -frecursive -c cholesky/RL/dpotrf.f -o cholesky/RL/dpotrf.o gfortran -O2 -frecursive -c cholesky/RL/spotrf.f -o cholesky/RL/spotrf.o gfortran -O2 -frecursive -c cholesky/RL/zpotrf.f -o
cholesky/RL/zpotrf.o ar cr LIB/cholrl.a cholesky/RL/cpotrf.o
cholesky/RL/dpotrf.o cholesky/RL/spotrf.o cholesky/RL/zpotrf.o ar:
LIB/cholrl.a: No such file or directory Makefile:38: recipe for target
'cholrl' failed make[1]: * [cholrl] Error 1 make[1]: Leaving
directory '/usr/local/src/lapack-3.6.1/SRC/VARIANTS' Makefile:39:
recipe for target 'variants' failed make: * [variants] Error 2
Do you have a solution?
Creating LIB directory myself worked for me. So, type mkdir LIB in SRC/VARIANTS.

'glib.h' file not found on Max OSX 10.9

I'm trying to compile msg2pdf which is a tool to convert messages in mu4e (mu for Emacs) to pdf.
I'm receiving the following error :
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
CC msg2pdf.o
In file included from msg2pdf.c:20:
In file included from ../../lib/mu-msg.h:24:
../../lib/mu-flags.h:24:10: fatal error: 'glib.h' file not found
#include <glib.h>
^
1 error generated.
make[2]: *** [msg2pdf.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Oddly, I checked the Makefile and GLIB_CFLAGS seem to be pointing on the right folder (where brew installed it).
In fact, glib.h is located in /usr/local/Cellar/glib/2.40.0_1/include/glib-2.0.
GLIB_CFLAGS = -D_REENTRANT -I/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.40.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include
GLIB_LIBS = -L/usr/local/Cellar/glib/2.40.0_1/lib -L/usr/local/opt/gettext/lib -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
How can I succeed compiling the file? Is there any command line "hack" I can use while calling
make?
Edit
Here are the files in the directory
https://github.com/flexdec/temp
Edit 2
This is the output when using make V=1
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib -DICONDIR='""' -Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement -g -O2 -MT msg2pdf.o -MD -MP -MF .deps/msg2pdf.Tpo -c -o msg2pdf.o msg2pdf.c
In file included from msg2pdf.c:20:
In file included from ../../lib/mu-msg.h:24:
../../lib/mu-flags.h:24:10: fatal error: 'glib.h' file not found
#include <glib.h>
^
1 error generated.
make[2]: *** [msg2pdf.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Edit 3
The new error I get using make V=1 now that GLIB_CFLAGS issue is fixed
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib -D_REENTRANT -I/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.40.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -DICONDIR='""' -Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement -g -O2 -MT msg2pdf.o -MD -MP -MF .deps/msg2pdf.Tpo -c -o msg2pdf.o msg2pdf.c
msg2pdf.c:24:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
^
1 error generated.
make[2]: *** [msg2pdf.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
make V=1 instead of make will tell you what the C compiler command looks like (instead of just "CC msg2pdf.o")—check that and make sure it includes the flags you need.
Based on a quick look at your Makefile.am, you are including $(GTK_CFLAGS) and $(WEBKIT_CFLAGS) in your AM_CPPFLAGS but not $(GLIB_CFLAGS).
You need to run ./configure in mu's top-level directory on the machine where you want to compile it. configure will tell you about any missing dependencies. Optional components (such as msg2pdf) are skipped if their dependencies are not there.
Then, after configure succeeds, do a 'make'.
In any case, if configure has run successfully, the top-level 'make' should succeed as well (that's why we have configure!), otherwise please file a bug.

Resources