Unable to build libuv - libuv

I'm trying to build libuv 0.11.24 on a Debian machine. I tried:
./gyp_uv.py -f make
make -C out
I get this error:
make: Entering directory `./out'
LINK(target) ./out/Debug/run-benchmarks
flock: g++: No such file or directory
make: *** [./out/Debug/run-benchmarks] Error 69
make: Leaving directory `./out'

Your Error:
flock: g++: No such file or directory
Indicates that you've not installed a c++ compiler. Because this is a debian system, you need to install the appropriate package(s), which are at a minimum build-essential, which should pull in g++:
sudo apt-get install build-essential
The next question is, why aren't you just installing the system provided version of libuv? The one that you should be able to install using apt-get install libuv-dev ?

'make -C' takes a directory as an argument -- it enters that directory and calls make from there. in this case it's looking for a directory called 'out' which doesn't exist. have you tried just calling make?

Related

Libmodbus library not found when trying to compile mbrtu

I tried:
cd ~
git clone git://github.com/stephane/libmodbus
cd libmodbus
./autogen.sh
./configure --enable-static
make
sudo make install
sudo cp ./src/.libs/libmodbus.a /usr/local/lib/
to download, compile and install the libmodbus library. Now I have a libmodbus.a file in /usr/local/lib/.
Now I want to install mbrtu:
cd ~
git clone https://github.com/gitaeuber/mbrtu
cd mbrtu
make
sudo make install
Strangely, after make I get the error:
In file included from mbrtu.c:22:
mbrtu.h:25:12: fatal error: modbus.h: No such file or directory
25 | #include <modbus.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:9: mbrtu] Error 1
I tried adding the library path /usr/local/lib/ to $LD_LIBRARY_PATH, but that did not help at all.
Can someone explain me how I can compile and install the libmodbus library correctly?
It is not a library that is not found by the linker but an include file which is not found by the compiler. Look at the make file install to see how include files are searched. It is likely a variable INC or INCLUDE.

Unable to get the right Linux kernel headers to build a kernel module

I am trying to build a sample Linux kernel module using the following command in my makefile on my Raspberry Pi 3B+ running the latest Raspbian Buster OS updated with sudo apt-get dist-upgrade:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
I get the following output:
make -C /lib/modules/4.19.57-v7+/build/ M=/home/pi/isr_test modules
make[1]: *** /lib/modules/4.19.57-v7+/build/: No such file or directory. Stop.
make: *** [Makefile:4: all] Error 2
I tried installing linux headers using this command:
sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-headers-4.19.57-v7
E: Couldn't find any package by glob 'linux-headers-4.19.57-v7'
E: Couldn't find any package by regex 'linux-headers-4.19.57-v7'
I tried looking for Linux headers using this command, and it looks like they are installed:
dpkg -l | grep kernel-headers
ii raspberrypi-kernel-headers 1.20190718-1 armhf Header files for the Raspberry Pi Linux kernel
I tried looking in the /lib/modules directory:
ls /lib/modules
4.19.58+ 4.19.58-v7+ 4.19.58-v7l+
See how there's no 4.19.57 there?
Also, under /usr/src, all I have is these directories:
ls /usr/src
linux-headers-4.19.58+ linux-headers-4.19.58-v7+ linux-headers-4.19.58-v7l+ sense-hat
Again, nothing for 4.19.57.
For the current OS, here's what I get when I run uname -r:
uname -r
4.19.57-v7+
When I change my makefile to point to the 4.19.58-v7+ instead of 4.19.57-v7+, I get my module to build with no issues.
I'm expecting to see folders with 4.19.57 in their names, but all I get is 4.19.58 (see the folders above). How can I get the Linux header files that match my Linux kernel version? Or does it not matter?
Turns out, all I had to do was to reboot my Raspberry Pi after updating the OS. Now it's at 4.19.58, and all the headers match the OS version and everything compiles just fine.

"fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK

I'm getting the following issue when trying to run make on the HTK library:
(cd HTKLib && make HTKLib.a) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory '/home/william/speech/htk/HTK-3.4.1/htk/HTKLib'
gcc -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG -c -o HGraf.o HGraf.c
In file included from HShell.h:40:0,
from HGraf.c:54:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'HGraf.o' failed
make[1]: *** [HGraf.o] Error 1
make[1]: Leaving directory '/home/william/speech/htk/HTK-3.4.1/htk/HTKLib'
Makefile:96: recipe for target 'HTKLib/HTKLib.a' failed
make: *** [HTKLib/HTKLib.a] Error 1
I'm unsure what to do about this error. The libc-header-start.h file is present on my system:
$ find /usr -name libc-header-start.h
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h
Running gcc -H -fsyntax-only /usr/include/stdio.h appropriately returns
. /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
.. /usr/include/features.h
... /usr/include/x86_64-linux-gnu/sys/cdefs.h
etc.
Also, compiling and running a sanity-check C file works fine (simply executing printf("hello!"); in its main method).
Apologies if this is a well-known error - my experience with C libraries stops at compiling and installing them using make.
UPDATE
Per the accepted answer below I executed sudo apt-get install gcc-multilib to install the missing 32 bit libraries.
Afterwards I got an error with a similar cause: "/usr/bin/ld: cannot find -lX11" error when installing htk. I resolved this by executing sudo apt-get install libx11-dev:i386 libx11-dev to retrieve the missing 32 bit library.
The -m32 is telling gcc to compile for a 32-bit platform. On a 64-bit machine, gcc normally only comes with 64-bit libraries. You have two options:
Install 32-bit headers and libraries. Here's how you'd do this on Ubuntu.
Run this command:
sudo apt-get install gcc-multilib
Compile for 64-bit instead. Modify this line in the file named configure:
CFLAGS="-m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"
Delete -m32, giving you:
CFLAGS="-ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"
Run ./configure, then make clean, then make
However, I would recommend against this approach. The library authors went out of their way to make this build for 32 bits on a 64 bit system, and I can't guarantee that it will work correctly if you do this. (It does compile, though.)
Below is one way to debug and fix this issue. Since most linux installations differ in one way or another, YMMV.
Find which package installed libc-header-start.h.
$ dpkg -S libc-header-start.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
On a working system, /usr/include/bits is a symlink to /usr/include/x86_64-linux-gnu/bits. Running dpkg search gives us:
$ dpkg -S /usr/include/bits
libc6-dev-i386: /usr/include/bits
Installing libc6-dev-i386 creates the symlink and the error is addressed.
However, subsequently I ran into a linker error with the linker not being able to find libgcc (-lgcc). Apparently Linux default linker needs libgcc in most cases. Further debugging the issue with linker verbosity enabled lead me to missing lib32gcc-10-dev package.
In short, unless a very controlled build environment is desired, just install gcc-multilib package when using -m32 (needed for gcc or clang). For C++, g++-multilib is also required.

