stdint.h: No such file or directory


I'm trying to compile an example of nRF52_SDK_1 but I get this error:

Makefile:150: Cannot find include folder:  ../../../config/receiver_pca10040
Makefile:150: Cannot find include folder:  ../../../config
mkdir _build
Compiling file: nrf_log_backend_serial.c
In file included from ../../../../../../../components/libraries/util/sdk_errors.h:45:0,
                 from ../../../../../../../components/libraries/log/nrf_log_ctrl.h:26,
                 from ../../../../../../../components/libraries/log/nrf_log_backend.h:27,
                 from ../../../../../../../components/libraries/log/src/nrf_log_backend_serial.c:14:
/usr/lib/gcc/arm-none-eabi/6.1.0/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
compilation terminated.
../../../../../../../components/toolchain/gcc/Makefile.common:108: fallo en las instrucciones para el objetivo '_build/nrf52832_xxaa_nrf_log_backend_serial.c.o'
make: *** [_build/nrf52832_xxaa_nrf_log_backend_serial.c.o] Error 1

How I can fix it?

GCC -ver

Objetivo: x86_64-redhat-linux
Configurado con: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Modelo de hilos: posix
gcc versión 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC) 


GNU_VERSION := 6.2.1
GNU_PREFIX := arm-none-eabi


# Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved.
# The information contained herein is property of Nordic Semiconductor ASA.
# Terms and conditions of usage are described in detail in NORDIC
# Licensees are granted free, non-transferable use of the information. NO
# WARRANTY of ANY KIND is provided. This heading must NOT be removed from
# the file.

PLATFORM_SUFFIX := $(if $(filter Windows%,$(OS)),windows,posix)

# Toolchain commands
CC      := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc"
CXX     := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-c++"
AS      := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as"
AR      := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar" -r
LD      := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld"
NM      := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm"
SIZE    := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size"
$(if $(shell $(CC) --version),,$(info Cannot find: $(CC).) \
  $(info Please set values in: "$(abspath $(TOOLCHAIN_CONFIG_FILE))") \
  $(info according to the actual configuration of your system.) \
  $(error Cannot continue))

# Use ccache on linux if available
CCACHE := $(if $(filter Windows%,$(OS)),, \
               $(if $(wildcard /usr/bin/ccache),ccache))
CC     := $(CCACHE) $(CC)

MK := mkdir
RM := rm -rf

# echo suspend
ifeq ($(VERBOSE),1)
  NO_ECHO :=
  NO_ECHO := @

# $1 type of item
# $2 path to check
define ensure_exists
$(if $(wildcard $(2)),, $(warning Cannot find $(1): $(2)))

# $1 object file
# $2 source file
define bind_obj_with_src
$(eval $(1) := $(2))

# $1 target name
# $2 list of source files
define get_object_files
$(foreach src_file, $(2), \
  $(call ensure_exists,source file, $(src_file)) \
  $(eval obj_file := \
    $(OUTPUT_DIRECTORY)/$(strip $(1))_$(notdir $(src_file)).o) \
  $(eval $(strip $(1))_dependencies += $(obj_file:.o=.d)) \
  $(call bind_obj_with_src, $(obj_file), $(src_file)) \
  $(eval $(obj_file): Makefile) \

# $1 target name
# $2 link target name
define prepare_build
$(eval $(2): \
  $(call get_object_files, $(1), $(SRC_FILES) $(SRC_FILES_$(strip $(1))))) \
$(eval INC_PATHS := \
  $(foreach folder, $(INC_FOLDERS) $(INC_FOLDERS_$(strip $(1))), \
    $(call ensure_exists,include folder, $(folder)) \

# $1 target name
define define_target
$(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \
$(eval $(1): $(OUTPUT_FILE).out $(OUTPUT_FILE).hex $(OUTPUT_FILE).bin) \
$(call prepare_build, $(1), $(OUTPUT_FILE).out)

# $1 target name
# $2 library file name
define define_library
$(eval $(1) := $(2)) \
$(call prepare_build, $(1), $(1))

.PHONY: $(TARGETS) default all clean help flash

all: $(TARGETS)


# Create build directories
	$(MK) $@

# Create objects from C source files
	@echo Compiling file: $(notdir $($@))
	$(NO_ECHO)$(CC) -std=c99 $(CFLAGS) $(INC_PATHS) -c -o $@ "$($@)"

# Create objects from C++ source files
	@echo Compiling file: $(notdir $($@))
	$(NO_ECHO)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INC_PATHS) -c -o $@ "$($@)"

# Create objects from assembly files
	@echo Assembling file: $(notdir $($@))
	$(NO_ECHO)$(CC) -std=c99 $(ASMFLAGS) $(INC_PATHS) -c -o $@ "$($@)"

# Link object files
	@echo Linking target: $@
	$(NO_ECHO)$(CC) -Wl,-Map=$( $(LDFLAGS) $^ $(LIB_FILES) -lm -o $@
	-@echo ''
	$(NO_ECHO)$(SIZE) $@
	-@echo ''

# Create binary .bin file from the .out file
%.bin: %.out
	@echo Preparing: $@
	$(NO_ECHO)$(OBJCOPY) -O binary $< $@

# Create binary .hex file from the .out file
%.hex: %.out
	@echo Preparing: $@
	$(NO_ECHO)$(OBJCOPY) -O ihex $< $@

Best regards

  • I don't have an answer but I will give my thoughts. My strategy would be to fix the first error "Cannot find...". This comes from the function ensure_exists() in the Makefile. These Makefiles are very fragile: they use "../../.." and that breaks when you don't have exactly the same directory structure as the original build system. Try installing the SDK and example exactly in the places as shown in some tutorial. Next thought: I have never seen #include_next. If you read about it, it is used for redirecting the include to some patched or other file. I can't tell whether the gcc arm include file stdint.h is doing #include_next (which would say that your gcc arm toolchain might be broken, or looking for a non-ARM toolchain stdint.h?) or whether a Nordic Makefile is doing #include_next.

  • I've seen the same behavior with the arm-none-eabi that is supplied with other linux distro's, meaning that the behavior is quite "strange". Can you check if stdint.h is actually located in this directory?


    If it still does not work properly, I would strongly recommend using the upstream arm-none-eabi located on launchpad: download

    Cheers, Håkon

  • Have you tried 'make clean' to remove all the old dependency files first?I've seen this when and old .d file references and old include.

  • Hi,

    Thanks for the replies,

    stdint.h exists into include folder:

    [javier@PC include]$ pwd
    [javier@PC include]$ ls
    arm_acle.h  mmintrin.h   stdbool.h     stdint.h             unwind.h
    arm_neon.h  stdalign.h   stddef.h      stdnoreturn.h        varargs.h
    float.h     stdarg.h     stdfix.h      tgmath.h
    iso646.h    stdatomic.h  stdint-gcc.h  unwind-arm-common.h

    I think that documentation is based in this tutorial

    and used this path (for Ubuntu) /usr/local/gcc-arm-none-eabi-4_9-2015q3 (I used Fedora 25)

    I will try to edit the Makefile as Butch said.


    PD: @RK, Same error: make clean

    Makefile:203: Cannot find include folder:  ../../../config/blinky_pca10040
    Makefile:203: Cannot find include folder:  ../../../config
    rm -rf _build