Skip to content

CMake: ninja reponse files disabled for ARMClang on Windows #13827

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

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Oct 28, 2020

Summary of changes

Issue https://gitlab.kitware.com/cmake/cmake/-/issues/21093

Until this is fixed, we should disable response files for ARMClang + ninja on Windows.
Other toolchains and host systems should benefit from response files thus not disabling them
completely.

This fixes the issue with not finding includes. It's not trivial to find the root cause, it took me a while to figure out why ARMClang can't find the paths.

I hope using host system to check is the proper one. My initial approach was to use WIN32 but this is set to false in my enviroment (using windows with CMder).

Hopefully we won't hit the win path limit anytime soon, otherwise this bug can become a blocker, it should be fixed one day soon.

@MarceloSalazar Please test locally as well if this fixes the issue for you.

Impact of changes

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[x] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 28, 2020

Wait a minute, I am still testing. It looks like this does not yet complete fixes the issue. Rebuilding the cache and entire tree takes time, so will need more than a minute to test the theory.

@ciarmcom ciarmcom requested a review from a team October 28, 2020 16:00
@ciarmcom
Copy link
Member

@0xc0170, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@0xc0170 0xc0170 force-pushed the feature-cmake-fix-ninja-armclang branch from 2e8d4fe to d3351ed Compare October 28, 2020 17:10
hugueskamba
hugueskamba previously approved these changes Oct 28, 2020
@MarceloSalazar
Copy link

Tested on Windows and I don't see the error about the includes. However, there are two problems:

  • Link Error: L6218E: Undefined symbol mbed_fault_context (referred from mbed-os\CMakeFiles\mbed-core.dir\platform\source\TARGET_CORTEX_M\TOOLCHAIN_ARM\except.o).
  • Compile time is huge (but we could live with it for a little while)

@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 29, 2020

The linker error I also saw, I'll look at it today.

Compile time is huge (but we could live with it for a little while)

It must be something with the license, as I am testing now again and the time is good again.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 29, 2020

I found the culprit . We fixed the issue in CMake but has not been released until 3.19.0 (currently rc2). I downloaded it and it links without an error.

I'll update now the version requirements.

@0xc0170 0xc0170 force-pushed the feature-cmake-fix-ninja-armclang branch from 5d51a57 to ac73e62 Compare October 29, 2020 10:06
@mergify mergify bot dismissed hugueskamba’s stale review October 29, 2020 10:07

Pull request has been modified.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 29, 2020

Rebased, squashed to two commits.

Using 3.19.0-rc2 ARMClang links without error on Windows with Ninja.

@MarceloSalazar @hugueskamba @rajkan01 Please review

@@ -3,7 +3,7 @@

# This is the boilerplate for Mbed OS

cmake_minimum_required(VERSION 3.18.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Travis will fail if it fetches from pip (this version not yet there unfortunately)

I can do:

        # Fetch the 3.19.0
        - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
        - mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
        - travis_retry wget --no-check-certificate https://cmake.org/files/v3.19/cmake-3.19.0-rc2-Linux-x86_64.tar.gz
        - tar -xvf cmake-3.19.0-rc2-Linux-x86_64.tar.gz > /dev/null
        - mv cmake-3.19.0-rc2-Linux-x86_64 cmake-install
        - PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH
        - cd ${TRAVIS_BUILD_DIR}

However this would be just partial fix for now. I'll talk to test team to include 3.19.0 in the jenkins and this can wait for CI update to land

@0xc0170 0xc0170 mentioned this pull request Oct 29, 2020
@MarceloSalazar
Copy link

MarceloSalazar commented Oct 29, 2020

I confirm the project compiles and links OK when using cmake 3.19.-rc2

@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 29, 2020

This will wait for #13477 to land


## How to build an application

Prerequisities:
- CMake >=3.18.2
- CMake >=3.19.0
- mbed-tools >=3.2.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

mbed-tools needs to be at least 3.4.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We haven't updated for a while. Updating now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed now

hugueskamba
hugueskamba previously approved these changes Oct 29, 2020
0xc0170 and others added 3 commits October 30, 2020 08:26
Issue https://gitlab.kitware.com/cmake/cmake/-/issues/21093

Until this is fixed, we should disable response files for ARMClang + ninja on Windows.
Other toolchains and host systems should benefit from response files thus not disabling them
completely.

This fixes the issue with not finding includes. It's not trivial to find the root cause, it took me a while to figure out why ARMClang can't find the paths.

I moved the check to Mbed OS main cmake. It should not be in the toolchain file as it is not
related to the toolchain but to generator. We need toolchain properly set up first.

Note, I had to protect setting CMAKE_NINJA_FORCE_RESPONSE_FILE. If I set it to 0, ninja
would still use rsp files so I rather protected it and define that variable only when
required, not always.

Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
@0xc0170 0xc0170 force-pushed the feature-cmake-fix-ninja-armclang branch from 331cdc4 to 79329c5 Compare October 30, 2020 08:26
@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 30, 2020

Rebased, Travis should now pass and I'll run Jenkins CI test

@mergify mergify bot dismissed hugueskamba’s stale review October 30, 2020 08:27

Pull request has been modified.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Oct 30, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Oct 30, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️

@0xc0170 0xc0170 removed the needs: CI label Oct 30, 2020
@0xc0170 0xc0170 merged commit 61e9b7e into ARMmbed:feature-cmake Oct 30, 2020
@0xc0170 0xc0170 deleted the feature-cmake-fix-ninja-armclang branch October 30, 2020 13:00
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