Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newlib.mk: fix regressions #9515

Merged
merged 6 commits into from
Aug 2, 2018
Merged

Conversation

cladmi
Copy link
Contributor

@cladmi cladmi commented Jul 6, 2018

Contribution description

Fixes:

  • clean the output of gcc to get compiler includes
  • Non indented comments
  • Patterns not taken into account
  • The need to have a trailing slash in NEWLIB_INCLUDE_DIR

Testing

Can be tested by compiling tests/libc_newlib:

make -C tests/libc_newlib/ BOARD=samr21-xpro clean all
make -C tests/libc_newlib/ BOARD=samr21-xpro clean all TOOLCHAIN=llvm # this should also work.

Issues/PRs references

Fixes for #9394

Split from #9512

@cladmi cladmi changed the title Pr/make/newlib/fixandstuff newlib.mk: fix regressions Jul 6, 2018
Copy link

@vac vac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not require slash terminated NEWLIB_INCLUDE_DIR fixes samr21-xpro compilation on windows.

@cladmi
Copy link
Contributor Author

cladmi commented Jul 9, 2018

@vac Nice to hear that. To have some more information on your windows setup, could you give me the values of NEWLIB_INCLUDE_DIR printed with this diff applied :

diff --git a/makefiles/libc/newlib.mk b/makefiles/libc/newlib.mk
index e29b240..5335580 100644
--- a/makefiles/libc/newlib.mk
+++ b/makefiles/libc/newlib.mk
@@ -31,6 +31,8 @@ ifeq (,$(NEWLIB_INCLUDE_DIR))
   NEWLIB_INCLUDE_DIR := $(firstword $(abspath $(dir $(wildcard $(addsuffix /newlib.h, $(COMPILER_INCLUDE_PATHS)))))) 
 endif
 
+$(info 1 - NEWLIB_INCLUDE_DIR: $(NEWLIB_INCLUDE_DIR))
+
 ifeq (,$(NEWLIB_INCLUDE_DIR))
   # Since Clang is not installed as a separate instance for each crossdev target
   # we need to tell it where to look for platform specific includes (Newlib
@@ -59,12 +61,16 @@ ifeq (,$(NEWLIB_INCLUDE_DIR))
   NEWLIB_INCLUDE_DIR := $(firstword $(abspath $(dir $(wildcard $(addsuffix /newlib.h, $(NEWLIB_INCLUDE_PATTERNS))))))
 endif
 
+$(info 2 - NEWLIB_INCLUDE_DIR: $(NEWLIB_INCLUDE_DIR))
+
 # If nothing was found we will try to fall back to searching for a cross-gcc in
 # the current PATH and use a relative path for the includes
 ifeq (,$(NEWLIB_INCLUDE_DIR))
   NEWLIB_INCLUDE_DIR := $(abspath $(wildcard $(dir $(shell command -v $(PREFIX)gcc 2>/dev/null))/../$(TARGET_ARCH)/include))
 endif
 
+$(info 3 - NEWLIB_INCLUDE_DIR: $(NEWLIB_INCLUDE_DIR))
+
 ifeq ($(TOOLCHAIN),llvm)
   # A cross GCC already knows the target libc include path (build-in at compile time)
   # but Clang, when cross-compiling, needs to be told where to find the headers

I am interested to know what is used for you.

@vac
Copy link

vac commented Jul 9, 2018

@cladmi,
the situation is a bit more complicated.
First, note that I'm using MSYS bash and I have project and riot files on drive D: while compiler on drive C:


As I write you yesterday your first commit fixes issues in my case.
When I've applied just your first commit + debug logs it works and the output is:

1 - NEWLIB_INCLUDE_DIR:
2 - NEWLIB_INCLUDE_DIR:
3 - NEWLIB_INCLUDE_DIR: /c/armgcc/2018-q2/arm-none-eabi/include

When I've applied all of your commits (+debug logs) it is not working and the output is:

1 - NEWLIB_INCLUDE_DIR: /d/test_project/c:\armgcc\2018-q2\bin\../arm-none-eabi/include
2 - NEWLIB_INCLUDE_DIR: /d/test_project/c:\armgcc\2018-q2\bin\../arm-none-eabi/include
3 - NEWLIB_INCLUDE_DIR: /d/test_project/c:\armgcc\2018-q2\bin\../arm-none-eabi/include

I think that the problem came with abspath in your 4th commit (newlib.mk: get NEWLIB_INCLUDE_DIR absolute and without trailing slash).


When I've applied all of your commits + revert changes from 4th commit it works and the output is different than in first case:

1 - NEWLIB_INCLUDE_DIR: c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/
2 - NEWLIB_INCLUDE_DIR: c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/
3 - NEWLIB_INCLUDE_DIR: c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/

I hope that it would be somehow helpful.

@cladmi
Copy link
Contributor Author

cladmi commented Jul 10, 2018

That is really helpful. Having them in different drives is perfectly fine and shows more problems :)

Could you also tell me which commit produced a value for the first debug output, and what was the output in that case. Working or not does not matter.
Because it means the current detection does not work on windows but has been fixed somewhere.

When searching for abspath and mingw I found this:

zephyrproject-rtos/zephyr#2061 (comment)

