Can't compile a program that uses Bullet Physics - c++

Why can't I compile a program that uses Bullet Physics?
configure.ac:
PKG_CHECK_MODULES([bullet],[bullet])
src/Makefile.am:
myapp_CFLAGS = ... ${bullet_CFLAGS}
myapp_LDADD = ... ${bullet_LIBS}
Trying to compile it gives me the following error:
$ LC_ALL=C make
make all-recursive
make[1]: Entering directory '/home/me/Utveckling/myapp'
Making all in src
make[2]: Entering directory '/home/me/Utveckling/myapp/src'
depbase=`echo engine/PhysEngine.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT engine/PhysEngine.o -MD -MP -MF $depbase.Tpo -c -o engine/PhysEngine.o engine/PhysEngine.cpp &&\
mv -f $depbase.Tpo $depbase.Po
In file included from engine/PhysEngine.h:4:0,
from engine/PhysEngine.cpp:1:
/usr/include/bullet/BulletCollision/btBulletCollisionCommon.h:22:64: fatal error: BulletCollision/CollisionDispatch/btCollisionWorld.h: No such file or directory
#include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
^
compilation terminated.
Makefile:479: recipe for target 'engine/PhysEngine.o' failed
make[2]: *** [engine/PhysEngine.o] Error 1
make[2]: Leaving directory '/home/me/Utveckling/myapp/src'
Makefile:364: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/me/Utveckling/myapp'
Makefile:305: recipe for target 'all' failed
make: *** [all] Error 2
I've installed the Ubuntu package libbullet-dev, and the files exist on the file system.

Found the solution myself.
Instead of
myapp_CFLAGS = ... ${bullet_CFLAGS}
I should be using
myapp_CPPFLAGS = ... ${bullet_CFLAGS}

Related

MulVAL: make[1]: *** [Makefile:4: attack_graph] Error 1

I'm trying to compile MulVal, everything is already setup tried all of the solutions, getting this error, don't know if it was from the compiler or the code it self.
this is the error i get when i type make inside /mulval directory
make[1]: Entering directory '/home/sulaiman/Tools/mulval/src/attack_graph'
g++ -g -DLINUX -Wno-deprecated lex.yy.o y.tab.cpp attack_graph.cpp -o attack_graph
graphit.tab.c:150:10: fatal error: graphit.tab.h: No such file or directory
compilation terminated.
make[1]: *** [Makefile:4: attack_graph] Error 1
make[1]: Leaving directory '/home/sulaiman/Tools/mulval/src/attack_graph'
make: *** [Makefile:9: attack_graph] Error 2
and here is The env Path for java, xsb and MulVAL.
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_161
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
export MULVALROOT=/home/sulaiman/Tools/mulval
export PATH=$MULVALROOT/bin:$MULVALROOT/utils:$PATH
export PATH=/home/sulaiman/Tools/XSB/bin:$PATH
and here is the make file inside mulval/src/attack_graph where the error happen
default: install
attack_graph: attack_graph.cpp attack_graph.h Queue.h lex.yy.o y.tab.cpp
g++ -g -DLINUX -Wno-deprecated lex.yy.o y.tab.cpp attack_graph.cpp -o attack_graph
lex.yy.c: graphit.l
lex -olex.yy.c graphit.l
lex.yy.o: lex.yy.c y.tab.cpp.h
gcc -g -c lex.yy.c -o lex.yy.o
y.tab.cpp y.tab.cpp.h: graphit.y attack_graph.h
bison -dv graphit.y
mv graphit.tab.c y.tab.cpp
mv graphit.tab.h y.tab.cpp.h
install: attack_graph
cp attack_graph ../../bin/
clean:
rm -f y.tab.cpp y.tab.cpp.h lex.yy.c *.o attack_graph *.output
and here is the github repo that contain the mulval, for almost a week trying to solve this issue and didn't find a solution that worked for me.
I got the same error as you, here is how I solved it.
graphit.tab.c:150:10: fatal error: graphit.tab.h: No such file or directory compilation terminated.
This refers to the missing 'graphit.tab.h' file in your '/attack_graph' folder.
Under normal circumstances this file is automatically generated, but it is not, so you need to generate it manually by running the following command.
bison -d /mulval/src/attack_graph/graphit.y
Maybe you will also get this error.
collect2: error: ld returned 1 exit status make[1]:
*** [Makefile:4: attack_graph] Error 1
make[1]: Leaving directory '/home/mulval/src/attack_graph'
make: *** [Makefile:9: attack_graph] Error 2
If so, you can refer to this answer to modify the code in 'graphit.l'.
Error in MulVAL: multiple definition of `mylval'; collect2: error: ld returned 1 exit status

Cannot install thrift on Suse linux(configure Ok but make failure)

