Mbed-os: Compiling error with GCC toolchain (K64F)

Created on 16 Mar 2017  路  8Comments  路  Source: ARMmbed/mbed-os

Description

  • Type: Bug
  • Related issue: compiler
  • Priority: Blocker

Bug

Target
K64F

Environment:
Windows/msys2/python2.7.11/pip9.0.1
install other tools : "pip install -r mbed-os-5.4.1/requirements.txt"

Toolchain:
GCC_ARM

Toolchain version:
4.9

mbed-cli version:
(mbed --version) : 1.0.0

meed-os sha:
(git log -n1 --oneline) : f4864dc6429e1ff5474111d4e0f6bee36a759b1c (Release ver: 5.4.1)

Expected behavior
Compile the code with GCC_ARM

Actual behavior
Compiling error:

[Fatal Error] AnalogIn.cpp@17,30: drivers/AnalogIn.h: No such file or directory
[DEBUG] Return: 1
[DEBUG] Output: ./drivers\AnalogIn.cpp:17:30: fatal error: drivers/AnalogIn.h: No such file or directory
[DEBUG] Output:  #include "drivers/AnalogIn.h"
[DEBUG] Output:                               ^
[DEBUG] Output: compilation terminated.
Traceback (most recent call last):
  File "E:\mbed\mbed-os-5.4.1\tools\make.py", line 285, in <module>
    toolchain))
  File "E:\mbed\mbed-os-5.4.1\tools\build_api.py", line 512, in build_project
    objects = toolchain.compile_sources(resources, resources.inc_dirs)
  File "E:\mbed\mbed-os-5.4.1\tools\toolchains\__init__.py", line 824, in compile_sources
    return self.compile_queue(queue, objects)
  File "E:\mbed\mbed-os-5.4.1\tools\toolchains\__init__.py", line 887, in compile_queue
    raise ToolException(err)
ToolException: ./drivers\AnalogIn.cpp:17:30: fatal error: drivers/AnalogIn.h: No such file or directory
 #include "drivers/AnalogIn.h"
                              ^
compilation terminated.

Steps to reproduce

$ cd mbed-os-5.4.1
$ mbed compile -m K64F -t GCC_ARM --source TESTS/integration/basic --source ./ 
closed_in_jira tools mirrored tracking bug

All 8 comments

Updated

While I change my command:

$ mbed compile -m K64F -t GCC_ARM --source TESTS/integration/basic --source .

That's OK. So the directory --source . can be parsed by GCC tools, --source ./ is not.

In addition, there is no problem for ARM compiler.

@RdaZhongyao Thanks for the update, its more clear now.

@theotherjimmy Please have a look

I cannot reproduce the issue.

mbed compile -t GCC_ARM -m K64F --source TESTS/integration/basic --source ./

produces

Compile [ 99.7%]: main.cpp
Compile [100.0%]: test_env.cpp
Link: mbed
Elf2Bin: mbed
+-----------+-------+-------+-------+
| Module    | .text | .data |  .bss |
+-----------+-------+-------+-------+
| Fill      |   112 |     4 |  2401 |
| Misc      | 44417 |  2556 |  8143 |
| Subtotals | 44529 |  2560 | 10544 |
+-----------+-------+-------+-------+
Allocated Heap: 24576 bytes
Allocated Stack: unknown
Total Static RAM memory (data + bss): 13104 bytes
Total RAM memory (data + bss + heap + stack): 37680 bytes
Total Flash memory (text + data + misc): 48129 bytes

Image: ./BUILD/k64f/gcc_arm/mbed-os.bin

Maybe the differrent environments produce differrent results. I use Windows/Python2.7.11/GCC4.9.

mbed compile -t GCC_ARM -m K64F --source TESTS/integration/basic --source ./

produces

Building project basic (K64F, GCC_ARM)
Scan: basic
Scan:
Scan: FEATURE_BLE
Scan: FEATURE_COMMON_PAL
Scan: FEATURE_LWIP
Scan: FEATURE_UVISOR
Scan: FEATURE_ETHERNET_HOST
Scan: FEATURE_LOWPAN_BORDER_ROUTER
Scan: FEATURE_LOWPAN_HOST
Scan: FEATURE_LOWPAN_ROUTER
Scan: FEATURE_NANOSTACK
Scan: FEATURE_NANOSTACK_FULL
Scan: FEATURE_THREAD_BORDER_ROUTER
Scan: FEATURE_THREAD_END_DEVICE
Scan: FEATURE_THREAD_ROUTER
Scan: FEATURE_STORAGE
Scan: env
Scan: mbed
Compile [  0.3%]: AnalogIn.cpp
[Fatal Error] AnalogIn.cpp@17,30: drivers/AnalogIn.h: No such file or directory
[ERROR] ./drivers\AnalogIn.cpp:17:30: fatal error: drivers/AnalogIn.h: No such file or directory
 #include "drivers/AnalogIn.h"
                              ^
compilation terminated.

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u E:\mbed\mbed-os-5.4.1\tools\make.py -t GCC_ARM -m K64F --source TESTS/integration/basic --source ./ --build .\BUILD\K64F\GCC_ARM" in "E:\mbed\mbed-os-5.4.1"
---

After this, a file named .includes_628003686ef9dbaf11132ab7ae6dbd2e.txt is generated in dir BUILD/K64F/GCC_ARM/, read the file:

$ cat BUILD/K64F/GCC_ARM/.includes_628003686ef9dbaf11132ab7ae6dbd2e.txt
-I./ -I./cmsis -I./cmsis/TOOLCHAIN_GCC -I./drivers -I./events -I./events/equeue ......

Then I modify the file from -I./ to -I.

$ cat BUILD/K64F/GCC_ARM/.includes_628003686ef9dbaf11132ab7ae6dbd2e.txt
-I. -I./cmsis -I./cmsis/TOOLCHAIN_GCC -I./drivers -I./events -I./events/equeue ......

Run compiling command again

mbed compile -t GCC_ARM -m K64F --source TESTS/integration/basic --source ./

produces

Compile [ 99.7%]: main.cpp
Compile [100.0%]: test_env.cpp
Link: basic
Elf2Bin: basic
+-----------+-------+-------+-------+
| Module    | .text | .data |  .bss |
+-----------+-------+-------+-------+
| Fill      |   112 |     4 |  2145 |
| Misc      | 46959 |  2292 |  8143 |
| Subtotals | 47071 |  2296 | 10288 |
+-----------+-------+-------+-------+
Allocated Heap: 24576 bytes
Allocated Stack: unknown
Total Static RAM memory (data + bss): 12584 bytes
Total RAM memory (data + bss + heap + stack): 37160 bytes
Total Flash memory (text + data + misc): 50407 bytes

Image: .\BUILD\K64F\GCC_ARM\basic.bin

@theotherjimmy anything can help?

I was able to reproduce it (windows machine) the same as above:mbed compile -t GCC_ARM -m K64F --source TESTS/integration/basic --source ./ this fails, if I change the last one to . only, compiles.

thanks @RdaZhongyao for the debug information. That will help trace this back to a solution.

This definitely looks like a bug. I'll see what I can do about it.

ARM Internal Ref: IOTMORF-938

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DuyTrandeLion picture DuyTrandeLion  路  3Comments

drahnr picture drahnr  路  4Comments

bcostm picture bcostm  路  4Comments

pilotak picture pilotak  路  3Comments

1domen1 picture 1domen1  路  3Comments