Which basically is the problem faced here. Unfortunately the link is not working but it looks like it is this zephyrproject-rtos/zephyr@941059c by using realpath. Which could also remove the need for wildcard at the same time. EDIT: not the case because then dir should be called after which would keep the terminating /.

I could also just remove abspath. I was thinking that resolving c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/ to /c/armgcc/2018-q2/arm-none-eabi/include was better (it is the same if you check the '..').

@cladmi
Copy link
Contributor Author

cladmi commented Jul 10, 2018

If it is the commit that sanitize the output, I would also like to have the output of both

arm-none-eabi-gcc -v -x c -E /dev/null 2>&1
arm-none-eabi-gcc -v -x c -E /dev/null 2>&1 | grep '^\s'

@cladmi cladmi added CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable Area: build system Area: Build system labels Jul 10, 2018
@cladmi
Copy link
Contributor Author

cladmi commented Jul 10, 2018

I pushed changes to use relpath which should make it work, according to the changes in zephyr.

@vac
Copy link

vac commented Jul 10, 2018

this is the minimal change that fixes compilation on Windows, in my case:

Index: newlib.mk
===================================================================
--- newlib.mk	(revision 503)
+++ newlib.mk	(revision 504)
@@ -72,9 +72,9 @@
 endif
 
 ifeq (1,$(USE_NEWLIB_NANO))
-  NEWLIB_NANO_INCLUDE_DIR ?= $(firstword $(wildcard $(NEWLIB_INCLUDE_DIR)newlib-nano \
-                                                    $(NEWLIB_INCLUDE_DIR)newlib/nano \
-                                                    $(NEWLIB_INCLUDE_DIR)nano))
+  NEWLIB_NANO_INCLUDE_DIR ?= $(firstword $(wildcard $(NEWLIB_INCLUDE_DIR)/newlib-nano \
+                                                    $(NEWLIB_INCLUDE_DIR)/newlib/nano \
+                                                    $(NEWLIB_INCLUDE_DIR)/nano))
   # newlib-nano overrides newlib.h and its include dir should therefore go before
   # the regular system include dirs.
   INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(INCLUDES)

I was about to make such pull request when I found yours - which have exactly the same commit: 79dad7c

So 79dad7c is the change that you asking for - first output.

@vac
Copy link

vac commented Jul 10, 2018

Here is the output of commands that you asked for:
The first one:

vac@K198 /d/test_project
$ arm-none-eabi-gcc -v -x c -E /dev/null 2>&1
Using built-in specs.
COLLECT_GCC=c:\Programy\programowanie\armgcc\2018-q2\bin\arm-none-eabi-gcc.exe
Target: arm-none-eabi
Configured with: /tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/src/gcc/configure --build=x86_64-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw --libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/lib --infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-mingw-wildcard --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/arm-none-eabi --with-libiconv-prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-mingw/host-libs/usr --with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-mingw/host-libs/usr --with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-mingw/host-libs/usr --with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-mingw/host-libs/usr --with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-mingw/host-libs/usr --with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2018-q2-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
COLLECT_GCC_OPTIONS='-v' '-E'
 c:/armgcc/2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/cc1.exe -E -quiet -v -iprefix c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/ -isysroot c:\armgcc\2018-q2\bin\../arm-none-eabi -D__USES_INITFINI__ nul
# 1 "nul"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "nul"
ignoring duplicate directory "c:/armgcc/2018-q2/lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include"
ignoring nonexistent directory "c:\armgcc\2018-q2\bin\../arm-none-eabi/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-mingw/lib/gcc/arm-none-eabi/7.3.1/../../../../include"
ignoring duplicate directory "c:/armgcc/2018-q2/lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include-fixed"
ignoring duplicate directory "c:/armgcc/2018-q2/lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "c:\armgcc\2018-q2\bin\../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/include
 c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/include-fixed
 c:\armgcc\2018-q2\bin\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include
End of search list.
COMPILER_PATH=c:/armgcc/2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/;c:/armgcc/2018-q2/bin/../lib/gcc/;c:/armgcc/2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/armgcc/2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/;c:/armgcc/2018-q2/bin/../lib/gcc/;c:/armgcc/2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/;c:/armgcc/2018-q2/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-E'

And the second one:

vac@K198 /d/test_project
$ arm-none-eabi-gcc -v -x c -E /dev/null 2>&1 | grep '^\s'

...yes, the output of second one is empty

@vac
Copy link

vac commented Jul 10, 2018

I can confirm that changing abspath to realpath fixes my Windows issues:)
Glad you found it.
The output with all of your 7 commits is:

1 - NEWLIB_INCLUDE_DIR: /c/armgcc/2018-q2/arm-none-eabi/include/
2 - NEWLIB_INCLUDE_DIR: /c/armgcc/2018-q2/arm-none-eabi/include/
3 - NEWLIB_INCLUDE_DIR: /c/armgcc/2018-q2/arm-none-eabi/include/
4 - NEWLIB_INCLUDE_DIR: /c/armgcc/2018-q2/arm-none-eabi/include/

@cladmi
Copy link
Contributor Author

cladmi commented Jul 11, 2018

@vac For the output, it could be an issue with the grep version that does not like \s but sed supports it. I should add this to the commit message.