I'm trying to install thrift on SUSE, but encounter some problems.
Runtime Environment:
SUSE Linux Enterprise Server 12 SP1 (x86_64)
thrift-0.10.0
using the configuration file
# ./configure --with-boost=/usr/local/boost-1.59.0 --with-openssl=/usr/local/src/openssl-1.0.0a
then
# make
but failed
Error details:
……
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I../../lib/c_glib/src/thrift -I/usr/local/boost-1.59.0/include -I/usr/local/src/openssl-1.0.0a/include -I./src -D__STDC_LIMIT_MACROS -Wall -Wextra -pedantic -g -O2 -std=c++11 -MT src/thrift/transport/TSSLSocket.lo -MD -MP -MF src/thrift/transport/.deps/TSSLSocket.Tpo -c src/thrift/transport/TSSLSocket.cpp -fPIC -DPIC -o src/thrift/transport/.libs/TSSLSocket.o
src/thrift/transport/TSSLSocket.cpp: In constructor 'apache::thrift::transport::SSLContext::SSLContext(const apache::thrift::transport::SSLProtocol&)':
src/thrift/transport/TSSLSocket.cpp:166:39: error: 'TLSv1_1_method' was not declared in this scope
ctx_ = SSL_CTX_new(TLSv1_1_method());
^
src/thrift/transport/TSSLSocket.cpp:168:39: error: 'TLSv1_2_method' was not declared in this scope
ctx_ = SSL_CTX_new(TLSv1_2_method());
^
Makefile:1312: recipe for target 'src/thrift/transport/TSSLSocket.lo' failed
make[3]: *** [src/thrift/transport/TSSLSocket.lo] Error 1
make[3]: Leaving directory '/home/aisp/bak/thrift-0.10.0/lib/cpp'
Makefile:1620: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/aisp/bak/thrift-0.10.0/lib/cpp'
Makefile:635: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/aisp/bak/thrift-0.10.0'
Makefile:548: recipe for target 'all' failed
make: *** [all] Error 2
I could not find the answer anywhere.
What should I do?

fatal error: X11/extensions/XIproto.h: No such file or directory #include <X11/extensions/XIproto.h>

A make of qt-everywhere-opensource-src-5.7.0 on OpenSUSE 13.2 after ./configure -qt-xcb fails with the following:
g++ -c -pipe -O2 -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_BUILD_XCB_PLUGIN -DXCB_USE_XLIB -DXCB_USE_RENDER -DDFLT_XKB_CONFIG_ROOT=\"/usr/share/X11/xkb\" -DDEFAULT_XKB_RULES=\"evdev\" -DDEFAULT_XKB_MODEL=\"pc105\" -DDEFAULT_XKB_LAYOUT=\"us\" -DQT_BUILD_XCB_QPA_LIB_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQ_FONTCONFIGDATABASE -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLATFORMSUPPORT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -Igl_integrations -I../../../3rdparty/xcb/include -I../../../3rdparty/xcb/sysinclude -I../../../3rdparty/xkbcommon -I../../../3rdparty/xkbcommon/xkbcommon -I../../../3rdparty/xkbcommon/src -I../../../3rdparty/xkbcommon/src/xkbcomp -I../../../3rdparty/xkbcommon/src/x11 -I../../../../include -I../../../../include/QtPlatformSupport -I../../../../include/QtPlatformSupport/5.7.0 -I../../../../include/QtPlatformSupport/5.7.0/QtPlatformSupport -I../../../../include/QtGui/5.7.0 -I../../../../include/QtGui/5.7.0/QtGui -I../../../../include/QtGui -I../../../../include/QtCore/5.7.0 -I../../../../include/QtCore/5.7.0/QtCore -I../../../../include/QtCore -I.moc -isystem /usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qxcbxsettings.o qxcbxsettings.cpp
qxcbxsettings.cpp:49:36: fatal error: X11/extensions/XIproto.h: No such file or directory
#include <X11/extensions/XIproto.h>
^
compilation terminated.
Makefile.xcb_qpa_lib:7354: recipe for target '.obj/qxcbxsettings.o' failed
make[6]: *** [.obj/qxcbxsettings.o] Error 1
make[6]: Leaving directory '/home/jan/src/qt-everywhere-opensource-src-5.7.0/qtbase/src/plugins/platforms/xcb'
Makefile:86: recipe for target 'sub-xcb_qpa_lib-pro-make_first-ordered' failed
make[5]: *** [sub-xcb_qpa_lib-pro-make_first-ordered] Error 2
make[5]: Leaving directory '/home/jan/src/qt-everywhere-opensource-src-5.7.0/qtbase/src/plugins/platforms/xcb'
Makefile:97: recipe for target 'sub-xcb-make_first' failed
make[4]: *** [sub-xcb-make_first] Error 2
make[4]: Leaving directory '/home/jan/src/qt-everywhere-opensource-src-5.7.0/qtbase/src/plugins/platforms'
Makefile:99: recipe for target 'sub-platforms-make_first' failed
make[3]: *** [sub-platforms-make_first] Error 2
make[3]: Leaving directory '/home/jan/src/qt-everywhere-opensource-src-5.7.0/qtbase/src/plugins'
Makefile:641: recipe for target 'sub-plugins-make_first' failed
make[2]: *** [sub-plugins-make_first] Error 2
make[2]: Leaving directory '/home/jan/src/qt-everywhere-opensource-src-5.7.0/qtbase/src'
Makefile:45: recipe for target 'sub-src-make_first' failed
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory '/home/jan/src/qt-everywhere-opensource-src-5.7.0/qtbase'
Makefile:77: recipe for target 'module-qtbase-make_first' failed
make: *** [module-qtbase-make_first] Error 2
Add inputproto-devel:
sudo zypper install inputproto-devel
and restart the configuration and build.

