Cannot build avahi4j: avahi4j_Client.c:18:32: fatal error: avahi-common/error.h: No such file or directory - c++

Per the title of the post I'm trying to build avahi4j, but very quickly run into a wall after downloading: https://code.google.com/p/avahi4j/downloads/detail?name=avahi4j-0.1.tar.gz&can=2&q=
After extracting, and then executing ant clean all from within the avahi4j-0.1 directory, I receive the following error:
ant clean all
Buildfile: /home/myUser/Downloads/avahi4j-0.1/build.xml
clean:
[exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] rm -f avahi4j_Client.o avahi4j_EntryGroup.o avahi4j_Avahi4JConstants.o thread-watch.o avahi4j_ServiceBrowser.o avahi4j_ServiceResolver.o avahi4j_RecordBrowser.o libavahi4j.so ./*~
[exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
[delete] Deleting directory /home/myUser/Downloads/avahi4j-0.1/classes
init:
[mkdir] Created dir: /home/myUser/Downloads/avahi4j-0.1/classes
jnilib:
[exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] gcc -I. -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux/ -I/usr/include/avahi-common -O3 -fPIC -DVER_MAJ="0" -DVER_MIN="1" -c -o avahi4j_Client.o avahi4j_Client.c
[exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] avahi4j_Client.c:18:32: fatal error: avahi-common/error.h: No such file or directory
[exec] #include <avahi-common/error.h>
[exec] ^
[exec] compilation terminated.
[exec] make: *** [avahi4j_Client.o] Error 1
BUILD FAILED
/home/myUser/Downloads/avahi4j-0.1/build.xml:75: exec returned: 2
Total time: 0 seconds
Does anyone know what might be the problem?
EDIT: for completeness, I run the following commands, which produces the error:
wget https://avahi4j.googlecode.com/files/avahi4j-0.1.tar.gz
tar xzvf avahi4j-0.1.tar.gz
cd avahi4j-0.1/
ant
ant clean all
Moreover, running find . -name error.h produces no results.

The libavahi-devel package installs the missing components.
To resolve the issues presented by the question install the libavahi-devel package.

Related

CMake fatal error: CMakeFiles/<path>.dir/main.cpp.d: No such file or directory

I am trying to compile a simple C++ program with CMake on Ubuntu 18.04, but all of my CMake projects fails when I run the make command.
Below is a minimum working example.
The directory structure looks like this:
- project directory
|-build
|-main.cpp
|-CMakeLists.txt
main.cpp
int main(void)
{
return 0;
}
CMakeLists.txt
cmake_minimum_required (VERSION 3.1)
project(Test-Project)
add_executable(a
main.cpp
)
target_compile_options(a
PUBLIC -Wall -o -std=c++11
)
Building
cd build
cmake ../ # this works without any error
make # this fails
Error
[ 50%] Building CXX object CMakeFiles/a.dir/main.cpp.o
cc1plus: fatal error: CMakeFiles/a.dir/main.cpp.d: No such file or directory
compilation terminated.
CMakeFiles/a.dir/build.make:75: recipe for target 'CMakeFiles/a.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/a.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/a.dir/all' failed
make[1]: *** [CMakeFiles/a.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
I get this error when try to compile any CMake based program on the system.
However, if I just used g++ directly to compile the program, it compiles without any complaints.
For example:
g++ ../main.cpp
compiles the program, and runs the program without any errors.
cmake --version: cmake version 3.22.1
g++ --version: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
g++ -print-prog-name=cc1plus: /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus
uname -a: Linux <computer name> 5.4.0-91-generic #102~18.04.1-Ubuntu SMP <date+time> x86_64 x86_64 x86_64 GNU/Linux
EDIT
Terminal output when compiled with make VERBOSE=1:
/home/kani/.local/lib/python2.7/site-packages/cmake/data/bin/cmake -S/home/kani/Documents/test -B/home/kani/Documents/test/build --check-build-system CMakeFiles/Makefile.cmake 0
/home/kani/.local/lib/python2.7/site-packages/cmake/data/bin/cmake -E cmake_progress_start /home/kani/Documents/test/build/CMakeFiles /home/kani/Documents/test/build//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/kani/Documents/test/build'
make -f CMakeFiles/a.dir/build.make CMakeFiles/a.dir/depend
make[2]: Entering directory '/home/kani/Documents/test/build'
cd /home/kani/Documents/test/build && /home/kani/.local/lib/python2.7/site-packages/cmake/data/bin/cmake -E cmake_depends "Unix Makefiles" /home/kani/Documents/test /home/kani/Documents/test /home/kani/Documents/test/build /home/kani/Documents/test/build /home/kani/Documents/test/build/CMakeFiles/a.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/kani/Documents/test/build'
make -f CMakeFiles/a.dir/build.make CMakeFiles/a.dir/build
make[2]: Entering directory '/home/kani/Documents/test/build'
[ 50%] Building CXX object CMakeFiles/a.dir/main.cpp.o
/usr/bin/c++ -Wall -o -std=c++11 -MD -MT CMakeFiles/a.dir/main.cpp.o -MF CMakeFiles/a.dir/main.cpp.o.d -o CMakeFiles/a.dir/main.cpp.o -c /home/kani/Documents/test/main.cpp
cc1plus: fatal error: CMakeFiles/a.dir/main.cpp.d: No such file or directory
compilation terminated.
CMakeFiles/a.dir/build.make:75: recipe for target 'CMakeFiles/a.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/a.dir/main.cpp.o] Error 1
make[2]: Leaving directory '/home/kani/Documents/test/build'
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/a.dir/all' failed
make[1]: *** [CMakeFiles/a.dir/all] Error 2
make[1]: Leaving directory '/home/kani/Documents/test/build'
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
Despite the error message about absent .d file seems to be internal to CMake (such files are used for collect header dependencies generated by the compiler), its usual reason is specifying some output-controlling compiler options in the CMakeLists.txt.
In your case it is -o option which damages the command line generated by CMake. CMake by itself uses this option for specify object file which will be created as a result of the compilation. So adding another -o is wrong.

Armadillo code cant compile in msys2 and netbeans

I'm tring to compile a simple armadillo program by netbeans and msys2:
#include <cstdlib>
#include <armadillo>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
arma::Mat<double> A = arma::randu(4,4);
return 0;
}
I'm using netbeans 8.2, msys2 installed and configured with openblas and armadillo installed by pacman.
but I get this error:
cd 'D:\Users\Amir\Documents\NetBeansProjects\physics\CppApplication_2'
C:\msys64\usr\bin\make.exe -f Makefile CONF=Release
"/C/msys64/usr/bin/make.exe" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
"/C/msys64/usr/bin/make.exe" -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/cppapplication_2.exe
make[2]: Entering directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
mkdir -p build/Release/MinGW-Windows
rm -f "build/Release/MinGW-Windows/main.o.d"
g++ -c -O2 -std=c++11 -MMD -MP -MF "build/Release/MinGW-Windows/main.o.d" -o build/Release/MinGW-Windows/main.o main.cpp
In file included from C:/msys64/mingw64/include/armadillo:54,
from main.cpp:15:
C:/msys64/mingw64/include/armadillo_bits/compiler_setup.hpp:66:30: fatal error: C:/building/msys64/mingw64/include/hdf5.h: No such file or directory
#define ARMA_INCFILE_WRAP(x) <x>
^
compilation terminated.
make[2]: *** [nbproject/Makefile-Release.mk:68: build/Release/MinGW-Windows/main.o] Error 1
make[2]: Leaving directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
make[1]: *** [nbproject/Makefile-Release.mk:59: .build-conf] Error 2
make[1]: Leaving directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 575ms)
I also installed hdf5 in msys2.
How can I get rid of this error?
thx.
it seems someone put this #define ARMA_HDF5_INCLUDE_DIR C:/building/msys64/mingw64/include/ into config.hpp in folder armadillo_bits. changing this to your usual include directory or setting it as nothing should fix the problem.

Install GCC: fatal error: gnu/stubs-32.h: No such file or directory

I'm using a server with Centos 6.6. I don't have root access and I want to install the gcc-4.8.1 to my own directory. I found a solution and I run the following commands:
wget http://www.netgull.com/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz
tar zxvf gcc-4.8.1.tar.gz
cd gcc-4.8.1
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.1/configure --prefix=$HOME/gcc-4.8.1 --enable-languages=c,c++,fortran,go
make
I got errors when running the make command. It reports the following information:
configure: error: `CC' has changed since the previous run:
configure: former value: `/home/mypath/software/try_gcc2/objdir/./gcc/xgcc -B/home/mypath/software/try_gcc2/objdir/./gcc/ -B/home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/bin/ -B/home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/lib/ -isystem /home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/include -isystem /home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/sys-include '
configure: current value: `/home/mypath/software/try_gcc2/objdir/./gcc/xgcc -B/home/mypath/software/try_gcc2/objdir/./gcc/ -B/home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/bin/ -B/home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/lib/ -isystem /home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/include -isystem /home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/sys-include '
configure: error: in `/home/mypath/software/try_gcc2/objdir/x86_64-unknown-linux-gnu/libgcc':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/mypath/software/try_gcc2/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/mypath/software/try_gcc2/objdir'
make: *** [all] Error 2
I cannot figure what's wrong with my command. Thank you all for helping me!!!
I think I have found the solution. When I'm trying to build gcc-5.2.0, it reports that my server does not have 32-bit libraries. It also informs that if I still want to install anyway, I can add --disable-multilib when building. I tried and now the build is running normally.

CMake + freeglut3: cannot find usbhid.h

System: I am using Linux Mint 17.3 as VB-Guest on a Max OS 10.11.3 system.
Problem: Id like to compile freeglut3.0.0
Issue: cmake gives me an fatal error: usbhid.h: No such file or directory
Hello,
The problem is, that even after installing all dependencies I cannot find this file on my system. After researching I found out that it has something to do with some usb-drivers. Could it be that it has something to do with The VB-System with no "actual" usb-hardware?
or is there a package that I am missing.
I installed libgl1-mesa-dev, libx11-dev, libxrandr-dev and libxi-dev
Here I attached the CMakeError.log
Determining if files usbhid.h exist failed with the following output:
Change Dir: /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec2451224769/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2451224769.dir/build.make CMakeFiles/cmTryCompileExec2451224769.dir/build
make[1]: Entering directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2451224769.dir/CheckIncludeFiles.c.o
/usr/bin/cc -Wall -pedantic -o CMakeFiles/cmTryCompileExec2451224769.dir/CheckIncludeFiles.c.o -c /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:20: fatal error: usbhid.h: No such file or directory
#include <usbhid.h>
^
compilation terminated.
make[1]: Leaving directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec2451224769.dir/CheckIncludeFiles.c.o] Error 1
make: *** [cmTryCompileExec2451224769/fast] Error 2
Source:
/* */
#include <usbhid.h>
int main(){return 0;}
Determining if the function XParseGeometry exists failed with the following output:
Change Dir: /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec2875944840/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2875944840.dir/build.make CMakeFiles/cmTryCompileExec2875944840.dir/build
make[1]: Entering directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o
/usr/bin/cc -Wall -pedantic -DCHECK_FUNCTION_EXISTS=XParseGeometry -o CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o -c /usr/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec2875944840
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2875944840.dir/link.txt --verbose=1
/usr/bin/cc -Wall -pedantic -DCHECK_FUNCTION_EXISTS=XParseGeometry CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o -o cmTryCompileExec2875944840 -rdynamic -lm
CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o: In function `main':
CheckFunctionExists.c:(.text+0x15): undefined reference to `XParseGeometry'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
make[1]: *** [cmTryCompileExec2875944840] Error 1
make: *** [cmTryCompileExec2875944840/fast] Error 2
I don't know how to find a solution for myself so i ask it here.
Thanks in advance
usbhid.h : Please install ``libusbhid-dev´´ : $ sudo apt-get install libusbhid-dev