It's great that realpath fixes your problem. It looks like it leaves the trailing / though but is harmless. I will also mention it in the commit.
I will keep this in mind when I refactor the "is this a directory with newlib.h" in a function.

@cladmi cladmi force-pushed the pr/make/newlib/fixandstuff branch from 7a6057d to 62b463f Compare July 11, 2018 07:22
@cladmi cladmi requested review from cgundogan and smlng July 12, 2018 09:40
@cladmi cladmi added this to the Release 2018.07 milestone Jul 12, 2018
@smlng
Copy link
Member

smlng commented Jul 12, 2018

re-introduces bug on macOS, build fails for stuff using newlib with:

BOARD=samr21-xpro make -C examples/gnrc_networking clean all
Warning: no PORT set!

Building application "gnrc_networking" for "samr21-xpro" with MCU "samd21".

cc1: error: -I/Volumes/devel/github/smlng/RIOT/core/include: No such file or directory [-Werror=missing-include-dirs]
In file included from /Volumes/devel/github/smlng/RIOT/examples/gnrc_networking/main.c:23:0:
/Volumes/devel/github/smlng/RIOT/sys/include/shell.h:25:10: fatal error: kernel_defines.h: No such file or directory
 #include "kernel_defines.h"
          ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
compilation terminated.
make[1]: *** [/Volumes/devel/github/smlng/RIOT/examples/gnrc_networking/bin/samr21-xpro/application_gnrc_networking/main.o] Error 1
make: *** [/Volumes/devel/github/smlng/RIOT/examples/gnrc_networking/bin/samr21-xpro/application_gnrc_networking.a] Error 2

INCLUDES from BOARDS=samr21-xpro make -C examples/gnrc_networking info-build for this PR:

INCLUDES: 
	-isystem  
	-I/Volumes/devel/github/smlng/RIOT/core/include  
	-I/Volumes/devel/github/smlng/RIOT/drivers/include  
	-I/Volumes/devel/github/smlng/RIOT/sys/include  
	-I/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/samd21/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/sam0_common/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/include/vendor  
	-I/Volumes/devel/github/smlng/RIOT/sys/libc/include  
	-I/Volumes/devel/github/smlng/RIOT/sys/net/gnrc/netif/include  
	-I/Volumes/devel/github/smlng/RIOT/drivers/at86rf2xx/include

and from master:

INCLUDES: 
	-isystem  
	/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/newlib-nano  
	-I/Volumes/devel/github/smlng/RIOT/core/include  
	-I/Volumes/devel/github/smlng/RIOT/drivers/include  
	-I/Volumes/devel/github/smlng/RIOT/sys/include  
	-I/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/samd21/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/sam0_common/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/include/vendor  
	-I/Volumes/devel/github/smlng/RIOT/sys/libc/include  
	-I/Volumes/devel/github/smlng/RIOT/sys/net/gnrc/netif/include  
	-I/Volumes/devel/github/smlng/RIOT/drivers/at86rf2xx/include

@cladmi
Copy link
Contributor Author

cladmi commented Jul 12, 2018

@smlng Thanks for your feedback. Could you give the output with this diff applied: #9515 (comment)

And give which commit broke it ?

Because on master it looked like it was correctly getting the value using the gcc parsing output, so I would imagine something there. Maybe realpath or sed that does not work in the same way on mac ?

@cladmi
Copy link
Contributor Author

cladmi commented Jul 16, 2018

I added commits that write debug output.

Can you post the result of a compilation with them:

make -C examples/hello-world/ BOARD=samr21-xpro

@pyropeter
Copy link
Contributor

$ make -j1 -C examples/hello-world/ BOARD=samr21-xpro
make: Entering directory '/tmp/riot-working/examples/hello-world'
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /build/arm-none-eabi-gcc/src/gcc-7-20180125/configure --target=arm-none-eabi --prefix=/usr --with-sysroot=/usr/arm-none-eabi --with-native-system-header-dir=/include --libexecdir=/usr/lib --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-system-zlib --with-newlib --with-headers=/usr/arm-none-eabi/include --with-python-dir=share/gcc-arm-none-eabi --with-gmp --with-mpfr --with-mpc --with-isl --with-libelf --enable-gnu-indirect-function --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='Arch Repository' --with-bugurl=https://bugs.archlinux.org/ --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r
Thread model: single
gcc version 7.3.0 (Arch Repository) 
COLLECT_GCC_OPTIONS='-v' '-E'
 /usr/lib/gcc/arm-none-eabi/7.3.0/cc1 -E -quiet -v -D__USES_INITFINI__ /dev/null
ignoring nonexistent directory "/usr/arm-none-eabi/usr/local/include"
ignoring duplicate directory "/usr/arm-none-eabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/arm-none-eabi/7.3.0/include
 /usr/lib/gcc/arm-none-eabi/7.3.0/include-fixed
 /usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/include
End of search list.
COMPILER_PATH=/usr/lib/gcc/arm-none-eabi/7.3.0/:/usr/lib/gcc/arm-none-eabi/7.3.0/:/usr/lib/gcc/arm-none-eabi/:/usr/lib/gcc/arm-none-eabi/7.3.0/:/usr/lib/gcc/arm-none-eabi/:/usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/usr/lib/gcc/arm-none-eabi/7.3.0/:/usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/lib/:/usr/arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-E'
/tmp/riot-working/makefiles/libc/newlib.mk:42: 0 - COMPILER_INCLUDE_PATHS
/tmp/riot-working/makefiles/libc/newlib.mk:43: 0 - /usr/lib/gcc/arm-none-eabi/7.3.0/include: 
/tmp/riot-working/makefiles/libc/newlib.mk:43: 0 - /usr/lib/gcc/arm-none-eabi/7.3.0/include-fixed: 
/tmp/riot-working/makefiles/libc/newlib.mk:43: 0 - /usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/include: /usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/include/newlib.h
/tmp/riot-working/makefiles/libc/newlib.mk:44: 1 - NEWLIB_INCLUDE_DIR: /usr/arm-none-eabi/include
/tmp/riot-working/makefiles/libc/newlib.mk:74: 2 - NEWLIB_INCLUDE_DIR: /usr/arm-none-eabi/include
/tmp/riot-working/makefiles/libc/newlib.mk:82: 3 - NEWLIB_INCLUDE_DIR: /usr/arm-none-eabi/include
/tmp/riot-working/makefiles/libc/newlib.mk:98: 4 - NEWLIB_NANO_INCLUDE_DIR: 

Building application "hello-world" for "samr21-xpro" with MCU "samd21".

cc1: error: -I/tmp/riot-working/core/include: No such file or directory [-Werror=missing-include-dirs]
cc1: all warnings being treated as errors
make[1]: *** [/tmp/riot-working/Makefile.base:83: /tmp/riot-working/examples/hello-world/bin/samr21-xpro/application_hello-world/main.o] Error 1
make: *** [/tmp/riot-working/examples/hello-world/../../Makefile.include:391: /tmp/riot-working/examples/hello-world/bin/samr21-xpro/application_hello-world.a] Error 2
make: Leaving directory '/tmp/riot-working/examples/hello-world'

I'm using ArchLinux with the following toolchain packages installed:

$ pacman -Qs arm-none-eabi
local/arm-none-eabi-binutils 2.30-1
    A set of programs to assemble and manipulate binary and object files for the ARM EABI (bare-metal) target
local/arm-none-eabi-gcc 7.3.0-1
    The GNU Compiler Collection - cross compiler for ARM EABI (bare-metal) target
local/arm-none-eabi-gdb 8.1-2
    The GNU Debugger for the ARM EABI (bare-metal) target
local/arm-none-eabi-newlib 2.5.0.20170922-1
    A C standard library implementation intended for use on embedded systems (ARM bare metal)

@cladmi
Copy link
Contributor Author

cladmi commented Jul 16, 2018

Can you list where newlib.h is available on your computer to find the nano one:

sudo updatedb; locate newlib.h

or similar

@cladmi
Copy link
Contributor Author

cladmi commented Jul 16, 2018

It looks like it has been fixed on arm-none-eabi-newlib 3.0 so a newer version than yours https://bugs.archlinux.org/task/50481

@kYc0o
Copy link
Contributor

kYc0o commented Jul 16, 2018

This is my output on OS X:

HEAD is now at 447066ee5 fixup! fixup! REMOVE ME: add warnings for debug
snake:RIOT facosta$ make -C examples/hello-world/ BOARD=samr21-xpro
make: Entering directory '/Users/facosta/git/RIOT-OS/RIOT/examples/hello-world'
Warning: no PORT set!
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /Users/build/work/GCC-7-build/src/gcc/configure --target=arm-none-eabi --prefix=/Users/build/work/GCC-7-build/install-native --libexecdir=/Users/build/work/GCC-7-build/install-native/lib --infodir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/Users/build/work/GCC-7-build/install-native/arm-none-eabi --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --with-gmp=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-mpfr=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-mpc=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-isl=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-libelf=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-lstdc++ -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2018-q2-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 
COLLECT_GCC_OPTIONS='-v' '-E'
 /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/cc1 -E -quiet -v -iprefix /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/ -isysroot /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
ignoring duplicate directory "/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include"
ignoring nonexistent directory "/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory "/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include-fixed"
ignoring duplicate directory "/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/include
 /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/include-fixed
 /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include
End of search list.
COMPILER_PATH=/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/:/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/:/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/:/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/:/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/:/usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-E'
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:42: 0 - COMPILER_INCLUDE_PATHS
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/include: 
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/include-fixed: 
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include: /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/newlib.h
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:44: 1 - NEWLIB_INCLUDE_DIR: /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/arm-none-eabi/include
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:74: 2 - NEWLIB_INCLUDE_DIR: /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/arm-none-eabi/include
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:82: 3 - NEWLIB_INCLUDE_DIR: /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/arm-none-eabi/include
/Users/facosta/git/RIOT-OS/RIOT/makefiles/libc/newlib.mk:98: 4 - NEWLIB_NANO_INCLUDE_DIR: /usr/local/Cellar/arm-none-eabi-gcc/7-2018-q2-update/gcc/arm-none-eabi/include/newlib-nano

Building application "hello-world" for "samr21-xpro" with MCU "samd21".

