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

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

  • quick googling shows that include_next is very linux'y and requires you to have another directory in the include list after the standard one to supply stdint.h, which you don't have.

    I would go with Hakon's suggestion to install the proper arm-none-eabi, I don't know where that 6.1.0 one came from.

  • I agree with RK about the first errors probably are harmless, since they are part of make clean. But rather than install a new GNU ARM toolchain you could try a temporary hack: the error message says the GNU ARM stdint.h, at line 9 is #next_include'ing another stdint.h further down the list of include files. Try commenting that line out. If make then works, and your app works, you might then wonder if the #include_next was really needed. But if you get error messages similar to "can't resolve symbol" for symbols which you think should be defined in stdint, then its not the right solution. RK, #include_next is Unix'y, then Gnu'y, then Linux'y. As the Gnu Make document says, #include_next is arcane and should rarely be needed, in other words, a bit of a hack itself.

  • @RK,

    [javier@PC armgcc]$ make clean
    Makefile:203: Cannot find include folder:  ../../../config/blinky_pca10040
    Makefile:203: Cannot find include folder:  ../../../config
    rm -rf _build
    [javier@PC armgcc]$ make
    Makefile:203: Cannot find include folder:  ../../../config/blinky_pca10040
    Makefile:203: Cannot find include folder:  ../../../config
    mkdir _build
    Assembling file: gcc_startup_nrf52.S
    Compiling file: system_nrf52.c
    In file included from ../../../../../../components/toolchain/system_nrf52.c:31:0:
    /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_system_nrf52.c.o'
    make: *** [_build/nrf52832_xxaa_system_nrf52.c.o] Error 1
    
Related