This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

stdint.h: No such file or directory

Hello,

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

make
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

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.2.1/lto-wrapper
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 --with-bugurl=bugzilla.redhat.com/bugzilla --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) 

Makefile.posix

GNU_INSTALL_ROOT := /usr
GNU_VERSION := 6.2.1
GNU_PREFIX := arm-none-eabi

Makefile.common

# 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
# SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
#
# 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_CONFIG_FILE := $(TEMPLATE_PATH)/Makefile.$(PLATFORM_SUFFIX)
include $(TOOLCHAIN_CONFIG_FILE)

# 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"
OBJDUMP := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump"
OBJCOPY := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy"
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 :=
else
  NO_ECHO := @
endif

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

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

# $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) \
  $(obj_file))
endef

# $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)) \
    -I"$(folder)"))
endef

# $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)
endef

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

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

all: $(TARGETS)

clean:
	$(RM) $(OUTPUT_DIRECTORY)

# Create build directories
$(OUTPUT_DIRECTORY):
	$(MK) $@

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

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

# Create objects from assembly files
$(OUTPUT_DIRECTORY)/%.S.o \
$(OUTPUT_DIRECTORY)/%.s.o: | $(OUTPUT_DIRECTORY)
	@echo Assembling file: $(notdir $($@))
	$(NO_ECHO)$(CC) -std=c99 $(ASMFLAGS) $(INC_PATHS) -c -o $@ "$($@)"

# Link object files
%.out:
	@echo Linking target: $@
	$(NO_ECHO)$(CC) -Wl,-Map=$(@:.out=.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?

    /usr/lib/gcc/arm-none-eabi/6.1.0/include/

    If it still does not work properly, I would strongly recommend using the upstream arm-none-eabi located on launchpad: launchpad.net/.../ 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
    /usr/lib/gcc/arm-none-eabi/6.1.0/include
    [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 gnuarmeclipse.github.io/.../

    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.

    Cheers

    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
    
  • those errors are ok - annoying but ok - what happens when you make again after the make clean

Related