Skip to content

tools: fix toolchain extend inc paths #4749

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

Merged
merged 1 commit into from
Jul 13, 2017
Merged

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Jul 12, 2017

inc paths might be a list or might not be (just single string). If they don't, we are ending up with non valid include paths (one letter include paths).
This as result would not compile.

As inc_dirs might be just D:/SomePath, extend this would lead to producing [D, :, S..........] thus we were not able to compile with tools/build.py for instance. This is an example I was seeing
[DEBUG] INC DIRS: ['C', ':', '\\', 'C', 'o', 'd', 'e', '\\', 'm', 'b', 'e', 'd', '-', 'o', 's', '\\', 'B', 'U', 'I', 'L', 'D', '\\', 'm', 'b', 'e', 'd', '\\', '.', 't', 'e', 'm', 'p', '\\', 'T', 'A', 'R', 'G', 'E', 'T', '_', 'N', 'U', 'C', 'L', 'E', 'O', '_', 'F', '4', '1', '1', 'R', 'E', '\\', 'T', 'O', 'O', 'L', 'C', 'H', 'A', 'I', 'N', '_', 'I', 'A', 'R']

@jeromecoutant This should fix the issue you were seeing today with IAR

@theotherjimmy please review, we handle inc dirs in scan resources similarly, might be better to always consider this as a list, or hack like this. You can take this patch and just push to my branch.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jul 12, 2017

Without this patch, we would get

[DEBUG] Return: 3
Traceback (most recent call last):
  File "tools/build.py", line 212, in <module>
    build_profile=profile)
  File "mbed-os\tools\build_api.py", line 1014, in build_mbed_libs
    objects = toolchain.compile_sources(resources, tmp_path)
  File "mbed-os\tools\toolchains\__init__.py", line 908, in compile_sources
    return self.compile_seq(queue, objects)
  File "mbed-os\tools\toolchains\__init__.py", line 922, in compile_seq
    res['command']
  File "mbed-os\tools\toolchains\__init__.py", line 1064, in compile_output
    raise ToolException(_stderr)
ToolException

@bridadan This looks similar to what we seen with CI in the last 2 days, this might fix it ! However I wonder why this problem has not been seen earlier.

@jeromecoutant
Copy link
Collaborator

Verified
Thx

@0xc0170 0xc0170 requested a review from theotherjimmy July 12, 2017 14:01
@@ -863,7 +863,10 @@ def compile_sources(self, resources, inc_dirs=None):

inc_paths = resources.inc_dirs
if inc_dirs is not None:
inc_paths.extend(inc_dirs)
if type(inc_dirs) == ListType:
Copy link
Contributor

Choose a reason for hiding this comment

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

A more current pythonic way to do this is:

if isinstance(inc_dirs, list):

Please use that form.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

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

Meant to request changes. :(

@theotherjimmy
Copy link
Contributor

I think that the confusion came from the fact that the argument is plural, implying an unordered set of include directories.

inc paths might be a list or might not be (just single string). If they don't, we are ending up with non valid include paths (one letter include paths).
This as result would not compile.
@0xc0170
Copy link
Contributor Author

0xc0170 commented Jul 12, 2017

Fixed, rebased

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

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

Awesome. Thanks!

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jul 12, 2017

/morph test

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jul 12, 2017

/morph export-build

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 86

All exports and builds passed!

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 794

Test failed!

@studavekar
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 795

All builds and test passed!

@0xc0170 0xc0170 merged commit 8148329 into ARMmbed:master Jul 13, 2017
@0xc0170 0xc0170 deleted the fix_inc_paths branch July 13, 2017 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants