430 compile errors on ubuntu21.10
mthii opened this issue · 3 comments
Linux version 5.13.0-39-generic (buildd@lcy02-amd64-072) (gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.37) #44-Ubuntu SMP Thu Mar 24 15:35:05 UTC 2022
$ make
:
src/jtag/drivers/aji_client/jtagservice.c:1439:1: error: '-mfunction-return' and '-fcf-protection' are not compatible
src/jtag/drivers/aji_client/jtagservice.c: In function 'jtagservice_sld_node_printf':
src/jtag/drivers/aji_client/jtagservice.c:1665:1: error: '-mindirect-branch' and '-fcf-protection' are not compatible
1665 | {
| ^
src/jtag/drivers/aji_client/jtagservice.c:1665:1: error: '-mfunction-return' and '-fcf-protection' are not compatible
make[2]: *** [Makefile:3855: src/jtag/drivers/aji_client/libocdaji_client_la-jtagservice.lo] Error 1
make[2]: Leaving directory '/home/xxx/src/aji_openocd'
make[1]: *** [Makefile:5417: all-recursive] Error 1
make[1]: Leaving directory '/home/xxx/src/aji_openocd'
make: *** [Makefile:2241: all] Error 2
I think almost all the compile error came from this project codes.
At first, it seems the line 24 of src/jtag/drivers/aji_client/jtagservice.c to be,
#include <string.h> --> #include <strings.h>
for the func bzero and so forth on the linux box. And some gcc option might be different, such as -Werror=....
After string.h -> strings.h mod, I have,
src/jtag/drivers/aji_client/jtagservice.c:1665:1: error: ‘-mindirect-branch’ and ‘-fcf-protection’ are not compatible
1665 | {
| ^
It seems those compile option might be mistake...
p.s. openocd-code from git have no problem to compile and embeded debug on eclipse.
I have to downgrade gcc/g++ to version 8
gcc version 8 ???
I wrote,
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Where did you find version 8 ?
I used Ubuntu 20.04 and install version 8 as
apt install gcc-8 g++-8
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8
# Or you can select default gcc to 8 using this command
update-alternatives --config gcc