"make" -C /Users/facosta/git/RIOT-OS/RIOT/boards/samr21-xpro
"make" -C /Users/facosta/git/RIOT-OS/RIOT/core
"make" -C /Users/facosta/git/RIOT-OS/RIOT/cpu/samd21
"make" -C /Users/facosta/git/RIOT-OS/RIOT/cpu/cortexm_common
"make" -C /Users/facosta/git/RIOT-OS/RIOT/cpu/cortexm_common/periph
"make" -C /Users/facosta/git/RIOT-OS/RIOT/cpu/sam0_common
"make" -C /Users/facosta/git/RIOT-OS/RIOT/cpu/sam0_common/periph
"make" -C /Users/facosta/git/RIOT-OS/RIOT/cpu/samd21/periph
"make" -C /Users/facosta/git/RIOT-OS/RIOT/drivers
"make" -C /Users/facosta/git/RIOT-OS/RIOT/drivers/periph_common
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys/auto_init
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys/isrpipe
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys/newlib_syscalls_default
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys/pm_layered
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys/tsrb
"make" -C /Users/facosta/git/RIOT-OS/RIOT/sys/uart_stdio
   text	   data	    bss	    dec	    hex	filename
   8624	    140	   2740	  11504	   2cf0	/Users/facosta/git/RIOT-OS/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.elf
make: Leaving directory '/Users/facosta/git/RIOT-OS/RIOT/examples/hello-world'

With this configuration:

Installed compiler toolchains 
-----------------------------
             native gcc: Apple LLVM version 8.0.0 (clang-800.0.42.1)
      arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
                avr-gcc: avr-gcc (GCC) 8.1.0
       mips-mti-elf-gcc: missing
             msp430-gcc: msp430-gcc (GCC) 4.7.0 20120322 (mspgcc dev 20120911)
   riscv-none-embed-gcc: missing
                  clang: Apple LLVM version 8.0.0 (clang-800.0.42.1)

Installed compiler libs
-----------------------
   arm-none-eabi-newlib: "3.0.0"
    mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
               avr-libc: "2.0.0" ("20150208")

Installed development tools
---------------------------
                  cmake: cmake version 3.11.4
               cppcheck: missing
                doxygen: missing
                 flake8: missing
                    git: git version 2.18.0
             coccinelle: missing

@pyropeter
Copy link
Contributor

It's at /usr/arm-none-eabi/include/newlib.h

@cladmi
Copy link
Contributor Author

cladmi commented Jul 16, 2018

@pyropeter can you try upgrading arm-none-eabi-newlib it was a bug in arch-linux packaging and it now ships usr/arm-none-eabi/include/newlib-nano/newlib.h https://bugs.archlinux.org/task/50481

@cladmi
Copy link
Contributor Author

cladmi commented Jul 16, 2018

@kYc0o thanks it works for you so it is not a general mac problem

@smlng can you give the output with the last commits, I would like to understand what is not correctly handled

@smlng
Copy link
Member

smlng commented Aug 2, 2018

TL;DR: doesn't work on macOS

@cladmi
Copy link
Contributor Author

cladmi commented Aug 2, 2018

It was working on @kYc0o mac, so there must be something else.
I analyze your output.

@cladmi cladmi force-pushed the pr/make/newlib/fixandstuff branch from f0ee69b to 1257134 Compare August 2, 2018 14:33
@cladmi
Copy link
Contributor Author

cladmi commented Aug 2, 2018

Found it, it was replacing /usr by /ur
Looks like an issue with some sed versions that do not recognize \s that I took from the grep command.

I tried a fixup to remove the leading spaces. Can you please retry @smlng ?
And if not, fiddle a bit with my last fixup to make it work with your sed version too.

I also rebased on master.

@smlng
Copy link
Member

smlng commented Aug 2, 2018

better now:

BOARD=samr21-xpro make -C tests/libc_newlib/ info-build
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /Users/build/work/GCC-7-build/src/gcc/configure --target=arm-none-eabi --prefix=/Users/build/work/GCC-7-build/install-native --libexecdir=/Users/build/work/GCC-7-build/install-native/lib --infodir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/Users/build/work/GCC-7-build/install-native/arm-none-eabi --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --with-gmp=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-mpfr=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-mpc=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-isl=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-libelf=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-lstdc++ -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2017-q4-major' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 
COLLECT_GCC_OPTIONS='-v' '-E'
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
ignoring duplicate directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.2.1/include"
ignoring nonexistent directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.2.1/include-fixed"
ignoring duplicate directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
End of search list.
COMPILER_PATH=/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-E'
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:42: 0 - COMPILER_INCLUDE_PATHS
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include: 
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed: 
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/newlib.h
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:44: 1 - NEWLIB_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:74: 2 - NEWLIB_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:82: 3 - NEWLIB_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:98: 4 - NEWLIB_NANO_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/newlib-nano
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/c++/
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/machine/
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/newlib-nano/
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/sys/
APPLICATION: tests_libc_newlib

