While doing some testing this evening I ran into all sorts of errors when attempting to compile a new version of btscanner on Backtrack Linux 5 R3. Luckily it is super easy to resolve the error complaining about an unrecognized command named -Wimplicit-function-dec. This error will display when attempting to run “make” against an already configured (./configure) btscanner source. Below we output the error in more detail, explain how to resolve the error by editing the make file, and then display the compilation process moving past the error.
The below testing was done on Backtrack Linux 5 R3 which is based on Ubuntu 10.04 Lucid though the same error would be likely on most Linux distrobutions.
Error Compiling btscanner On Backtrack 5R3:
- root@bt:/usr/local/src/btscanner/btscanner-2.1.orig# make
- make all-am
- make[1]: Entering directory `/usr/local/src/btscanner/btscanner-2.1.orig'
- if gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I/usr/include/libxml2 -g -O2 -I/usr/include/libxml2 -Wall -pthread -Wshadow -Wbad-function-cast -Wformat -Wimplicit-function-dec -Wparentheses -Wsign-compare -Wstrict-prototypes -Wtrigraphs -Wundef -Wuninitialized -W -Wunused -Wformat-security -Wmissing-braces -Wbad-function-cast -Wcast-qual -falign-functions -falign-labels -falign-loops -pedantic -fstrict-aliasing -D_GNU_SOURCE -std=c99 -DCFG_FILE=\"/usr/local/etc/btscanner.xml\" -DCFG_DTD=\"file:///usr/local/etc/btscanner.dtd\" -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.c; \
- then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi
- cc1: error: unrecognized command line option "-Wimplicit-function-dec"
- make[1]: *** [main.o] Error 1
- make[1]: Leaving directory `/usr/local/src/btscanner/btscanner-2.1.orig'
- make: *** [all] Error 2
As you can see above the compile process errors out and complains of -Wimplicit-function-dec not being a recognized valid command. The line we are modifying in the btscanner Makefile is line #105.
Original Backtrack btscanner Makefile Code:
- CFLAGS = -g -O2 -I/usr/include/libxml2 -Wall -pthread -Wshadow -Wbad-function-cast -Wformat -Wimplicit-function-dec -Wparentheses -Wsign-compare -Wstrict-prototypes -Wtrigraphs -Wundef -Wuninitialized -W -Wunused -Wformat-s ecurity -Wmissing-braces -Wbad-function-cast -Wcast-qual -falign-functions -falign-labels -falign-loops -pedantic -fstrict-aliasing -D_GNU_SOURCE -std=c99 -DCFG_FILE=\"${prefix}/etc/btscanner.xml\" -DCFG_DTD=\"file://${prefix} /etc/btscanner.dtd\"
With the original Makefile above and the new Makefile below you can see the difference but we are modifying line 105 of the Makefile by replacing “-Wimplicit-function-dec” with “-Wimplicit-function-declaration”.
Updated Backtrack btscanner Makefile Code:
- CFLAGS = -g -O2 -I/usr/include/libxml2 -Wall -pthread -Wshadow -Wbad-function-cast -Wformat -Wimplicit-function-declaration -Wparentheses -Wsign-compare -Wstrict-prototypes -Wtrigraphs -Wundef -Wuninitialized -W -Wunused -Wformat-s ecurity -Wmissing-braces -Wbad-function-cast -Wcast-qual -falign-functions -falign-labels -falign-loops -pedantic -fstrict-aliasing -D_GNU_SOURCE -std=c99 -DCFG_FILE=\"${prefix}/etc/btscanner.xml\" -DCFG_DTD=\"file://${prefix} /etc/btscanner.dtd\"
Once you have saved the new Makefile attempt to run make again to verify btscanner will compile.
Ability To “make” or compile btscanner After Updating Makefile:
- root@bt:/usr/local/src/btscanner/btscanner-2.1.orig# make
- make all-am
- make[1]: Entering directory `/usr/local/src/btscanner/btscanner-2.1.orig'
- if gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I/usr/include/libxml2 -g -O2 -I/usr/include/libxml2 -Wall -pthread -Wshadow -Wbad-function-cast -Wformat -Wimplicit-function-declaration -Wparentheses -Wsign-compare -Wstrict-prototypes -Wtrigraphs -Wundef -Wuninitialized -W -Wunused -Wformat-security -Wmissing-braces -Wbad-function-cast -Wcast-qual -falign-functions -falign-labels -falign-loops -pedantic -fstrict-aliasing -D_GNU_SOURCE -std=c99 -DCFG_FILE=\"/usr/local/etc/btscanner.xml\" -DCFG_DTD=\"file:///usr/local/etc/btscanner.dtd\" -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.c; \
- then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi
- In file included from main.c:66:
- /usr/include/bluetooth/bluetooth.h: In function ‘bt_get_le64’:
- /usr/include/bluetooth/bluetooth.h:131: error: expected specifier-qualifier-list before ‘typeof’
- /usr/include/bluetooth/bluetooth.h:131: error: called object ‘typeof(__p)’ is not a function
- /usr/include/bluetooth/bluetooth.h:131: error: ‘struct <anonymous>’ has no member named ‘__v’
There is more output during the compile but wanted to provide a quick example so others will understand the fix from start to finish.