g++ internal compiler error during OpenFST building

I'm trying to compile OpenFST:
wget http://distfiles.macports.org/openfst/openfst-1.5.2.tar.gz
tar -xf openfst-1.5.2.tar.gz
cd openfst-1.5.2
sudo ./configure --enable-compact-fsts --enable-const-fsts --enable-far --enable-lookahead-fsts --enable-pdt
sudo make install
But after long time the building fails in this way:
Libraries have been installed in: /usr/local/lib
If you ever happen to want to link against installed libraries in a
given directory, LIBDIR, you must either use libtool, and specify the
full pathname of the library, or use the `-LLIBDIR' flag during
linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for more
information, such as the ld(1) and ld.so(8) manual pages.
---------------------------------------------------------------------- make[3]: Nessuna operazione da eseguire per "install-data-am".
make[3]: uscita dalla directory "/home/pi/src/openfst-1.5.2/src/lib"
make[2]: uscita dalla directory "/home/pi/src/openfst-1.5.2/src/lib"
Making install in script make[2]: ingresso nella directory
"/home/pi/src/openfst-1.5.2/src/script" /bin/bash ../../libtool
--tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I./../include -std=c++11 -MT determinize.lo -MD -MP -MF .deps/determinize.Tpo -c -o determinize.lo determinize.cc libtool: compile: g++ -DHAVE_CONFIG_H
-I./../include -std=c++11 -MT determinize.lo -MD -MP -MF .deps/determinize.Tpo -c determinize.cc -fPIC -DPIC -o
.libs/determinize.o g++: internal compiler error: Killed (program
cc1plus) Please submit a full bug report, with preprocessed source if
appropriate. See <file:///usr/share/doc/gcc-4.9/README.Bugs> for
instructions. Makefile:516: set di istruzioni per l'obiettivo
"determinize.lo" non riuscito make[2]: *** [determinize.lo] Errore 1
make[2]: uscita dalla directory
"/home/pi/src/openfst-1.5.2/src/script" Makefile:358: set di
istruzioni per l'obiettivo "install-recursive" non riuscito make[1]:
*** [install-recursive] Errore 1 make[1]: uscita dalla directory "/home/pi/src/openfst-1.5.2/src" Makefile:414: set di istruzioni per
l'obiettivo "install-recursive" non riuscito make: ***
[install-recursive] Errore 1
I don't understand what is the cause of the error and thus how to fix it.
The o.s. is Rapsbian Jessie Lite running on RPi3.

mno-cygwin unrecognized command line option error when building c++ library

i'm new to c++ and implementing a java application that invoking c++ library methods using java native interface. i'm using Cygwin64.
os: windows 8 64 bit
JDK: 1.7 64 bit
gcc 4.8.2
but when i try to build my project i'm getting this error
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/LibraryTest'
cd ../DataProcessor && /usr/bin/make -f Makefile CONF=Debug
make[2]: Entering directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/DataProcessor'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[3]: Entering directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/DataProcessor'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/LocationDataProcessor.dll
make[4]: Entering directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/DataProcessor'
mkdir -p build/Debug/Cygwin_4.x-Windows
rm -f build/Debug/Cygwin_4.x-Windows/CppConnector.o.d
gcc -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -c -g -MMD -MP -MF build/Debug/Cygwin_4.x-Windows/CppConnector.o.d -o build/Debug/Cygwin_4.x-Windows/CppConnector.o CppConnector.c
gcc: error: unrecognized command line option ‘-mno-cygwin’
nbproject/Makefile-Debug.mk:69: recipe for target 'build/Debug/Cygwin_4.x-Windows/CppConnector.o' failed
make[4]: *** [build/Debug/Cygwin_4.x-Windows/CppConnector.o] Error 1
make[4]: Leaving directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/DataProcessor'
nbproject/Makefile-Debug.mk:60: recipe for target '.build-conf' failed
make[3]: *** [.build-conf] Error 2
make[3]: Leaving directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/DataProcessor'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [.build-impl] Error 2
make[2]: Leaving directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/DataProcessor'
nbproject/Makefile-Debug.mk:74: recipe for target '.build-subprojects' failed
make[1]: *** [.build-subprojects] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/User/Documents/NetBeansProjects/LibraryTest'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
i'm stacked with this java c++ integration thing for 4 days. need some help to solve this.
thanks in advance
Cygwin and gcc has remove the support of -mno-cygwin flag. Thus, you have to built the source after removing flag.
Another thing due to removal of flag you must have cygwin1.dll available along with your binaries.
If you doesn't want to attach cygwin1.dll then download Mingw compiler and compile through it.