compiling keepalived from source not working - c

i have been trying to compile and install keepalived like in the following link http://www.keepalived.org/doc/installing_keepalived.html
i'm building it on ubuntu/trusty64 vagrant machine
i have installed all the requirement specified in the document
sudo apt-get install curl gcc libssl-dev libnl-3-dev libnl-genl-3-dev libsnmp-dev
when i made 'make' command
it showed me the following error
gcc -g -O2 -I/usr/src/linux/include -I/usr/src/linux/include -
DLIBIPVS_USE_NL -Wall -Wunused -c -o libipvs.o libipvs.c
In file included from libipvs.h:13:0,
from libipvs.c:23:
ip_vs.h:15:29: fatal error: netlink/netlink.h: No such file or directory
#include <netlink/netlink.h> <-(the terminal saying that the error)
i tried that answer
libnl-3 includes broken?
i entered
sudo make -I /usr/include/libnl3
or
make -I /usr/include/libnl3
but both failed i'm kind new c compiling and building in linux so i would aperciate any help

Related

Fatal error when building sqlcipher3 from macOS ('sqlcipher/sqlite3.h' file not found)

I have been trying to build sqlcipher3 on MacOS with the following command:
git clone https://github.com/coleifer/sqlcipher3 && cd sqlcipher3
python3 setup.py build
I am getting the following error:
$ python3 setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/sqlcipher3
copying sqlcipher3/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/sqlcipher3
copying sqlcipher3/dbapi2.py -> build/lib.macosx-10.14-x86_64-3.7/sqlcipher3
running build_ext
Builds a C extension linking against libsqlcipher library
building 'sqlcipher3._sqlite3' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/src
xcrun -sdk macosx clang -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Qunused-arguments -DMODULE_NAME="sqlcipher3.dbapi2" -I/usr/include -I/Users/gab/Downloads/testbuild/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c src/module.c -o build/temp.macosx-10.14-x86_64-3.7/src/module.o
In file included from src/module.c:24:
src/connection.h:34:10: fatal error: 'sqlcipher/sqlite3.h' file not found
#include "sqlcipher/sqlite3.h"
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'xcrun' failed with exit status 1
But sqlcypher is correctly installed with brew:
$ brew install sqlcipher
Warning: sqlcipher 4.4.2 is already installed and up-to-date
To reinstall 4.4.2, run `brew reinstall sqlcipher`
And sqlite3.h was added in the process:
$ find /usr/local/Cellar -name sqlite3.h
/usr/local/Cellar/sqlite/3.33.0/include/sqlite3.h
/usr/local/Cellar/sqlite/3.34.0/include/sqlite3.h
/usr/local/Cellar/sqlcipher/4.4.2/include/sqlcipher/sqlite3.h
Is there something I am missing? Should I be adding a path flag when running python3 setup.py build?
I would
C_INCLUDE_PATH=/usr/local/Cellar/sqlcipher/4.4.2/include LIBRARY_PATH=/usr/local/Cellar/sqlcipher/4.4.2/lib python3 setup.py build
give a try.
I'm not too sure about the cause of the problem,
but have you considered manualy downloading it from github and setting it near the code that uses that?
I know it's probably not the solution you were searching for but it might be all it takes...
I think you’re more likely to find an answer to this on the SQLCipher discussion board.

"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.

Disabling -Werror for dkms

