Infineon / core-make

Core make files and scripts for building and programming ModusToolbox applications.
Apache License 2.0
2 stars 4 forks source link

"Arguments too long" error when including a large number of files #1

Closed zst123 closed 2 years ago

zst123 commented 2 years ago

Prerequisites

Can you reproduce the problem reliably?

Yes

Did you check current release notes for known issues?

Not found in release notes

If this is not the latest release, have you checked newer releases?

Using version 1.8.0

Description:

When placing a folder with a large number of tiles, inside the project sources directory, the Makefile will iterate through all the sub-directories in the include path as well (this is what we want).

Unfortunately, this results in the following error "Argument list too long". The problem is caused due to build.mk (Found in ~/ModusToolbox/workspace/mtb_shared/core-make/release-v1.8.0/make/core/build.mk). To include all the dependencies, all the filenames are echoed into a rpt (report) file using command line parameters. Because there is a maximum limit for bash command line parameters, the process will fail if there are too many files included.

A possible fix will be to use the Makefile $file directive. The $file function is for the Makefile to write values directly to a file. With this, we do not depend on bash parameter expansion and thus do not have the issue of having too many arguments

See my github commit for possible fix

https://github.com/zst123/Element14_Low-Power-IoT/commit/f7e30b41c3e962c2d41a1b9b5be77976c9bfd499

Steps to Reproduce:

  1. Add many files into the "sources" directory

  2. Compile and see the error

Expected Result:

Project compiles successfully

Actual Result:

Project fails to compile with "Arguments too long" error

Frequency (1/1, 1/50, 1/100):

Always happens

Build/Commit:

v1.8.0

Target:

Host OS and Version:

Linux / Ubuntu 20.04.02 LTS

Compiler:

ModusToolbox version 2.3

Environment

More information of project is documented on my Element14 project page.

https://www.element14.com/community/community/design-challenges/low-power-iot/blog/2021/10/21/wearable-gesture-control-5-deploying-edge-impulse-model-fixing-a-makefile-issue

AlenAn14 commented 2 years ago

Hi @zst123 ,

I have raised an internal ticket for this bug and the same is expected to be resolved with the next release i.e. core-make version 2.0. Thank you for pointing out the same.

Warm Regards Alen

tomoveu commented 2 years ago

@AlenAn14 when could we expect the release of core-make version 2.0?

AlenAn14 commented 1 year ago

Hi @tomoveu ,

This fix will be available in the core-make version 3.0.0.

Regards Alen

tomoveu commented 1 year ago

@AlenAn14 The current version of core-make is 1.9.1. When would 3.0.0 come out?

AlenAn14 commented 1 year ago

Hi @tomoveu ,

The version 3.0 of core-make is expected to come out in September of 2022.

Warm Regards Alen

AlenAn14 commented 1 year ago

Hi @tomoveu , Can you please let me know if this issue has been resolved? I tried cloning the project here, and running it in ModusToolbox with core-make 1.9.1 and and not observing this error. I tried 1.8.0 as well and still did not observe this error. Have you made any changes in the code ? Can you please verify on this once.

tomoveu commented 1 year ago

@AlenAn14 I am a bit confused by the versioning. Are we now at core-make version 3.0 or 1.9.1? 😃

I'd be happy to test. This issue can be found on multiple threads in the Infineon forum with 1.8.0

AlenAn14 commented 1 year ago

I was using 1.9.1 with MTB2.4 today and then cloned your project into it, but the error is now not visible. Instead it build successfully. I also tried using 1.8.0, but was not able to reproduce the error.

tomoveu commented 1 year ago

@AlenAn14 I don't know about @zst123's project, but I believe he has also hardcoded the fix in his project when using 1.8.0. At least, this was the only fix we could come up - Add PREBUILD command in the Makefile.

AlenAn14 commented 1 year ago

What should I assign/the command to the PREBUILD flag?

I also tried creating multiple folders recursively in the project and put a required source file in the innermost folder. It was still able to get the .c file without throwing this error.

I tried in both Windows and Linux and with version 2.3 and 2.4 of MTB. Still not able to reproduce the issue.

tomoveu commented 1 year ago

@AlenAn14 sorry for the confusion, the fix is hardcoded in the build.mk of core-make like show here

mtb_shared/core-make/release-v1.8.0/make/core/build.mk

I am not familiar with the @zst123 project. We are using core-make v1.9.0 and the issue exists.

AlenAn14 commented 1 year ago

Hi @tomoveu , I have cloned the mtb_shared folder newly, so I do not have the fix in my build.mk file of core make. It is building successfully. Will it be possible for you to create a sample project that throws this error and share the same with me? Please share the mtb_shared folder used as well