Compile error: fatal error: stdint.h

6,885 views
Skip to first unread message

Asnsam Ustwor

unread,
Jan 3, 2014, 6:25:00 PM1/3/14
to sim...@googlegroups.com
Hi,

I have a problem with compile simavr on Fedora 18 Linux systems.

I have install all recomended library elfutils-libelf-devel gcc make avr-binutils avr-gcc avr-gdb avr-libc using the curren simavr repository:

> git log --name-status HEAD^..HEAD
commit 270166e66646ce916f091abb980e59303a042dc5
Author: Michel Pollet <buse...@gmail.com>
Date:   Wed Nov 27 21:16:36 2013 +0000

But when I used make all got:

> make all
make -C simavr RELEASE=0
make[1]: Entering directory `/opt/install/simavr/simavr'
In file included from sim/sim_avr.h:29:0,
                 from cores/sim_megax.c:22:
sim/sim_irq.h:25:20: fatal error: stdint.h: Directory or file not exist
 #include <stdint.h>
                    ^
compilation terminated.
make[1]: *** [obj-x86_64-redhat-linux/sim_megax.o] Error 1
make[1]: Leaving directory `/opt/install/simavr/simavr'
make: *** [build-simavr] Error 2

Can someone help me?

Thaks,
Asnsam

M P

unread,
Jan 3, 2014, 6:38:27 PM1/3/14
to simavr
You need the basic headers to build stuff on your host; stdint is a pretty basic header that comes with the libc, I don't know how it's called on fedora tho

M



--
You received this message because you are subscribed to the Google Groups "simavr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simavr+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Asnsam Ustwor

unread,
Jan 4, 2014, 7:10:10 PM1/4/14
to sim...@googlegroups.com
Dne sobota, 4. ledna 2014 0:38:27 UTC+1 buserror wrote:
You need the basic headers to build stuff on your host; stdint is a pretty basic header that comes with the libc, I don't know how it's called on fedora tho

The packages contains stdint.h is more:

avr-gcc-4.8.2-1.fc19.x86_64 : Cross Compiling GNU GCC targeted at avr
File      : /usr/lib/gcc/avr/4.8.2/include/stdint.h

avr-libc-1.8.0-5.fc19.noarch : C library for use with GCC on Atmel AVR microcontrollers
File      : /usr/avr/include/stdint.h

gcc-4.8.2-7.fc19.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
File      : /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stdint.h

gcc-avr32-linux-gnu-4.8.1-5.2.fc19.x86_64 : Cross-build binary utilities for avr32-linux-gnu
File      : /usr/lib/gcc/avr-linux/4.8.1/include/stdint.h

glibc-headers-2.17-20.fc19.x86_64 : Header files for development using standard C libraries.
File      : /usr/include/stdint.h

plus next package as zlib, ...

I have installed all package, but the compile error is still present. Which stdint.h simavr using?

Thanks,
Asnsam

mghughes

unread,
Jan 5, 2014, 1:46:08 AM1/5/14
to sim...@googlegroups.com
Ah HA! Think I may have found something...

> > In file included from sim/sim_avr.h:29:0,
> > from cores/sim_megax.c:22:
> > sim/sim_irq.h:25:20: fatal error: stdint.h: Directory or file not
> > exist #include <stdint.h>
> > ^
> > compilation terminated.

Looks like cores/sim_megax.c is being compiled... core files are being
compiled with -nostdinc...

cores/sim_megax.c --> includes sim/sim_avr.h
sim/sim_avr.h --> includes sim/sim_irq.h
>>> sim/sim_irq.h --> #include <stdint.h>

don't know why others are not having issues with that being there.


Michael.

Hobride Marcel

unread,
Jan 5, 2014, 2:08:52 AM1/5/14
to sim...@googlegroups.com
I have the same problem with Fedora 19 + Fedora 20.
I think i installed all needed packages and i have more than one stdint.h

locate stdint.h

