Author Topic: command line lenght limit on Windows  (Read 2274 times)

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
command line lenght limit on Windows
« on: April 24, 2020, 05:54:57 am »
Hi guys, I have a new problem,

I compile an mbed os project, and always get an error when linking.

When I tried to find the cause of the error, I found that the tail of the link instruction was missing.

So I copied the error message and found that its length is just 65535,
so I guess the maximum length of this instruction buffer is 64KB.

However, there are tens of thousands of connection object files in mbed os,
so the length of the link instruction may be far more than 64KB.

Can this problem be solved?



I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7019
    • My Best Post
Re: command line lenght limit on Windows
« Reply #1 on: April 24, 2020, 06:07:09 am »
One way to get around the line length limit is to use static libs.

So, group a number of files together and create an CB target to build a static library.
After doing this many times with all the files; you create another target that links several or all of the targets together.

Another was is to see if the Compiler being used support response files.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #2 on: April 24, 2020, 06:24:03 am »
One way to get around the line length limit is to use static libs.

So, group a number of files together and create an CB target to build a static library.
After doing this many times with all the files; you create another target that links several or all of the targets together.

Another was is to see if the Compiler being used support response files.

Tim S.

Thank you for your reply,

This CBP project is automatically generated by the official tool provided by Mbed OS, and manual modification will be very difficult.

And according to the type of MCU, there are many changes in the compilation conditions, so it may not be easy to use a static library.

If CB can display the link instruction completely in the information window instead of truncating it, then I can copy and save it as a txt file, and then call it in the command window to solve it.
I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7019
    • My Best Post
Re: command line lenght limit on Windows
« Reply #3 on: April 24, 2020, 06:33:55 am »
The command window is the source of the problem.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #4 on: April 24, 2020, 06:34:48 am »
Add content

This length limit is not a limitation of the Windows command line, but should be the maximum length limit of the CB instruction buffer.

Can the instruction buffer of CB be changed to solve this problem?
I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2850
Re: command line lenght limit on Windows
« Reply #5 on: April 24, 2020, 08:17:50 am »
You can try to enable the html build log and look there, if the problem is the wxWidhgets control, than this should resolve the problem...
I search currently but have not found any hard coded limit...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12913
    • Travis build status
Re: command line lenght limit on Windows
« Reply #6 on: April 24, 2020, 09:22:24 am »
There is a limit at the OS level. This is solved by using response files, but we don't support this.

https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #7 on: April 24, 2020, 10:02:59 am »
You can try to enable the html build log and look there, if the problem is the wxWidhgets control, than this should resolve the problem...
I search currently but have not found any hard coded limit...

Thank you,

I tried it, but it didn't output the HTML log file. Does it have to be compiled successfully to have this file?

The CB is "Nightly builds" : The 18 April 2020 build (12064) is out.

My system is Windows-10 1909, 64bit.

I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #8 on: April 24, 2020, 10:07:30 am »
There is a limit at the OS level. This is solved by using response files, but we don't support this.

https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553

OK, Should be the reason ...

Is there a way for CB to display the complete link command line in the log window instead of being truncated?

Or save it as a txt file?
I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2850
Re: command line lenght limit on Windows
« Reply #9 on: April 24, 2020, 01:49:57 pm »
It is also in the html log output file.
If this option is enabled (as it is in your case) the html output file should be in the same folder as the project file and have the same name as the project.
As far as i can tell not the command line is the problem, but the log output or not?
Because the compilation process is started, but the error message for the linker is not completely present in the error output?
Am i right, or do i miss understand something?

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #10 on: April 24, 2020, 05:04:46 pm »
It is also in the html log output file.
If this option is enabled (as it is in your case) the html output file should be in the same folder as the project file and have the same name as the project.
As far as i can tell not the command line is the problem, but the log output or not?
Because the compilation process is started, but the error message for the linker is not completely present in the error output?
Am i right, or do i miss understand something?

Hi,

I don't know what causes the HTML log file is not generated.

This link is done through g ++, so you see a red g ++ error, the error message length is 65535, it is obvious that you have lost the file that must be used by the link.

I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #11 on: April 24, 2020, 05:07:35 pm »
It is also in the html log output file.
If this option is enabled (as it is in your case) the html output file should be in the same folder as the project file and have the same name as the project.
As far as i can tell not the command line is the problem, but the log output or not?
Because the compilation process is started, but the error message for the linker is not completely present in the error output?
Am i right, or do i miss understand something?

This is the end of the error message.

... ... \TARGET_GD32F4XX\TARGET_GD32F450ZI\Periphe'      ---- >   There should be many files that need to be linked behind it, but it is missing.

« Last Edit: April 24, 2020, 05:12:07 pm by Chun Jiu »
I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline sodev

  • Regular
  • ***
  • Posts: 407
Re: command line lenght limit on Windows
« Reply #12 on: April 24, 2020, 05:34:00 pm »
Not sure if it is related, but the directory of your sources contain non-ascii characters, this might cause problems.

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 68
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #13 on: April 24, 2020, 06:00:30 pm »
Not sure if it is related, but the directory of your sources contain non-ascii characters, this might cause problems.

Hi,

It is normal ASCII characters on another computer in my office. Now this screenshot is just to reproduce the problem. It is my home computer.
I love my girlfriend like c++!    :-)

http://pan.baidu.com/s/1feNwU
easilygcc is a gmail's email.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2850
Re: command line lenght limit on Windows
« Reply #14 on: April 24, 2020, 09:12:29 pm »
Now, that i think about it. I somehow remember to have fixed a bug like this some time ago...
What version of codeblocks are you using? Have you tried the latest nightly?