I am currently trying to install a kernel module to Ubuntu. I've copied the source file for the module into /usr/src/applespi-0.1.
Then, I did
sudo dkms install -m applespi -v 0.1
and got
Building module:
cleaning build area....
make KERNELRELEASE=4.4.0-31-generic....(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.4.0-31-generic (x86_64)
Consult /var/lib/dkms/applespi/0.1/build/make.log for more information.
make.log: https://pastebin.com/ySsHrgUt
My goal is to disable -Werror for when compiling this source file. However, I can't seem to find the Makefile with the -Werror flag.
Never mind. I've located the Makefile by running dkms with --verbose and commenting the -Werror flag. Thank you anyway, guys.

libc.h: No such file or directory when compiling nanomsg pipeline sample

Trying to get a simple nanomsg file running, starting with the first one here: https://github.com/dysinger/nanomsg-examples
Installed nanomsg to /usr/local/lib/nanomsg-0.2-alpha. Ran sudo ./configure, sudo make check, sudo make install and sudo ldconfig as the instructions said. All tests pass.
When I run it says libc.h is not found:
$ gcc pipeline.c /usr/local/lib/libnanomsg.a -o pipeline
pipeline.c:2:18: fatal error: libc.h: No such file or directory
compilation terminated.
What is libc.h? I haven't done any C programming since college. Is it part of nanomsg or a C library?
$ which gcc
/usr/bin/gcc
Ubuntu 12.04.4 LTS
Libc.h just contains small list of includes. To compile nanomsg sample its enough to (src):
Replacing:
#include <libc.h>
with
#include <unistd.h>
#include <string.h>
#include <pthread.h>
I used this cmd for static compilation:
gcc -pthread bus.c ../nanomsg/.libs/libnanomsg.a -o test -lanl
Note -pthread and -lanl at the end of line.
try the following:
$ sudo updatedb
$ locate libc.h
find the path where libc.h located. eg, if your libc.h is /usr/local/include
gcc -I/usr/local/include pipeline.c /usr/local/lib/libnanomsg.a -o pipeline

Fatal Error Installing libsndfile on OS X Mavericks

I'm currently trying to install libsndfile on my mac running os x 10.9.1. However, when after running the command 'make' it runs for a while and then displays the following message: sndfile-play.c:61:11: fatal error: 'Carbon.h' file not found. I haven't had much luck finding people with a similar issue. From what I found it looks like it may have to do with newer os versions not being supported. Anyone know how to resolve this issue? Thanks in advance!
The following worked for me (I am running OS X 10.9.1):
Download the source code
Untar the bundle
$ ./configure
$ make
A problem should occur with Carbon.h (sndfile-play.c:61:21:
error: Carbon.h: No such file or directory)
Search Carbon.h in your machine using: $ find /Applications/Xcode.app/Contents/Developer/ | grep Carbon.h
Edit **programs/**Makefile
Look for CFLAGS, ensure CFLAGS is configured:
CFLAGS =
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/ -g -O2 -std=gnu99 -Wall -Wextra -Wdeclaration-after-statement -Wpointer-arith -funsigned-char -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite-strings -Wundef -pipe -I/Developer/Headers/FlatCarbon
$ make
$ make check (All test should pass), then:
$ sudo make install
Source: http://comunidad.udistrital.edu.co/ocala/2013/06/09/building-libsndfile-on-mac-os-x/
I suggest you use brew to install it : http://brew.sh/
Once installed simply run brew install libsndfile
Also just removing that #include works fine.
To solve in a general way (i.e. without resorting to hacking the Makefile), do an "export CPPFLAGS='-I/" with the path to your Xcode's header directory containing Carbon.h before running ./configure. Here are the steps, all from a Terminal window:
Look for instances of Carbon.h on your system:
find /Applications/Xcode.app/Contents/Developer/ | grep Carbon.h
Output:
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers/FlatCarbon/Carbon.h
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h
Using the first line (because it appears to be the most generic header directory), copy the path without including Carbon.h at the end:
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/
Finally, paste that contents within the export line (being sure to include the apostrophes at both ends of the path) like this:
export CPPFLAGS='-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/'
Now re-run your ./configure and make lines to compile.
I had success with this method (using Mac OSX 10.9.2):
1) Select the Terminal application.
2) Make sure I'm in the bash shell (method fails in csh or tcsh).
3) In response to bash$ type
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
****** note: this brings brew in from the web. you'll have to give your
sysadmin password*****.
4) In response to bash$ type
"brew install libsndfile"
****** note: this brings sndfile.h and various other libsndfile files in from
the web and installs them in subdirectories of /usr/local . Again, you'll
have to give your sysadmin password*****.

Resources