supported boards:
acd52832 airfy-beacon arduino-due arduino-duemilanove arduino-mega2560 arduino-mkr1000 arduino-mkrfox1200 arduino-mkrzero arduino-uno arduino-zero avsextrem b-l072z-lrwan1 b-l475e-iot01a bluepill calliope-mini cc2538dk cc2650-launchpad cc2650stk ek-lm4f120xl f4vi1 feather-m0 fox frdm-k22f frdm-k64f frdm-kw41z hifive1 ikea-tradfri iotlab-a8-m3 iotlab-m3 jiminy-mega256rfr2 limifrog-v1 maple-mini mbed_lpc1768 mega-xplained microbit msb-430 msb-430h msba2 msbiot mulle native nrf51dongle nrf52840dk nrf52dk nrf6310 nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 nucleo-f070rb nucleo-f072rb nucleo-f091rc nucleo-f103rb nucleo-f207zg nucleo-f302r8 nucleo-f303k8 nucleo-f303re nucleo-f303ze nucleo-f334r8 nucleo-f401re nucleo-f410rb nucleo-f411re nucleo-f412zg nucleo-f413zh nucleo-f429zi nucleo-f446re nucleo-f446ze nucleo-f722ze nucleo-f746zg nucleo-f767zi nucleo-l031k6 nucleo-l053r8 nucleo-l073rz nucleo-l152re nucleo-l432kc nucleo-l433rc nucleo-l452re nucleo-l476rg nucleo-l496zg nz32-sc151 opencm904 openmote-cc2538 pba-d-01-kw2x pic32-clicker pic32-wifire remote-pa remote-reva remote-revb ruuvitag samd21-xpro saml21-xpro samr21-xpro seeeduino_arch-pro slstk3401a slstk3402a sltb001a slwstk6000b slwstk6220a sodaq-autonomo sodaq-explorer spark-core stk3600 stk3700 stm32f0discovery stm32f3discovery stm32f429i-disc1 stm32f4discovery stm32f769i-disco stm32l476g-disco stm32mindev teensy31 telosb thingy52 ublox-c030-u201 udoo waspmote-pro wsn430-v1_3b wsn430-v1_4 yunjia-nrf51822 z1

BOARD:   samr21-xpro
CPU:     samd21
MCU:     samd21

RIOTBASE:  /Volumes/devel/github/smlng/RIOT
RIOTBOARD: /Volumes/devel/github/smlng/RIOT/boards
RIOTCPU:   /Volumes/devel/github/smlng/RIOT/cpu
RIOTPKG:   /Volumes/devel/github/smlng/RIOT/pkg

DEFAULT_MODULE: auto_init board core core_msg cpu sys
DISABLE_MODULE: 
USEMODULE:      cortexm_common cortexm_common_periph embunit isrpipe newlib newlib_nano newlib_syscalls_default periph periph_common periph_gpio periph_pm periph_uart pm_layered sam0_common_periph tsrb uart_stdio

ELFFILE: /Volumes/devel/github/smlng/RIOT/tests/libc_newlib/bin/samr21-xpro/tests_libc_newlib.elf
HEXFILE: /Volumes/devel/github/smlng/RIOT/tests/libc_newlib/bin/samr21-xpro/tests_libc_newlib.bin

FEATURES_REQUIRED (excl. optional features):
         periph_uart
FEATURES_OPTIONAL (strictly "nice to have"):
         periph_gpio periph_pm
