Menu

#374 msys2 gcc compiler is not auto-detected

Undefined
fixed
nobody
Compiler (40)
Feature_Request
2022-01-13
2016-06-12
No

Msys2 is a mingw distribution using Arch`s package manager pacman. It has increasing popularity.

https://sourceforge.net/projects/msys2/

https://msys2.github.io/

However, Code Blocks fails to auto-detect the gcc compiler provider by msys2.

Discussion

  • Teodor Petrov

    Teodor Petrov - 2016-06-12

    We cannot detect any compiler in the planet. If you want this to be supported provide a patch. I think this patch should change some xml file in the src/plugins/compilergcc/resources/compilers folder.

     
  • ollydbg

    ollydbg - 2016-08-31
    • labels: --> Compiler
     
  • Tim Stahlhut

    Tim Stahlhut - 2016-11-15

    This would be very hard to do with the current MSys2 installer.

    Each installer uses a diffrent key code as shown below.

    Tim S.

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall{10859020-fa74-4fd1-bbb7-5fefdf901a57}]

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall{1d52b1d9-63db-4706-8eff-35e62759d3f8}]

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-06-30

    I have been working on adding a bunch of Windows compilers to CB to make it easier for new CB users to setup CB and have produced a bunch of compiler and the corresponding options files as in the list below. Attached is a patch file for these files.
    /src/plugins/compilergcc/resources/compilers/compiler_gcc-TDM-32.xml
    /src/plugins/compilergcc/resources/compilers/compiler_gcc-TDM-64.xml
    /src/plugins/compilergcc/resources/compilers/compiler_gcc-mingw32.xml
    /src/plugins/compilergcc/resources/compilers/compiler_gcc-mingw64.xml
    /src/plugins/compilergcc/resources/compilers/compiler_gcc-msys2.xml
    /src/plugins/compilergcc/resources/compilers/options_gcc-TDM-32.xml
    /src/plugins/compilergcc/resources/compilers/options_gcc-TDM-64.xml
    /src/plugins/compilergcc/resources/compilers/options_gcc-mingw32.xml
    /src/plugins/compilergcc/resources/compilers/options_gcc-mingw64.xml
    /src/plugins/compilergcc/resources/compilers/options_gcc-msys2.xml

    This covers allot of MSW GCC compilers.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-07-01

    Please disregard the previous patch as CB project files do not include the project file changes, which I have ready.... BUT I found that the compiler_mw.xml is not included in the existing project files and I did not add it.

    Do you want me to include the missing XML files in the patch or create another ticket for the missing files and put another subsequent patch in that ticket? BTW I think the less work the better so i think it should be done on this ticket.

    A side question so I get the project files right is:
    Should the windows only XLM compiler files & corresponding options file be included in the unix project?

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-07-02

    I have bit the bullet and updated all three CB project files to include all of the missing and new compiler an option XML files as the existing unix project files included windows specific compilers.

    Attached is the patch that added the exisitng XML files listed above and the updated the CB project files.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-07-03

    The compiler_gcc-mingw64.xml master path is not added to the default.conf in my testing when the path does not exist for some unknown reason at this point in time. This causes subsequent CB startups to mark the compiler as invalid in the autodetectcompilers.cpp as the default.conf is not as expected.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-07-07

    I have updated the compiler*.xml file to work with my limited testing done today. I will test for a few days to ensure my latest update works, but if someone wants to test them or wants them now please let me know and I will post the patch file along with a zip files containing the files for you to use with an existing installation if you want to test them.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-07-16

    After getting a better understanding of the compiler.cpp code please find an updated patch that minimizes the options*.xml as they now use the extend="gcc " option to shrink the files.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-08-10

    The latest working set of XML files code changes that I have working for this ticket are available from the following GITHUB branch:
    https://github.com/acotty/codeblocks_sf/tree/AC-AdditionalWindowsCompilerDefs

    I swap in and out the following compiler directories in my testing and so far I only found one issue in the 20-July-2021 that I fixed on 7-Aug-2021 due to a MinGW32 compiler being installed in a directory that was not in the compiler_gcc-mingw32.xml search paths,
    C:\cygwin64
    C:\gytx_mingw64_11.2.0_release_1
    C:\MinGW
    C:\mingw32
    C:\mingw32-original
    C:\mingw64
    C:\mingw64.gytx_GCC_11.1
    C:\mingw-w64
    C:\msys64
    C:\TDM-GCC-32
    C:\TDM-GCC-64

    The C:\mingw32 has the updated GDB10.2 , while the C:\mingw32-original has the original buggy GDB.

    Let me know when someone has the time to look at the changes and I will either create a Github PR or create a patch and post it. Also let me know if you want a PR or patch file.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-12-15

    I have reworked the patch to only put in the very minimal changes to add the new Windows compiler and options XML files so it can hopefully make it into the trunk source allot easier w.r.t. adding missing files that have nothing to do with adding the Windows compilers.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-12-20

    After applying your changes starting time has gone from 4.2 seconds to over 29.

    Also, I have MInGW-w64 installed and configured in "GNU GCC compiler", now autodetection always says some compiler is not configured and changes my configured executables from "gcc.exe" to "mingw32-gcc.exe" on every start. Probably my compiler is detected as MinGW32, but this detection overwrites my current configuration.

     

    Last edit: Miguel Gimenez 2021-12-20
    • Andrew Cottrell

      Andrew Cottrell - 2021-12-27

      My startup time of approx 2.9 seconds (+/- 0.2 seconds due to the manual way I am calculating the timing) to:
      a) 3.0/3.1 seconds after I add the following files:
      options_gcc-mingw32.xml
      options_gcc-mingw64.xml
      options_gcc-msys2-mingw32.xml
      options_gcc-msys2-mingw64.xml
      options_gcc-tdm-32.xml
      options_gcc-tdm-64.xml
      compiler_gcc-mingw32.xml
      compiler_gcc-mingw64.xml
      compiler_gcc-msys2-mingw32.xml
      compiler_gcc-msys2-mingw64.xml
      compiler_gcc-tdm-32.xml
      compiler_gcc-tdm-64.xml
      b) 3.5 seconds after I added the files above and then modified the options_gcc.xml to change the mingw32-g++.exe to g++.exe and the mingw32-gcc.exe to gcc.exe
      c) 2.9 seconds if I only modify the options_gcc.xml to change the mingw32-g++.exe to g++.exe and the mingw32-gcc.exe to gcc.exe

      Looks like the startup time increases 20% if both new files and options_gcc.xml are done, but adding the files has a potential 6% increase in startup time and changing the options_gcc.xml has no increase or my method does not indicate any.

      I need to check out why when I add the files and modify the options_gcc.xml the startup time increases more than I would have expected (6%).

      Miguel,
      I have no idea why your time went from 4.2 to 29 on every start. Can you check that all of the files listed above in a) are in there. What is in the options_gcc.xml (mingw32-[gcc/g++].exe or [gcc.exe/g++.exe]) ? Do you have an old mingw32 install somewhere that does not have gcc.exe/g++.exe ?

      When I retested the timing with just the C:\mingw64 compiler the timing was 2.9 seconds with the new files and the modified options_gcc.xml file.

      Can I get a list of the compiler directories you have on the PC (the ones C::B will try to find) and a copy of the CB default.config. I have attached mine.
      My testing was done with only the MSYS2 Mingw64 compiler in the C:\msys64\mingw64 directory and the other compilers in the C:\ root having their directory names prefix of "test." , like "C:\test.mingw64".

       
  • Miguel Gimenez

    Miguel Gimenez - 2022-01-11

    I have commited the new compilers in [r12641] (except MinGW32, because it is built-in). The changes to options_gcc.xml are pending.

    No delays are observed at this point, will check in the other computer in a while.

     

    Related

    Commit: [r12641]

  • Miguel Gimenez

    Miguel Gimenez - 2022-01-11

    This change to options_gcc.xml

    -        <Program name="C"         value="mingw32-gcc.exe"/>
    -        <Program name="CPP"       value="mingw32-g++.exe"/>
    -        <Program name="LD"        value="mingw32-g++.exe"/>
    +        <Program name="C"         value="gcc.exe"/>
    +        <Program name="CPP"       value="g++.exe"/>
    +        <Program name="LD"        value="g++.exe"/>
    

    is the origin of the delay.

     
  • Andrew Cottrell

    Andrew Cottrell - 2022-01-11

    Miguel thanks very much for the time and effort you have spent on this.
    You can close this ticket and I will look at the options_gcc.xml and do more testing and investigation to find out what it causing it and once I get to the bottom of it I will raise a new ticket for this.

     
    • Miguel Gimenez

      Miguel Gimenez - 2022-01-12

      I have profiled both cases with Intel's VTune and there is little difference, but VTune only reports CPU time; I tried to use gprof but got a blank report. CPU time is very short compared with total time, so the delay is related to i/O completion.

      The compiler plugin calls Compiler::Execute() for every compiler on start and then waits for termination. Look at sdk/compiler.cpp:1480 for more info.

       
  • Miguel Gimenez

    Miguel Gimenez - 2022-01-12
    • status: open --> fixed
     
  • Miguel Gimenez

    Miguel Gimenez - 2022-01-12

    Fixed in [r12641]

     

    Related

    Commit: [r12641]

  • Mehdi Chinoune

    Mehdi Chinoune - 2022-01-13

    msys2 have now two new variants UCRT64 (mingw-w64 linked to ucrt) and CLANG64 (LLVM toolchain).
    It would be nice to support them!

     
    • Andrew Cottrell

      Andrew Cottrell - 2022-01-13

      You can create a new ticket for the request and create the patch that includes the changes.

      The ticket status of "fixed" is equivalent to done or closed or finished, so no new work will be done on it.

       
  • Miguel Gimenez

    Miguel Gimenez - 2022-01-13

    The delay is because I have gcc.exe and g++.exe in the path, so some GCC compilers with empty MasterPath are able to execute it.

    See sdk\compiler.cpp:1345

     

    Last edit: Miguel Gimenez 2022-01-13
    • Andrew Cottrell

      Andrew Cottrell - 2022-01-13

      Thanks for the info it will allow me to find the problem and fix it. it's yet another blank masterpath quirk. I will create a ticket to fix it once I figure it out and have a handle on it as I suspect it's in the autodetection code and I may have already fixed it, but I will need to test it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.