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

toolchain: make toochain include path available to zephyr #8944

Closed

Conversation

nashif
Copy link
Member

@nashif nashif commented Jul 16, 2018

The include path is not available to Zephyr by default, this is contrary
to any other toolchain we use. For example unistd.h and friends are
available to Zephyr when building using xtools or embedded arm
toolchain, but not with the Zephyr SDK. This has been forcing us to
carry our own headers in the minimal c library.

Signed-off-by: Anas Nashif [email protected]

Copy link
Member

@carlescufi carlescufi left a comment

Choose a reason for hiding this comment

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

Looks definitely like an oversight when we were overwriting TOOLCHAIN_INCLUDES

@codecov-io
Copy link

codecov-io commented Jul 16, 2018

Codecov Report

Merging #8944 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8944   +/-   ##
=======================================
  Coverage   53.23%   53.23%           
=======================================
  Files         210      210           
  Lines       25800    25800           
  Branches     5677     5677           
=======================================
  Hits        13735    13735           
  Misses       9755     9755           
  Partials     2310     2310

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed5139a...967bd01. Read the comment docs.

@nashif
Copy link
Member Author

nashif commented Jul 16, 2018

That one failure we get is exactly the problem we have where things work with one toolchain and not the other because of the header confusion.

@galak
Copy link
Collaborator

galak commented Jul 16, 2018

That one failure we get is exactly the problem we have where things work with one toolchain and not the other because of the header confusion.

So I'm not sure this makes sense. We should be using the headers associated with the libc we are using. So if we are building with newlib we'd use those, if we are building with minimal libc we should grab those headers. It seems with this change we are mixing the two.

Copy link
Collaborator

@galak galak left a comment

Choose a reason for hiding this comment

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

This change doesn't seem right. We are mixing headers from two different libc which seems like just subject to problems.

@nashif
Copy link
Member Author

nashif commented Jul 16, 2018

So I'm not sure this makes sense. We should be using the headers associated with the libc we are using.

We should be using the headers that come with the toolchain. Now the implementation of the libc (minimal lib or anything else) whether it is the one in the toolchain or a local one is a different story. This is how toolchains (other than the one we have in the zephyr sdk) are configured.

This change doesn't seem right. We are mixing headers from two different libc which seems like just subject to problems.

Most of the headers we have as part minimal libc should be removed, we have been adding empty files and duplication of headers due to this bug.

@nashif
Copy link
Member Author

nashif commented Jul 16, 2018

btw, try building samples/subsys/ipc/openamp with gccarmemb, it will fail because the arm toolchain even with minimal libc enabled does provide the headers of the libc built with the toolchain, i.e. newlib.

This all sounds and looks wrong, but we have been adding ad-hoc headers to support features, for example posix APIs (in include/posix), empty headers such as lib/libc/minimal/include/sys/cdefs.h and incomplete headers in other places.

@galak
Copy link
Collaborator

galak commented Jul 17, 2018

btw, try building samples/subsys/ipc/openamp with gccarmemb, it will fail because the arm toolchain even with minimal libc enabled does provide the headers of the libc built with the toolchain, i.e. newlib.

This all sounds and looks wrong, but we have been adding ad-hoc headers to support features, for example posix APIs (in include/posix), empty headers such as lib/libc/minimal/include/sys/cdefs.h and incomplete headers in other places.

Agree, this seems really wrong. What happens if you configure gcc w/o newlib? Do you still get a set of C headers?

@nashif
Copy link
Member Author

nashif commented Jul 17, 2018

Agree, this seems really wrong. What happens if you configure gcc w/o newlib? Do you still get a set of C headers?

There are a few headers that come from gcc, without newlib being built, you will have among others:

float.h
gcov.h
iso646.h
stdalign.h
stdarg.h
stdatomic.h
stdbool.h
stddef.h
stdfix.h
stdint-gcc.h
stdint.h
stdnoreturn.h
tgmath.h
unwind.h
varargs.h

with newlib, you will get all the newlib headers obviously.

@nashif nashif force-pushed the toolchain_include_path branch from b356387 to ee1fc21 Compare July 25, 2018 14:19
@nashif nashif added the DNM This PR should not be merged (Do Not Merge) label Jul 25, 2018
Copy link
Member

@aescolar aescolar left a comment

Choose a reason for hiding this comment

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

Nothing against from my side.

@@ -25,7 +25,6 @@

#ifdef CONFIG_PTHREAD_IPC

#define timespec zap_timespec
Copy link
Member

Choose a reason for hiding this comment

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

Why did you chose to remove this one? (it should work both with and without it)

nashif added 3 commits October 9, 2018 22:48
The include path is not available to Zephyr by default, this is contrary
to any other toolchain we use. For example unistd.h and friends are
available to Zephyr when building using xtools or embedded arm
toolchain, but not with the Zephyr SDK. This has been forcing us to
carry our own headers in the minimal c library.

Signed-off-by: Anas Nashif <[email protected]>
Remove headers that are available through toolchain and integrated libc.

Signed-off-by: Anas Nashif <[email protected]>
board_output_number expects u32_t

Signed-off-by: Anas Nashif <[email protected]>
nashif added 2 commits October 9, 2018 22:49
Fix int type causing issues when built with newlib headers.

Signed-off-by: Anas Nashif <[email protected]>
Fix printf specifiers with newlib.

Signed-off-by: Anas Nashif <[email protected]>
@nashif
Copy link
Member Author

nashif commented Jan 10, 2019

will be resolved with sdk-ng

@nashif nashif closed this Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNM This PR should not be merged (Do Not Merge)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants