-
Notifications
You must be signed in to change notification settings - Fork 7.4k
POSIX api are incompatible with arm gcc 2018q2 toolchain #12224
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
Comments
@aescolar : FYI |
I'm trying to make the Apple Swift programming language running on arm based microcontrollers now. In order to achieve that, I need to do follow steps:
I'm struggling with step 2 right now. It's a little frustrating for the incompatibility problem. Because I have to link many different pieces carefully. Would you guys give me some advices on this. Thanks very much. |
@madandylau: Thanks for the detailed bug report! But you seem to missed the most important part.
Which conflicting type problems exactly? Please quote the error messages. |
And you report issues with arm gcc. Any reason you don't use Zephyr SDK's toolchain? |
@pfalcon Yes, the toolchain I used is from here. First, I need to compile the Swift runtime(which is written in C++) with Clang, and link them with libstdc++ which provided by the arm gcc toolchain. This is the main reason. Secondly, I want to create an Arduino like IDE but for Swift language later. Seems the arm gcc toolchain has a better support for Windows and Mac OS environment right now. That's very important for my project. Here is the diagnoses:
I try to fix this myself, but it just comes out more and more errors. During my debugging, I find the newlib 2.4.0 and 3.0.0 have some tiny differences. I don't know if this a big problem. For example, here is the disassembly of _close_r from the sdk's libc.a:
It jumps to "close" function And here is the disassembly of _close_r from the arm gcc toolchain:
It jumps to "_close" function. |
I am tot an expert in compiler related stuff. Please re-assign. |
@youvedeep: FYI |
@madandylau Can you apply this patch. It will likely move you to the next error. When you get that error, can you copy the gcc command that failed and add "-H" to the options and provide the output? |
Another ticket related to POSIX API issues with specific action items: #12965 . (No claims it would help here, just cross-linking related issues.) |
@galak, regarding this, I think that we should concentrate on making POSIX subsys to work well with Zephyr's own SDK first (and there're enough issues there). So, I'd suggest to that this as prio: low. |
This needs to compile, which it currently does with the SDK, so recommend maintaining priority. |
@nslowell , sorry for this late reply. I download the new 1.14.0-rc1 version and did the test you mentioned. When I run ninja, the output are as follows:
When I add "-H" to the failed command, the output are as follows:
|
Yup, that's what I'm seeing. You'll notice this near the bottom of the -H output: . ../../../include/posix/unistd.h is incorrect and what I believe is the cause of all the trouble. For some reason the #include_next is looking back at itself instead of finding the sys/types.h in the system directory. It works correctly with older GCCs. Still not sure what the problem is or if there's a way to fix it. |
Both SDK 0.10.0-beta2 and the ARM gcc 2018q2 run into a build issue with newlib and conflict definitions of mode_t type. First we need to add some ifdef protection if mode_t is already defined and set _MODE_T_DECLARED if we are the first to define it. Secondarily, we rename include/posix/sys/types.h to include/posix/posix_types.h so that we aren't getting a name collusion with the system sys/types.h and that we can easily and clearily include it (which we need to do to pull in the info from newlib). Fixes: zephyrproject-rtos#12224 Signed-off-by: Kumar Gala <[email protected]>
@galak When I include both <stdio.h> and <posix/mqueue.h>, the similar error comes out.
|
@kelvincheung that should be fixed in #13685 |
Was seeing that and thus removed / renamed posix/sys/types.h to posix/posix_types.h |
Describe the bug
I made a simple pthread demo based on the hello_world sample.(The current git version of Zephyr is used) Below is the main.c source code:
Compiling with zephyr sdk 0.9.5
The code works very well when compiling with zephyr sdk 0.9.5. Here is the detailed step:
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR="my_sdk_path"
Check "C Library ---> Build with newlib c library"
Check "C Library ---> Send stdout to console"
Check "Additional libraries ---> POSIX APIs"
Check "Additional libraries ---> POSIX PTHREAD IPC API"
Compiling with gcc-arm-none-eabi-7-2018-q2-update
Steps are almost the same except step 1:
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
export GNUARMEMB_TOOLCHAIN_PATH="my_arm_toolchain_path"
export ZEPHYR_SDK_INSTALL_DIR="my_sdk_path"
When compiling, there comes a lot of conflicting type problems. I try to fix it by myself. But after hours trying. I find that the incompatibility is too complicated for me to handle.
I think the main reason is that the arm gcc 2018q2 toolchain use newlib of version 3.0.0. But zephyr sdk use the version 2.4.0.
Do you guys have any idea what should I do? Thanks and merry christmas : )
Environment
The text was updated successfully, but these errors were encountered: