I have written a program that I need to compile for raspberry-pi3
and it must be use bitbake
for compilation.
All was ok when I wrote C
code; and i didn't use a dynamic library.
If relevant, I need to use cppunit
. I already added it in my rpi-basic-image
and added:
DEPENDS = "cppunit".
my make file
CXX = arm-linux-gnueabi-g++
INCLUDES= -I./
CXXFLAGS = -g $(INCLUDES)
SRCM= CBasicMath.cpp
OBJM = $(SRCM:.cpp=.o)
LINKFLAGS= -lcppunit
testbasicmath: TestBasicMath.cpp $(OBJM)
$(CXX) $(CXXFLAGS) -o $@ TestBasicMath.cpp $(OBJM) $(LINKFLAGS) $(LINKFLAGSLOG4) $(LIBLOG)
# Default compile
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
install:
$(INSTALL) -m 755 testbasicmath ${sbindir}/testbasicmath;
clean:
rm -f *.o *.xml testbasicmath
cppunit can't be found c++11 libs
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib/libcppunit.so: undefined reference to `std::invalid_argument::invalid_argument(std::__cxx11::basic_string, std::allocator > const&)@GLIBCXX_3.4.21'
$ arm-linux-gnueabi-g++ -v
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1)
Yocto already export some variables like CXXFLAGS, so you shouldn't override it in your Makefile.