compile tor on centos6. Problems with libevent

i have clean centos6 system, try to compile tor from sources.
1st way (installing libevent by yum). I do:
yum install libevent2
yum install libevent2-devel
...
(inside tor folder): ./configure
make
and get error:
src/common/libor-event.a(compat_libevent.o): In function `tor_gettimeofday_cache_clear':
/root/tor-0.3.1.7/src/common/compat_libevent.c:250: undefined reference to `event_base_update_cache_time'
collect2: ld returned 1 exit status
make[1]: *** [src/or/tor] Error 1
make[1]: Leaving directory `/root/tor-0.3.1.7'
make: *** [all] Error 2
2nd way (installing libevent from sources).
yum remove libevent2
yum remove libevent2-devel
..
(from libevent folder): ./configure
make
make install
..
(from tor folder): ./configure
and get error:
checking whether we need extra options to link libevent... configure: error: Found linkable libevent in (system), but it does not seem to run, even with -R. Maybe specify another using --with-libevent-dir}
So, what am i doing wrong?) what to do next?
It is possible that you missed to add the libevent library to library options
LDFLAGS+=-L[path of the libevent.so] -levent
What is the output of the make?

Recipe for target 'graphite-clast-to-gimple.o' failed when I compile GCC Cross-Compiler

I would like to create a GCC cross-compiler and I follow the instruction here here But the problem is each time when I make gcc will have same error blow.
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:897:24: error: ‘isl_lp_ok’
was not declared in this scope
assert (lp_result == isl_lp_ok);
^
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:898:34: error:
‘isl_int_get_gmp’ was not declared in this scope
isl_int_get_gmp (isl_value, low); ^
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:900:57: error: ‘isl_set_max’
was not declared in this scope
lp_result = isl_set_max (domain, dimension, &isl_value);
^
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:904:27: error:
‘isl_int_clear’ was not declared in this scope
isl_int_clear (isl_value); ^
Makefile:1058: recipe for target 'graphite-clast-to-gimple.o' failed
make[1]: *** [graphite-clast-to-gimple.o] Error 1
make[1]: Leaving directory '/home/mike/src/build-gcc/gcc'
Makefile:3927: recipe for target 'all-gcc' failed
make: *** [all-gcc] Error 2
At first,I think it may caused by the version problem because the gcc on my openSUSE is 4.8.3,but nothing changed after I use version 4.8.2.
Thanks a lot!
There's a problem with the latest version (0.14?) of the ISL library - the API is not compatible with gcc as of 4.9.2. As for building CLooG, the ISL-0.12.1 version included with 0.18.2 doesn't get configured properly. So you need to build and install your own libraries, and then use those when configuring gcc.
1/. isl-0.12.2
> ./configure --prefix=$CROSSDIR --with-gmp-prefix=$GMPDIR
> make install # and rehash, etc.
where CROSSDIR is where you're installing your cross compiler toolchain, and GMPDIR is the root directory containing lib and include directories for GMP. Unfortunately, this means you will need to build GMP, MPFR, and MPC separately and install, or install them from a package system first. But you might not need this (see below).
2/. cloog-0.18.2
> ./configure --prefix=$CROSSDIR --with-isl-prefix=$CROSSDIR \
--with-gmp-prefix=$GMPDIR
There's a ridiculous issue where the Makefile has 'cmake' strings lying about. The solution (from clfs.org) :
> sed '/cmake/d' Makefile > Makefile.new
> mv Makefile.new Makefile
> make install # and rehash, etc.
When configuring gcc, use: --with-isl=$CROSSDIR --with-cloog=$CROSSDIR, and you will need options for: --with-gmp, --with-mpfr, --with-mpc
Alternatively - following the instructions you're using, it may be sufficient to move isl-0.12.2 & cloog-0.18.2 to the isl and cloog subtrees in the gcc source tree. After the configure, go into the cloog build subdirectory and edit the Makefile as above. I haven't tried this. I build and install the packages separately under CROSSDIR for other reasons.
If you are on Linux, you could probably get the development packages for your system. I know the commands for a Debian-based system such as Ubuntu and its variants.
sudo apt-get install libisl-dev
sudo apt-get install libcloog-isl-dev
After that, delete the isl and cloog directories in your gcc folder, then try to continue from:
make all-gcc
If you don't have a Debian-based system, some hunting around in Google Forest should help.

Resources