User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Compile error

Sat Mar 26, 2016 7:31 pm

Hello,
today I tried to compile two different (although related) software for the Pi and got two similar errors.
I was trying https://github.com/richardghirst/PiBits and https://github.com/sarfata/pi-blaster.
I got the errors:

Code: Select all

gcc -Wall -g -O2 -o servod servod.c mailbox.c -lm
In file included from /usr/include/arm-linux-gnueabihf/bits/sigcontext.h:28:0,
             from /usr/include/signal.h:339,
             from servod.c:35:
/usr/include/arm-linux-gnueabihf/asm/sigcontext.h:2:8: error: macro names must be identifiers
/usr/include/arm-linux-gnueabihf/asm/sigcontext.h:4:1: error: unterminated comment
/usr/include/arm-linux-gnueabihf/asm/sigcontext.h:1:0: error: unterminated #ifndef
In file included from /usr/include/signal.h:359:0,
             from servod.c:35:
/usr/include/arm-linux-gnueabihf/sys/ucontext.h:108:16: error: field ‘uc_mcontext’ has incomplete type
Makefile:6: set di istruzioni per l'obiettivo "servod" non riuscito
    make: *** [servod] Errore 1
and

Code: Select all

make
make  all-am
make[1]: ingresso nella directory "/home/pi/GIT/pi-blaster"
gcc -DHAVE_CONFIG_H -I.     -Wall -pedantic -std=c99 -MT pi-blaster.o -MD -MP -MF .deps/pi-blaster.Tpo -c -o pi-blaster.o pi-blaster.c
In file included from /usr/include/arm-linux-gnueabihf/bits/sigcontext.h:28:0,
                 from /usr/include/signal.h:339,
                 from pi-blaster.c:39:
/usr/include/arm-linux-gnueabihf/asm/sigcontext.h:2:8: error: macro names must be identifiers
/usr/include/arm-linux-gnueabihf/asm/sigcontext.h:4:1: error: unterminated comment
/usr/include/arm-linux-gnueabihf/asm/sigcontext.h:1:0: error: unterminated #ifndef
In file included from /usr/include/signal.h:359:0,
                 from pi-blaster.c:39:
/usr/include/arm-linux-gnueabihf/sys/ucontext.h:108:16: error: field ‘uc_mcontext’ has incomplete type
Makefile:377: set di istruzioni per l'obiettivo "pi-blaster.o" non riuscito
make[1]: *** [pi-blaster.o] Errore 1
make[1]: uscita dalla directory "/home/pi/GIT/pi-blaster"
Makefile:235: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
Since I noticed they are similar, I started to think that probably the error is in my Pi configuration or whatever.
I have a B+ model. After I got the error, I updated everything with apt-get and rpi-update, but no changes.

Any hint?

Thanks.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
Paeryn
Posts: 2900
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Compile error

Sun Mar 27, 2016 2:55 am

From those errors it looks like /usr/include/arm-linux-gnueabihf/asm/sigcontext.h is corrupt. What does the file look like? It should be

Code: Select all

#ifndef _ASMARM_SIGCONTEXT_H
#define _ASMARM_SIGCONTEXT_H

/*
 * Signal context structure - contains all info to do with the state
 * before the signal handler was invoked.  Note: only add new entries
 * to the end of the structure.
 */
struct sigcontext {
        unsigned long trap_no;
        unsigned long error_code;
        unsigned long oldmask;
        unsigned long arm_r0;
        unsigned long arm_r1;
        unsigned long arm_r2;
        unsigned long arm_r3;
        unsigned long arm_r4;
        unsigned long arm_r5;
        unsigned long arm_r6;
        unsigned long arm_r7;
        unsigned long arm_r8;
        unsigned long arm_r9;
        unsigned long arm_r10;
        unsigned long arm_fp;
        unsigned long arm_ip;
        unsigned long arm_sp;
        unsigned long arm_lr;
        unsigned long arm_pc;
        unsigned long arm_cpsr;
        unsigned long fault_address;
};


#endif
She who travels light — forgot something.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: Compile error

Sun Mar 27, 2016 7:38 am

Yes it was.
Thanks to Richard Hirst (who wrote ServoBlaster) I found with

Code: Select all

dpkg -S /usr/include/arm-linux-gnueabihf/asm/sigcontext.h 
that I had to reinstall the package linux-libc-dev.
So after

Code: Select all

sudo apt-get install --reinstall linux-libc-dev
all is good again.

Thanks for your answer.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

Return to “Troubleshooting”