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

sh:Enhanced compilation system #11303

Merged
merged 2 commits into from Dec 4, 2023
Merged

Conversation

crafcat7
Copy link
Contributor

@crafcat7 crafcat7 commented Dec 1, 2023

Summary

While simplifying some of the Simulator-based configurations, I found one area that could be improved - I added an extra layer to retrieve paths at compile time.
This means that we can extract the script and include paths to the common directory, and in common we only need to store some private files for configuration.

Impact

Added a layer of path searching, now common is placed in a flat directory with board, if there is no include / script stored in the board directory, then it will look in common.

Testing

Based on this change, the local board path accomplishes the desired goal and does not affect configurations such as sim:nsh

In this change, if board/include and board/script are not found, they will be looked for again in the upper level of common.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
tools/Unix.mk Outdated Show resolved Hide resolved
@acassis
Copy link
Contributor

acassis commented Dec 3, 2023

@crafcat7 did you compare the build time before and after this modification?

@crafcat7
Copy link
Contributor Author

crafcat7 commented Dec 3, 2023

@crafcat7 did you compare the build time before and after this modification?

I'm not so sure my method of comparison is accurate the way I do it:

  1. . /tools/configure.sh -l sim:nsh
  2. time make

The resulting data is as follows:
Before: modification: make 38.68s user 15.02s system 107% cpu 49.926 total
After: make 38.85s user 14.89s system 107% cpu 49.927 total

Meanwhile, considering that there might be some calculation error when running, I tried it several times, and it's around +- 1s.
So it looks like the impact on compile time should be relatively small.

tools/configure.sh Show resolved Hide resolved
tools/Unix.mk Show resolved Hide resolved
tools/Unix.mk Show resolved Hide resolved
…ents

Avoid splicing paths to /include when BOARD_COMMON_DIR does not exist
and enhanced Windows native compilation

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
@crafcat7
Copy link
Contributor Author

crafcat7 commented Dec 4, 2023

I have encountered a problem. I tried to go and compile Native’s NuttX in my local Windows environment before making the changes, but it looks like there are some issues, so I can’t verify that the commits are correct after the changes.
Here's the scene of the problem I encountered

$ ./tools/configure.bat sim:nsh
-bash: ./tools/configure.bat: No such file or directory

/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
process_begin: CreateProcess(D:\cygwin\bin\cc, cc -O2 -Wall -Wstrict-prototypes -Wshadow -DHAVE_STRTOK_C=1 -DHAVE_STRTOK_C=1 -o incdir incdir.c, ...) failed.
make (e=5):
make: *** [incdir] Error 5
tools/version.sh: line 19: $'\r': command not found
tools/version.sh: line 21: $'\r': command not found
tools/version.sh: line 23: $'\r': command not found
tools/version.sh: line 26: $'\r': command not found
tools/version.sh: line 30: $'\r': command not found
tools/version.sh: line 32: syntax error near unexpected token `$'in\r''
'ools/version.sh: line 32: `  case $1 in
mv: cannot stat '.version.tmp': No such file or directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
/usr/bin/sh: line 1: /dev/null\: Not a directory
process_begin: CreateProcess(D:\cygwin\bin\cc, cc -O2 -Wall -Wstrict-prototypes -Wshadow -DHAVE_STRTOK_C=1 -DHAVE_STRTOK_C=1 -o incdir incdir.c, ...) failed.
make (e=5):
make[1]: *** [incdir] Error 5
tools/version.sh: line 19: $'\r': command not found
tools/version.sh: line 21: $'\r': command not found
tools/version.sh: line 23: $'\r': command not found
tools/version.sh: line 26: $'\r': command not found
tools/version.sh: line 30: $'\r': command not found
tools/version.sh: line 32: syntax error near unexpected token `$'in\r''
'ools/version.sh: line 32: `  case $1 in
mv: cannot stat '.version.tmp': No such file or directory
D:\cygwin\home\crafcat7\nuttxspace\nuttx\tools\unlink.sh: line 21: $'\r': command not found
D:\cygwin\home\crafcat7\nuttxspace\nuttx\tools\unlink.sh: line 23: $'\r': command not found
D:\cygwin\home\crafcat7\nuttxspace\nuttx\tools\unlink.sh: line 25: $'\r': command not found
D:\cygwin\home\crafcat7\nuttxspace\nuttx\tools\unlink.sh: line 56: syntax error: unexpected end of file
tools/Unix.mk:406: recipe for target 'clean_dirlinks' failed
make[1]: *** [clean_dirlinks] Error 2
tools/Unix.mk:778: recipe for target 'distclean' failed
make: *** [distclean] Error 2

@xiaoxiang781216 xiaoxiang781216 merged commit eee3af9 into apache:master Dec 4, 2023
26 checks passed
@xiaoxiang781216
Copy link
Contributor

let's keep the code sync between Windows and Linux, the native Windows build need more work.

@jerpelea jerpelea added this to To-Add in Release Notes - 12.4.0 Dec 27, 2023
@jerpelea jerpelea moved this from To-Add to processed in Release Notes - 12.4.0 Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants