spaceconcordia / space-script

command.sh
0 stars 1 forks source link

Problem compiling CPPUtest for microblaze #15

Open SpaceShawn opened 8 years ago

SpaceShawn commented 8 years ago

It should be possible to compile CPPUTest for Microblaze by specifying the architecture during configure

First you need to update config.sub and config.guess as such:

$ cp /usr/share/misc/config.{sub,guess} /path/to/cpputest/

Then run configure

$ ./configure --host ./configure --host=microblazeel-xilinx-linux-gnu

However, when we run make there are issues:

$ make
make  all-am
make[1]: Entering directory `/home/vagrant/CONSAT1/cpputest-3.5'
microblazeel-xilinx-linux-gnu-g++ -DHAVE_CONFIG_H -I.   -include ./include/CppUTest/MemoryLeakDetectorMallocMacros.h -I./include/CppUTestExt/CppUTestGMock -I./include/CppUTestExt/CppUTestGTest -I ./include     -include ./include/CppUTest/MemoryLeakDetectorNewMacros.h  -Werror -Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -pedantic-errors -Wsign-conversion -Woverloaded-virtual -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables  -g -O2 -MT lib_libCppUTest_a-CommandLineArguments.o -MD -MP -MF .deps/lib_libCppUTest_a-CommandLineArguments.Tpo -c -o lib_libCppUTest_a-CommandLineArguments.o `test -f 'src/CppUTest/CommandLineArguments.cpp' || echo './'`src/CppUTest/CommandLineArguments.cpp
In file included from ././include/CppUTest/StandardCLibrary.h:15:0,
                 from ././include/CppUTest/CppUTestConfig.h:158,
                 from ././include/CppUTest/MemoryLeakDetectorMallocMacros.h:12,
                 from <command-line>:0:
/usr/local/lib/mbgcc/bin/../lib/gcc/microblazeel-xilinx-linux-gnu/4.6.2/../../../../microblazeel-xilinx-linux-gnu/include/c++/4.6.2/cstdlib:119:11: error: '::malloc' has not been declared
/usr/local/lib/mbgcc/bin/../lib/gcc/microblazeel-xilinx-linux-gnu/4.6.2/../../../../microblazeel-xilinx-linux-gnu/include/c++/4.6.2/cstdlib:127:11: error: '::realloc' has not been declared
cc1plus: error: unrecognized command line option "-Wno-weak-vtables" [-Werror]
cc1plus: error: unrecognized command line option "-Wno-exit-time-destructors" [-Werror]
cc1plus: error: unrecognized command line option "-Wno-global-constructors" [-Werror]
cc1plus: error: unrecognized command line option "-Wno-disabled-macro-expansion" [-Werror]
cc1plus: all warnings being treated as errors

make[1]: *** [lib_libCppUTest_a-CommandLineArguments.o] Error 1
make[1]: Leaving directory `/home/vagrant/CONSAT1/cpputest-3.5'
make: *** [all] Error 2

Potential cause of this issue is described here: http://nerdland.net/unstumping-the-internet/malloc-has-not-been-declared/

Additional reference information here: https://github.com/davisford/cmake-cpputest#cross-compile-cpputest-for-embedded-target