Discussion:
[ethersex-devel] doesn't compile
Peer Janssen
2016-09-25 08:37:01 UTC
Permalink
ethersex$ git pull
Already up-to-date.


ethersex$ make
avr-gcc -Wall -W -Wno-unused-parameter -Wno-sign-compare
-Wno-char-subscripts -g -Os -std=gnu99 -fdata-sections
-ffunction-sections -funsigned-char -funsigned-bitfields -fpack-struct
-fshort-enums -mcall-prologues -fshort-enums -fno-strict-aliasing
-Iprotocols/usb/usbdrv -Iprotocols/usb -DAVR_BUILD -DF_CPU=16000000UL
-mmcu=atmega32 -I. -c -o ethersex.o ethersex.c
In file included from ethersex.c:22:0:
config.h:80:24: fatal error: avr/wdt.h: Datei oder Verzeichnis nicht
gefunden
# include <avr/wdt.h>
^
compilation terminated.
make: *** [ethersex.o] Fehler 1


ethersex$ find . -name "wdt.h"
./core/host/avr/wdt.h


ethersex$ find . -name ethersex.c
./ethersex.c


#less ethersex.c
/* [... snip ...]
* http://www.gnu.org/copyleft/gpl.html
*/

#include "config.h"

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <util/delay.h>
#include <stdlib.h>
[... snip ...]


Just here?

ethersex$ grep -R wdt.h *
config.h:# include <avr/wdt.h>
ethersex.c:#include <avr/wdt.h>
hardware/camera/dc3840.c:#include <avr/wdt.h>
hardware/clock/dcf77/dcf77.c:#include <avr/wdt.h>
hardware/lcd/s1d13305/s1d13305.c:#include <avr/wdt.h>
hardware/lcd/s1d15g10/s1d15g10.c:#include <avr/wdt.h>
meta.c:#include <avr/wdt.h>
protocols/radio/ask/ask.c:#include <avr/wdt.h>
protocols/dmx/dmx.c:#include <avr/wdt.h>
protocols/usb/usb_net.c:#include <avr/wdt.h>
protocols/usb/usb_hid_mouse.c:#include <avr/wdt.h>
protocols/usb/usb_hid_keyboard.c:#include <avr/wdt.h>
protocols/usb/ecmd_usb.c:#include <avr/wdt.h>
protocols/usb/usb.c:#include <avr/wdt.h>
scripts/meta_magic.m4:#include <avr/wdt.h>
scripts/meta_magic_scheduler.m4:#include <avr/wdt.h>
services/glcdmenu/glcdmenu.c:#include <avr/wdt.h>


=> Something is seriously messed up!

- Why was wdt.h put inteo ./core/host/avr/wdt.h without adapting the
includes?
- Why was this not picked up by the simplest of test, as in "make"?

Greetz!
--
Peer Janssen - ***@pjk.de
Christian Dietrich
2016-09-26 07:57:18 UTC
Permalink
Post by Peer Janssen
ethersex$ git pull
Already up-to-date.
ethersex$ make
avr-gcc -Wall -W -Wno-unused-parameter -Wno-sign-compare
-Wno-char-subscripts -g -Os -std=gnu99 -fdata-sections
-ffunction-sections -funsigned-char -funsigned-bitfields -fpack-struct
-fshort-enums -mcall-prologues -fshort-enums -fno-strict-aliasing
-Iprotocols/usb/usbdrv -Iprotocols/usb -DAVR_BUILD -DF_CPU=16000000UL
-mmcu=atmega32 -I. -c -o ethersex.o ethersex.c
config.h:80:24: fatal error: avr/wdt.h: Datei oder Verzeichnis nicht
gefunden
# include <avr/wdt.h>
This looks like the Header from the AVR Libc is the header that is
referenced here. ( <..> for system wide include paths).

Have you installed the avr-libc? What does

find /usr/lib | grep "avr/wdt.h"

say? I get the output:

/usr/lib/avr/include/avr/wdt.h
Post by Peer Janssen
- Why was wdt.h put inteo ./core/host/avr/wdt.h without adapting the
includes?
That header should be the mockup for the beforementioned header from the
avr-libc, iff ethersex is compiled as a host program to be run as a
Linux process.

chris
--
No documentation is better than bad documentation
Peer Janssen
2016-09-26 08:25:44 UTC
Permalink
Post by Christian Dietrich
Post by Peer Janssen
ethersex$ git pull
Already up-to-date.
ethersex$ make
avr-gcc -Wall -W -Wno-unused-parameter -Wno-sign-compare
-Wno-char-subscripts -g -Os -std=gnu99 -fdata-sections
-ffunction-sections -funsigned-char -funsigned-bitfields -fpack-struct
-fshort-enums -mcall-prologues -fshort-enums -fno-strict-aliasing
-Iprotocols/usb/usbdrv -Iprotocols/usb -DAVR_BUILD -DF_CPU=16000000UL
-mmcu=atmega32 -I. -c -o ethersex.o ethersex.c
config.h:80:24: fatal error: avr/wdt.h: Datei oder Verzeichnis nicht
gefunden
# include <avr/wdt.h>
This looks like the Header from the AVR Libc is the header that is
referenced here. ( <..> for system wide include paths).
Have you installed the avr-libc? What does
find /usr/lib | grep "avr/wdt.h"
/usr/lib/avr/include/avr/wdt.h
Post by Peer Janssen
- Why was wdt.h put inteo ./core/host/avr/wdt.h without adapting the
includes?
That header should be the mockup for the beforementioned header from the
avr-libc, iff ethersex is compiled as a host program to be run as a
Linux process.
Thank you for your explanations, especially the meaning of <..>!
Somehow I missed that one years ago when reading up about C.
(I'm not doing lot's of it, but sometimes dive in for certain projects.)

The lib indeed was missing:

ethersex$ find /usr/lib | grep "avr/wdt.h"
ethersex$ sudo apt-get install avr-libc
ethersex$ make
[no errors]
and now it compiles perfectly. Great!

Maybe a test for the presence of avr-libc and an explicit error message
might make the make more rebust?

I realize it again and again: you can read a lot about things you want
to learn and do, but from time to time you need a human being to get
over certain stumbling blocks which would take a disproportionate amount
of time and effort to get over without.

Peer
--
Peer Janssen - ***@pjk.de
Loading...