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

Cygwin: repair NuttX build #8737

Merged
merged 2 commits into from
Jan 21, 2018
Merged

Cygwin: repair NuttX build #8737

merged 2 commits into from
Jan 21, 2018

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Jan 20, 2018

after 1f63d85

all the NuttX specific WINTOOL define handling was skipped in cmake Make.defs generation (#8573)
The Nuttx build is makfile based and needs its cygwin treatment (https://github.com/PX4-NuttX/nuttx/blob/b18053574bf41712cef93e31bf178518f451a350/configs/stm32f4discovery/scripts/Make.defs#L42-L56)

Additionally the ${PX4_SOURCE_DIR}/src/include which was added through cmake needs path conversion

The two root causes for the special handling are:

  • ARM GCC for Windows doesn't support cygwin paths passed as an argument
    so they need to be either relative or converted via cypath tool
  • Symbolic links are totally different under Windows and because NuttX uses them extensively
    it has special handling scripts that need to be fed with the correct defines

@dagar Now it's partly makefile ${shell ...} path conversion like NuttX did it before and partly cmake CYGPATH(...) conversion because you added ${PX4_SOURCE_DIR}/src/include via cmake. What do you think?

How was ${PX4_SOURCE_DIR}/src/include included before? It always found visibility.h so it was included but not in the CFLAGS...

I tested make px4fmu-v4_default and make px4fmu-v2_default and they run through fine with these changes.

EDIT: For reference the pull requests that made this necessary/possible: #7873 #8573

@MaEtUgR MaEtUgR added the bug label Jan 20, 2018
@MaEtUgR MaEtUgR self-assigned this Jan 20, 2018
@MaEtUgR MaEtUgR requested a review from dagar January 20, 2018 13:18
@MaEtUgR MaEtUgR force-pushed the cygwin-repair-nuttx branch from fe9b301 to 24a1b73 Compare January 20, 2018 13:39
all the NuttX specific WINTOOL define handling was skiped in cmake Make.defs generation
The Nuttx build is makfile based and needs its cygwin treatment

Additionally the ${PX4_SOURCE_DIR}/src/include which was added through cmake needs path conversion

The two root causes for the special handling are:
- ARM GCC for Windows doesn't support cygwin paths passed as an argument
  so they need to be either relative or converted via cypath tool
- Symbolic links are totally different under Windows and because NuttX uses them extensively
  it has special handling scripts that need to be fed with the correct defines
@MaEtUgR MaEtUgR force-pushed the cygwin-repair-nuttx branch 2 times, most recently from 6bd962b to 336a1b1 Compare January 20, 2018 14:35
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jan 20, 2018

@dagar Now it's completely relying on cmake for the paths and using only the existing makefile defines for the symbolic links (which have no else case).

@LorenzMeier
Copy link
Member

Let’s see what CI says!

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jan 20, 2018

@LorenzMeier With the first commit it worked. I'm currently discussing with @dagar in slack about the TOPDIR.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jan 20, 2018

Looks like the second commit wasn't the best idea...

@@ -33,8 +33,8 @@
#
############################################################################

include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include ${NUTTX_DIR}/.config
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to preserve this to make NuttX happy?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can switch all back to TOPDIR, let me fix the second commit.

@MaEtUgR MaEtUgR force-pushed the cygwin-repair-nuttx branch from 336a1b1 to 691b693 Compare January 20, 2018 16:37
differentiate between WINTOOL define (MSYS & cygwin) and cygwin using uname command:
- MSYS needs symbolic link handling for ARM GCC but no path conversion
- Cygwin needs both
@MaEtUgR MaEtUgR force-pushed the cygwin-repair-nuttx branch from 691b693 to dab3233 Compare January 20, 2018 16:39
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jan 20, 2018

@dagar I

  • switched back to TOPDIR to stay consistent with NuttX makefiles
  • made all paths including ${PX4_SOURCE_DIR}/src/include get converted inside Make.defs.in to avoid "random" distributed CYGPATH(...) calls on the cmake side and mixing cmake/makefile conversions.
  • distinguish between WINTOOL and cygwin by uname because MSYS doesn't need path conversions as can be seen from the former inconsistently present and now extinguished PX4_WINTOOL flag e.g. here https://github.com/PX4/Firmware/pull/8573/files#diff-448a70691f32c68b10e9ea554463d3feL89
    This way I can also save the inconvenient extra define WINTOOL in the toolchain setup which can easily get forgotten when you set it up manually.

@dagar dagar merged commit 463217a into master Jan 21, 2018
@dagar dagar deleted the cygwin-repair-nuttx branch January 21, 2018 04:26
@MaEtUgR MaEtUgR mentioned this pull request Jan 21, 2018
@MaEtUgR MaEtUgR mentioned this pull request Sep 13, 2020
14 tasks
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.

3 participants