/home/icke/arduino-1.0.5/hardware/tools/avr/lib/avr/include/stdint.h
/usr/avr/include/stdint.h
/usr/include/stdint.h
/usr/include/c++/4.8.2/tr1/stdint.h
/usr/lib/gcc/avr/4.8.2/include/stdint.h
/usr/lib/gcc/avr/4.8.2/plugin/include/config/avr/avr-stdint.h
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stdint.h

how to solve this problem?

M P

unread,
Jan 5, 2014, 6:00:44 AM1/5/14
to simavr

You need some sort of 'avr-libc' installed with avr-gcc

M

--

Asnsam Ustwor

unread,
Jan 5, 2014, 6:49:46 AM1/5/14
to sim...@googlegroups.com
Dne neděle, 5. ledna 2014 12:00:44 UTC+1 buserror wrote:

You need some sort of 'avr-libc' installed with avr-gcc

I have it:

> yum list installed | grep avr-libc
avr-libc.noarch                  1.8.0-5.fc19       @updates                    

> yum list installed | grep avr-gcc
avr-gcc.x86_64                   4.8.2-1.fc19       @updates                    
avr-gcc-c++.x86_64               4.8.2-1.fc19       @updates 

Nothing change.

A

Thomas Axelsson

unread,
Jan 6, 2014, 5:15:16 AM1/6/14
to sim...@googlegroups.com
I just fetched the newest code from git and tried to build for Gentoo, and I got the same problem (also some errors before that, see full output [1]). I think this has been discussed before. The problem is that the avr libs are not where Makefile.common expects them.

Please try this commit that checks for Gentoo and Fedora. I have tested it on Gentoo and if it works with Fedora I will make a pull request:
https://gitorious.org/simavr/thomasa88-simavr/commit/5e2d2e4121848757818be30d1942ec535803e37c

I think the quickest way to test the patch is to do as follows:
wget https://gitorious.org/simavr/thomasa88-simavr/commit/5e2d2e4121848757818be30d1942ec535803e37c.patch
git apply 5e2d2e4121848757818be30d1942ec535803e37c.patch
make clean
make all

(Also, I found the OS checking structure a bit hard to decipher, so I reorganized it in the following commit. I have only tested it on my Gentoo Linux machine.
https://gitorious.org/simavr/thomasa88-simavr/commit/35336e29dfdc242e64f69f8789e6ce89b555eee7 )

//Thomas


[1] Full failed make output
$ make all
make -C simavr RELEASE=0
make[1]: Entering directory '/home/mrt/src/simavr/simavr'
CONF obj-x86_64-pc-linux-gnu/cores.deps
WARNING cores/sim_90usb162.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega1280.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega1281.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega128.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega164.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega168.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega16.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega16m1.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega324.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega328.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega32.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega48.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega644.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega88.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_mega8.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny13.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny2313.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny24.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny25.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny44.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny45.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny84.c did not compile, check your avr-gcc toolchain
WARNING cores/sim_tiny85.c did not compile, check your avr-gcc toolchain
CONF sim_core_decl.h
CC sim/sim_interrupts.c
CC sim/sim_io.c
CC sim/sim_cycle_timers.c
CC sim/sim_core.c
CC sim/sim_elf.c
CC sim/sim_irq.c
CC sim/sim_vcd_file.c
CC sim/sim_gdb.c
CC sim/sim_avr.c
CC sim/sim_hex.c
CC sim/avr_adc.c
CC sim/avr_flash.c
CC sim/avr_lin.c
CC sim/avr_twi.c
CC sim/avr_uart.c
CC sim/avr_spi.c
CC sim/avr_usb.c
CC sim/avr_ioport.c
CC sim/avr_extint.c
CC sim/avr_eeprom.c
CC sim/avr_timer.c
CC sim/avr_bitbang.c
CC sim/avr_watchdog.c

In file included from sim/sim_avr.h:29:0,
                 from cores/sim_megax4.c:22:
sim/sim_irq.h:25:20: fatal error: stdint.h: No such file or directory

 #include <stdint.h>
                    ^
compilation terminated.
../Makefile.common:145: recipe for target 'obj-x86_64-pc-linux-gnu/sim_megax4.o' failed
make[1]: *** [obj-x86_64-pc-linux-gnu/sim_megax4.o] Error 1
make[1]: Leaving directory '/home/mrt/src/simavr/simavr'
Makefile:15: recipe for target 'build-simavr' failed

make: *** [build-simavr] Error 2



Hobride Marcel

unread,
Jan 6, 2014, 3:28:21 PM1/6/14
to sim...@googlegroups.com
I changed in Makefile.common the AVR_ROOT to /usr/avr 
that works for me

M P

unread,
Jan 6, 2014, 3:29:18 PM1/6/14
to simavr
If someone is happy making me a pull request, I'll merge it in; thanks everyone for tracking this one down!

M



--

Thomas Axelsson

unread,
Jan 7, 2014, 12:52:49 PM1/7/14
to sim...@googlegroups.com
Can anyone running Fedora test my Makefile patch to see that the logic is correct for Fedora?

https://gitorious.org/simavr/thomasa88-simavr/commit/5e2d2e4121848757818be30d1942ec535803e37c.patch

I tried to research the prefix a little bit, based on where the include directory is located:
* Debian (and also Ubuntu?) uses /usr/lib/avr due to FHS standards [1].
* Arch uses /usr/avr (if there is not some kind of prefixing from the package manager - the paths did not start with / in the listing) [2]
* OpenSuse uses /opt/cross/avr/avr [3]
* The avr-libc configure script sets the prefix to /usr/local.
And as we already know:
* Gentoo uses /usr/avr
* Fedora uses /usr/avr

So there does not seem to be a common default path.

//Thomas

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486844
[2] https://www.archlinux.org/packages/community/any/avr-libc/
[3] http://download.opensuse.org/repositories/CrossToolchain:/avr/openSUSE_13.1/noarch/avr-libc-1.8.0-7.7.noarch.rpm

Hobride Marcel

unread,
Jan 8, 2014, 10:37:18 AM1/8/14
to sim...@googlegroups.com
this patch works to me, on Fedora 20 :-)

Thomas Axelsson

unread,
Jan 8, 2014, 4:44:56 PM1/8/14
to sim...@googlegroups.com
Thanks!

I noticed that there is a merge request that is more clever than mine, by thors. It tests if the avr directory exists or not: https://gitorious.org/simavr/simavr/merge_requests/16

So I took his idea and wrote it like this:

LINUX_AVR_ROOTS := /usr/lib/avr /usr/avr /opt/cross/avr/avr
AVR_ROOT := $(firstword $(wildcard $(LINUX_AVR_ROOTS)))
ifeq (${AVR_ROOT},)
$(error No avr-libc root directory found. Tried the following paths: $(LINUX_AVR_ROOTS))
endif

Merge request: https://gitorious.org/simavr/simavr/merge_requests/17


//Thomas

M P

unread,
Jan 9, 2014, 3:38:07 AM1/9/14
to simavr
ack. thats why I didn't see it, it's on gitorious not github, and the notif emails of gitorious never really worked for me!

M

M P

unread,
Jan 9, 2014, 9:26:28 AM1/9/14
to simavr
I've just pushed a few changes, including this patch, thanks everyone!

M

Thomas Axelsson

unread,
Jan 9, 2014, 12:19:28 PM1/9/14
to sim...@googlegroups.com
Wait, this is really confusing. Is there any reason using both gitorious and github?

//Thomas

M P

unread,
Jan 9, 2014, 12:24:07 PM1/9/14
to simavr
I started with gitorious, then we moved to github because it had extra cool features, like pull merges and stuff. And now gitorious does the same, except it doesn't do it really well as you can't 'auto merge' it.

So I push to gitorious so there's a backup of the tree online in case github sinks, but I rarely goes there, if at all.

M

Reply all
Reply to author
Forward
0 new messages