FEATURES_PROVIDED (by the board or USEMODULE'd drivers):
         cpp periph_adc periph_cpuid periph_flashpage periph_flashpage_raw periph_gpio periph_i2c periph_pm periph_pwm periph_rtc periph_rtt periph_spi periph_timer periph_uart puf_sram
FEATURES_MISSING (incl. optional features):
         -none-
FEATURES_MISSING (only non-optional features):
         -none-

FEATURES_CONFLICT:     
FEATURES_CONFLICT_MSG: 

INCLUDES: 
	-isystem  
	/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/newlib-nano  
	-I/Volumes/devel/github/smlng/RIOT/core/include  
	-I/Volumes/devel/github/smlng/RIOT/drivers/include  
	-I/Volumes/devel/github/smlng/RIOT/sys/include  
	-I/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/samd21/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/sam0_common/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/include  
	-I/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/include/vendor  
	-I/Volumes/devel/github/smlng/RIOT/sys/libc/include

CC:      arm-none-eabi-gcc
CFLAGS: 
	-Werror  
	-Wno-implicit-fallthrough  
	-mno-thumb-interwork  
	-mcpu=cortex-m0plus  
	-mlittle-endian  
	-mthumb  
	-mfloat-abi=soft  
	-march=armv6s-m  
	-ffunction-sections  
	-fdata-sections  
	-fno-builtin  
	-fshort-enums  
	-ggdb  
	-g3  
	-Os  
	-std=c99  
	-fno-delete-null-pointer-checks  
	-fdiagnostics-color  
	-Wstrict-prototypes  
	-Wold-style-definition  
	-fno-common  
	-Wall  
	-Wextra  
	-Wformat=2  
	-Wformat-overflow  
	-Wformat-truncation  
	-Wmissing-include-dirs  
	-include  
	/Volumes/devel/github/smlng/RIOT/tests/libc_newlib/bin/samr21-xpro/riotbuild/riotbuild.h

CXX:     arm-none-eabi-g++
CXXUWFLAGS: 
	-std=%  
	-Wstrict-prototypes  
	-Wold-style-definition
CXXEXFLAGS:

LINK:    arm-none-eabi-gcc
LINKFLAGS: 
	-L/Volumes/devel/github/smlng/RIOT/cpu/samd21/ldscripts  
	-L/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/ldscripts  
	-Tcortexm.ld  
	-Wl,--fatal-warnings  
	-mcpu=cortex-m0plus  
	-mlittle-endian  
	-mthumb  
	-mfloat-abi=soft  
	-march=armv6s-m  
	-ggdb  
	-g3  
	-Os  
	-static  
	-lgcc  
	-nostartfiles  
	-Wl,--gc-sections  
	-Wl,--defsym=_rom_start_addr=0x00000000  
	-Wl,--defsym=_ram_start_addr=0x20000000  
	-Wl,--defsym=_rom_length=0x40000  
	-Wl,--defsym=_ram_length=0x8000  
	-specs=nano.specs  
	-lc

OBJCOPY: /usr/local/bin/arm-none-eabi-objcopy
OFLAGS:  

FLASHER: /Volumes/devel/github/smlng/RIOT/dist/tools/edbg/edbg
FFLAGS:   -t atmel_cm0p -b -e -v -p -f /Volumes/devel/github/smlng/RIOT/tests/libc_newlib/bin/samr21-xpro/tests_libc_newlib.bin

TERMPROG:  /Volumes/devel/github/smlng/RIOT/dist/tools/pyterm/pyterm
TERMFLAGS: -p "/dev/tty.usbmodem1421" -b "115200"
PORT:      /dev/tty.usbmodem1421

DEBUGGER:       /Volumes/devel/github/smlng/RIOT/dist/tools/openocd/openocd.sh
DEBUGGER_FLAGS: debug

DOWNLOAD_TO_FILE:   /usr/local/bin/wget -nv -c -O
DOWNLOAD_TO_STDOUT: /usr/bin/curl -s
UNZIP_HERE:         /usr/bin/unzip -q

DEBUGSERVER:       /Volumes/devel/github/smlng/RIOT/dist/tools/openocd/openocd.sh
DEBUGSERVER_FLAGS: debug-server

RESET:       /Volumes/devel/github/smlng/RIOT/dist/tools/edbg/edbg
RESET_FLAGS:  -t atmel_cm0p

MAKEFILE_LIST: 
	/Volumes/devel/github/smlng/RIOT/tests/libc_newlib/Makefile  
	/Volumes/devel/github/smlng/RIOT/tests/Makefile.tests_common  
	/Volumes/devel/github/smlng/RIOT/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/makefiles/docker.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/color.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/info-nproc.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/info.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/scan-build.inc.mk  
	/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/Makefile.features  
	/Volumes/devel/github/smlng/RIOT/cpu/samd21/Makefile.features  
	/Volumes/devel/github/smlng/RIOT/cpu/sam0_common/Makefile.features  
	/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/Makefile.features  
	/Volumes/devel/github/smlng/RIOT/makefiles/pseudomodules.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/defaultmodules.inc.mk  
	/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/makefiles/boards/sam0.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/tools/serial.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/tools/edbg.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/tools/openocd.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/tools/openocd-adapters/dap.inc.mk  
	/Volumes/devel/github/smlng/RIOT/cpu/samd21/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/cpu/sam0_common/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/makefiles/arch/cortexm.inc.mk  
	/Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/makefiles/toolchain/gnu.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/tools/gdb.inc.mk  
	/Volumes/devel/github/smlng/RIOT/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/sys/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/drivers/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/boards/samr21-xpro/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/sys/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/drivers/Makefile.dep  
	/Volumes/devel/github/smlng/RIOT/makefiles/cflags.inc.mk  
	/Volumes/devel/github/smlng/RIOT/sys/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk  
	/Volumes/devel/github/smlng/RIOT/sys/newlib_syscalls_default/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/drivers/Makefile.include  
	/Volumes/devel/github/smlng/RIOT/makefiles/bindist.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/modules.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/vars.inc.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/tools/targets.inc.mk  
	/Volumes/devel/github/smlng/RIOT/dist/tools/desvirt/Makefile.desvirt  
	/Volumes/devel/github/smlng/RIOT/makefiles/mcuboot.mk  
	/Volumes/devel/github/smlng/RIOT/makefiles/murdock.inc.mk

and compiling

BOARD=samr21-xpro make -C tests/libc_newlib/ clean all 
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /Users/build/work/GCC-7-build/src/gcc/configure --target=arm-none-eabi --prefix=/Users/build/work/GCC-7-build/install-native --libexecdir=/Users/build/work/GCC-7-build/install-native/lib --infodir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/Users/build/work/GCC-7-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/Users/build/work/GCC-7-build/install-native/arm-none-eabi --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --with-gmp=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-mpfr=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-mpc=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-isl=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-libelf=/Users/build/work/GCC-7-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-lstdc++ -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2017-q4-major' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 
COLLECT_GCC_OPTIONS='-v' '-E'
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
ignoring duplicate directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.2.1/include"
ignoring nonexistent directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.2.1/include-fixed"
ignoring duplicate directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
 /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
End of search list.
COMPILER_PATH=/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/:/usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-E'
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:42: 0 - COMPILER_INCLUDE_PATHS
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include: 
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed: 
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:43: 0 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/newlib.h
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:44: 1 - NEWLIB_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:74: 2 - NEWLIB_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:82: 3 - NEWLIB_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:98: 4 - NEWLIB_NANO_INCLUDE_DIR: /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/newlib-nano
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/c++/
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/machine/
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/newlib-nano/
/Volumes/devel/github/smlng/RIOT/makefiles/libc/newlib.mk:99: 4 - /usr/local/Caskroom/gcc-arm-embedded/7-2017-q4-major/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/sys/
Building application "tests_libc_newlib" for "samr21-xpro" with MCU "samd21".

"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/boards/samr21-xpro
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/core
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/cpu/samd21
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/cpu/cortexm_common
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/cpu/cortexm_common/periph
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/cpu/sam0_common
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/cpu/sam0_common/periph
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/cpu/samd21/periph
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/drivers
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/drivers/periph_common
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/auto_init
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/embunit
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/isrpipe
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/newlib_syscalls_default
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/pm_layered
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/tsrb
"/Library/Developer/CommandLineTools/usr/bin/make" -C /Volumes/devel/github/smlng/RIOT/sys/uart_stdio
   text	   data	    bss	    dec	    hex	filename
  10160	    140	   2764	  13064	   3308	/Volumes/devel/github/smlng/RIOT/tests/libc_newlib/bin/samr21-xpro/tests_libc_newlib.elf
Test: comparing addresses of 'printf' and 'iprintf' symbols
[SUCCESS] '000015c0' = '000015c0' is True

@cladmi
Copy link
Contributor Author

cladmi commented Aug 2, 2018

Thanks. I will squash and remove the debug commit for final reviews.

@cladmi cladmi force-pushed the pr/make/newlib/fixandstuff branch from 1257134 to 2c19189 Compare August 2, 2018 14:49
@cladmi cladmi removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Aug 2, 2018
@cladmi
Copy link
Contributor Author

cladmi commented Aug 2, 2018

I rebased and verified that the diff with the previous version is only removing debug messages. So ready for reviewing.

@cladmi
Copy link
Contributor Author

cladmi commented Aug 2, 2018

@vac If you are here could you reverify on windows too, just to be sure ?

cladmi added 6 commits August 2, 2018 17:05
When NEWLIB_INCLUDE_DIR is set from other parts than 'COMPILER_INCLUDE_PATHS' it
does not have a trailing slash.
Also, it makes it more problematic when supplying it from the command line.

And anyway having two '/' does not break anything.
As NEWLIB_INCLUDE_DIR has already been set here, with an empty value, it is not
overwriting it because of the '?='.
Only keep lines that are indeed include path.
It also keeps newlines as they do not matter.

It fixes Mingw32 support where `grep '^\s'` is not working the same way.
It also handles some mac `sed` that do not support `\s`.

Ouput tested with:

    make -C examples/hello-world BOARD=samr21-xpro info-debug-variable-COMPILER_INCLUDE_PATHS
    # by also putting newlines for readability

Now:

    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include

Before:

    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
Some versions of Mingw32 abspath implementation has trouble working with
windows formatted path.

    $(abspath "C:/A/B") returns "/C/CUR/DIR/C:/A/B" instead of "/C/A/B"

relpath does not have this problem, it does additional symlink resolution but is
not a problem.
Note: on windows it does not remove the trailing `/`.

zephyrproject-rtos/zephyr#2061 (comment)

Patched in

zephyrproject-rtos/zephyr@941059c
It replaces

    make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/

with

    make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
    /usr/arm-none-eabi/include

Without trailing slash and without relative '..' everywhere.

It also uses `realpath` instead of `abspath` to support Mingw32.
Comments inside an if are usually also indented.
@cladmi cladmi force-pushed the pr/make/newlib/fixandstuff branch from 2c19189 to 3226918 Compare August 2, 2018 15:07
@jcarrano
Copy link
Contributor

jcarrano commented Aug 2, 2018

Tested in Arch Linux, gcc and clang, for samr21-xpro. tests/libc_newlib is working fine.

Copy link
Contributor

@jcarrano jcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, but the script assumes GCC is present.

# Search for Newlib include directories

# Try to search for newlib in the standard search path of the compiler for includes
ifeq (,$(NEWLIB_INCLUDE_DIR))
COMPILER_INCLUDE_PATHS := $(shell $(PREFIX)gcc -v -x c -E /dev/null 2>&1 | grep '^\s' | tr -d '\n')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you assume GCC is installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@jcarrano jcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@jcarrano jcarrano added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Aug 2, 2018
@miri64 miri64 merged commit ccb5653 into RIOT-OS:master Aug 2, 2018
@miri64
Copy link
Member

miri64 commented Aug 2, 2018

Please provide a backport.

@cladmi
Copy link
Contributor Author

cladmi commented Aug 2, 2018

Backport provided in #9689

@cladmi cladmi deleted the pr/make/newlib/fixandstuff branch August 2, 2018 16:50
@vac
Copy link

vac commented Aug 2, 2018

I can confirm that it works fine on windows.

@cladmi
Copy link
Contributor Author

cladmi commented Aug 3, 2018

@vac Thank you.

@cladmi cladmi added the OS: Windows Host OS: This PR/issue concerns usage of RIOT with Windows as a host system label Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Community: help wanted The contributors require help from other members of the community OS: Windows Host OS: This PR/issue concerns usage of RIOT with Windows as a host system Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants