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

Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 60
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #15 on: April 25, 2020, 02:53:03 am »
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?

Thank you,

This is a problem left over from the history of "Millennium Bug". The command line buffering of Windows starts from 2048, to 8192, 32768 ... Maybe it is now 65536.

Microsoft's suggestion is to pass the contents of the command line to it in a txt file, if it is indeed the problem.

https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation

My codeblocks is the latest nightly, and its version number is  'build 12064'. Wondows 10 is 1909, 64bit.

Now there are two problems that need to be solved:

1. Previous command line length limitation.
2. The expected html log file does not appear. 

===================
How to reproduce this problem
===================

The Mbed OS is opensource's RTOS.

Note that this Mbed OS is about 1GB, and with the compiled object file, it may exceed 2GB.

1. Need to install python 2, pip, mbed-cli and its dependencies, and gnu gcc for arm.

    GNU Tools for Arm Embedded Processors 9-2019q4-major Release   
    https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm

2. Run cmd.exe to command line window, type command: pip install -U mbed-cli.
3. Go to the folder used for testing, type command: mbed new test-mbedos, it will download 1GB of content.
4. Go to the test-mbedos folder,  it is newly created by the mbed command.
5. Add a main.cpp file:

    #include "mbed.h"

    DigitalOut led1(LED1);

    #define SLEEP_TIME                  300 // (msec)

    int main()
    {
        int count = 0;
        while (true) {
            // Blink LED and wait 0.5 seconds
            led1 = !led1;
            wait_ms(SLEEP_TIME);
        }
    }

6. Then continue to enter the order: mbed export -i codeblocks -m  GD32_F450ZI

    D:\test\test-mbedos>mbed export -i codeblocks -m  GD32_F450ZI
    [mbed] Working path "D:\test\test-mbedos" (program)
    Scan: test-mbedos
   
    D:\test\test-mbedos>

7. If the installation of dependent packages(mbed-cli) fails, you need to delete their version numbers(in mbed-os/requirements.txt).
8. At this time, a CB project file was created (test-mbedos.cbp).
9. Set the path of gcc arm toolchain in CB to start compiling.
I love my girlfriend like c++!    :-)

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

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2730
Re: command line lenght limit on Windows
« Reply #16 on: April 25, 2020, 01:50:25 pm »
Hi, thank your for the detailed description.

Quote
1. Previous command line length limitation.
2. The expected html log file does not appear. 
I can reproduce nr 1 with a project i have created with the help of the following script on windows 7:

Code: [Select]
activeProject <- GetProjectManager().GetActiveProject();

filename <- _T("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.cpp");

for(local i = 0; i < 500; i+=1)
{
    local thisFileName = _T(i.tostring()) + _T("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.cpp");
    local path =  activeProject.GetCommonTopLevelPath() + _T("src") + wxFILE_SEP_PATH + thisFileName;
    IO.WriteFileContents(path , _T("void func") + _T(i.tostring()) + _T("() {}") );
    print("create file: " + path)

    GetProjectManager().AddFileToProject(path, activeProject, 0);

    //activeProject.AddFile(activeProject.GetActiveBuildTarget(), path, true, true, 1);

}

activeProject.Save();


The linking breaks the maximal command line length.
I am working on a solution and will post a patch. This probably will take some discussion, because it modifies the heart of c::b...

The second problem, i can not reproduce at the moment... I will first try to fix bug 1 and then i will look into 2)


Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 60
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #17 on: April 25, 2020, 06:28:55 pm »
Quote
I am working on a solution and will post a patch. This probably will take some discussion, because it modifies the heart of c::b...

The second problem, i can not reproduce at the moment... I will first try to fix bug 1 and then i will look into 2)

Thank you very much, looking forward to your good news :-)
I love my girlfriend like c++!    :-)

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

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2730
Re: command line lenght limit on Windows
« Reply #18 on: April 26, 2020, 11:22:05 am »
Here is a link to a patch, that adds the response files to codeblocks

https://sourceforge.net/p/codeblocks/tickets/953/



Offline Chun Jiu

  • Multiple posting newcomer
  • *
  • Posts: 60
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #19 on: April 27, 2020, 07:35:56 am »
Here is a link to a patch, that adds the response files to codeblocks

https://sourceforge.net/p/codeblocks/tickets/953/

Thank you,

It seems that this part of the work is more complicated, I wait for the Nightly builds with this function to test.
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: 60
  • My Girlfriend
    • EasilyGCC
Re: command line lenght limit on Windows
« Reply #20 on: May 01, 2020, 01:51:03 am »
Here is a link to a patch, that adds the response files to codeblocks

https://sourceforge.net/p/codeblocks/tickets/953/

Hi ,

I found a temporary solution, but it is not very convenient, especially for ordinary CB users.

In the settings of the compile , I replaced the original link command line with a script.

However, this solution is more dangerous. Ordinary users may cause the CB to crash unexpectedly but do not know how to repair it.

So I still look forward to the official solution, thank you.





Code: [Select]
$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs
Replace

Code: [Select]
[[ local a = _T(@"$link_objects"); a.Replace(_T("\\"), _T("/"), true); IO.WriteFileContents(_T("objs.txt") , a); ]]
$linker $libdirs -o $exe_output @objs.txt $link_resobjects $link_options $libs
arm-none-eabi-objcopy.exe -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).bin
« Last Edit: May 01, 2020, 02:48:13 am by Chun Jiu »
I love my girlfriend like c++!    :-)

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