Building avahi for use in the Oracle jvm (error: jni.h not found)

This is a follow up to the following question: Compile errors when defining a macro to convert a case class instance into a map and back
The answer there resolved my initial problem -- I was not installing the dependencies. However, now I have a problem because ant clean all is still not able to find jni.h. This is possibly because the instructions say to install open jdk 6. Is there a workaround for Oracle jdk 7. Here is the error that I'm getting:
myUser#ubuntu:~/Downloads/avahi4j-0.1$ ant clean all
Buildfile: /home/myUser/Downloads/avahi4j-0.1/build.xml
clean:
[exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] rm -f avahi4j_Client.o avahi4j_EntryGroup.o avahi4j_Avahi4JConstants.o thread-watch.o avahi4j_ServiceBrowser.o avahi4j_ServiceResolver.o avahi4j_RecordBrowser.o libavahi4j.so ./*~
[exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
[delete] Deleting directory /home/myUser/Downloads/avahi4j-0.1/classes
init:
[mkdir] Created dir: /home/myUser/Downloads/avahi4j-0.1/classes
jnilib:
[exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] gcc -I. -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux/ -I/usr/include/avahi-common -O3 -fPIC -DVER_MAJ="0" -DVER_MIN="1" -c -o avahi4j_Client.o avahi4j_Client.c
[exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] avahi4j_Client.c:23:17: fatal error: jni.h: No such file or directory
[exec] #include <jni.h>
[exec] ^
[exec] compilation terminated.
[exec] make: *** [avahi4j_Client.o] Error 1
BUILD FAILED
/home/myUser/Downloads/avahi4j-0.1/build.xml:75: exec returned: 2
Total time: 0 seconds
I found the problem. In my case, I needed to make the following change to src/Makefile:
# It must be a JDK, not a JRE !!!
#JDK_HOME := /usr/lib/jvm/java-6-sun
JDK_HOME := /usr/lib/jvm/java-7-oracle
#JDK_HOME := /usr/lib/j2sdk1.6-sun