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 assume Javier thinks his gnu toolchain IS proper, since he probably installed it using the distro's methods. Javier, what platform and how did you install? The version does seem strange (on my Ubuntu 16.04, the distro's ARM gcc version is 4.9.3) so maybe Redhat is applying their own versioning? BTW, Redhat is instrumental in maintaining gcc, so you would think it would be OK. Maybe read near line 9 in stdint.h to figure out why it thinks it needs another stdint.h found further along the list of include directories?

  • my stdint.h:

    #ifndef _GCC_WRAP_STDINT_H
    #if __STDC_HOSTED__
    # if defined __cplusplus && __cplusplus >= 201103L
    #  undef __STDC_LIMIT_MACROS
    #  define __STDC_LIMIT_MACROS
    #  undef __STDC_CONSTANT_MACROS
    #  define __STDC_CONSTANT_MACROS
    # endif
    # include_next <stdint.h>
    #else
    # include "stdint-gcc.h"
    #endif
    #define _GCC_WRAP_STDINT_H
    #endif
    

    See stackoverflow.com/.../what-is-ffreestanding-option-in-gcc

    So maybe Javier doesn't have a default dev environment (with non-cross compiling gcc) installed? (Which would have a stdint.h that the #include_next would find?) I could be wrong.

  • yeah he can fiddle around for days getting something working using whatever redhat provides and then wait for it to break again, or he can download a standalone GNU ARM toolchain which is known to work. Just trying to help him get from where he is to where he wants to be in the shortest time without having to mess around with the makefiles in the SDK.

  • Specifically, exactly which standalone GNU ARM toolchain on which platform(s) does Nordic recommend? If Nordic is recommending a "standalone" toolchain, wouldn't "--freestanding" be in their example Makefiles? I am not recommending to mess around with makefiles in the SDK to fix this problem. But you must "mess around" with the Makefile anyway, to add your source files, fix known bugs in the Makefiles, etc. Javier, ">which gcc" to make sure you have a non-cross compiling gcc installed.

  • Hi!,

    I was used Fedora 25. Today, in the same hard-disk I have installed Ubuntu 16.04 64 bits with arm-none-eabi-gcc 4.9.3

    Now compile succefully!

    javi@PC:~/Development/Nordic/nRF52/examples/peripheral/blinky/pca10040/blank/armgcc$ make
    Makefile:204: Cannot find include folder:  ../../../config/blinky_pca10040
    Makefile:204: Cannot find include folder:  ../../../config
    mkdir _build
    Assembling file: gcc_startup_nrf52.S
    Compiling file: system_nrf52.c
    Compiling file: main.c
    Compiling file: app_error.c
    Compiling file: app_error_weak.c
    Compiling file: app_fifo.c
    Compiling file: app_timer.c
    Compiling file: app_util_platform.c
    Compiling file: hardfault_implementation.c
    Compiling file: nrf_assert.c
    Compiling file: nrf_drv_clock.c
    Compiling file: nrf_drv_common.c
    Compiling file: nrf_nvic.c
    Compiling file: nrf_soc.c
    Linking target: _build/nrf52832_xxaa.out
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-exit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-fini.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-impure.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-init.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-memset.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-__atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-__call_atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    
       text	   data	    bss	    dec	    hex	filename
       4776	    112	    228	   5116	   13fc	_build/nrf52832_xxaa.out
    
    Preparing: _build/nrf52832_xxaa.hex
    Preparing: _build/nrf52832_xxaa.bin
    

    Thanks very much, Best regards

Related