Author Topic: SVN 12550 does not compile  (Read 18814 times)

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: SVN 12550 does not compile
« Reply #15 on: December 06, 2021, 12:27:14 am »
I just successfully did the following build:

Within C::B loaded the CodeBlocks_wx31_64.cbp and configured it for the following compiler:

    Compiler Downloaded:
         https://github.com/brechtsanders/winlibs_mingw/releases/download/11.2.1-snapshot20211106-9.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-11.2.1-snapshot20211106-mingw-w64-9.0.0-r1.7z
    Directory:
       C:\mingw64-winlib

Attaches is the build log.

NOTE: wxWidget was not rebuilt and I did not run or try to run any of the output files.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: SVN 12550 does not compile
« Reply #16 on: December 06, 2021, 01:23:00 am »
Plot thickens as I just successfully compiled the C::B using the Guyutongxue compiler as follows....

Within C::B loaded the CodeBlocks_wx31_64.cbp and configured it for the following compiler:

    Compiler Downloaded:
        https://github.com/Guyutongxue/mingw-release/releases/download/v11.2.0-r1/gytx_x86_64-11.2.0-posix-seh_r1.7z
    Directory:
       C:\mingw64_gtx

My source code I use is in the following github branch:
    https://github.com/acotty/codeblocks_sf/tree/AC-WindowsInstaller

Some notes on the branch:
1. It already includes the PCH changes I did a few days ago. 
2. There are a number of changes in the source tree that are still PR's against obfuscated's github repo, but I do not expect anything to progress with any of these as most of them are to do with Windows and not Linux.
3. There are also changes to the project file environment variables to make them more consistent and easy for me to use, but I have not  reviewed these to ensure they are good enough for eventual incorporation into the trunk.
4. You may find extra debugging that I have check in by accident.
5. The code includes a windows_installer directory that includes the files I use to build the installer. This is a separate SF SVN repo, but having it as a separate repo made building the installers  a PITA.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #17 on: December 06, 2021, 03:30:13 am »
Hi, AndrewCot, thanks for your detailed test and report.

I just switch my compiler to Msys2's native gcc compiler which is gcc 11.2.0 to build CodeBlocks_wx31_64.cbp, and I don't see the PCH issue now. (though I still use the wx 3.1.5 library built by guyu's compiler, I will later to rebuild wx 3.1.5 by Msys2's native gcc).

So, it looks like this issue is related to guyu's gcc. I will report bugs in his site.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #18 on: December 06, 2021, 07:07:17 am »
I did a build time test using msys2's 64bit gcc 11.2.0 on a win7 system.

When PCH is enabled, the CodeBlocks_wx31_64.cbp rebuild time is about: 273 seconds
When PCH is not enabled, the CodeBlocks_wx31_64.cbp rebuild time is about: 440 seconds

So, it is about 38% time reduce if I enable the PCH for CodeBlocks_wx31_64.cbp.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: SVN 12550 does not compile
« Reply #19 on: December 06, 2021, 07:26:58 am »
What version of  guyu's compiler were you using? 11.2.0 release 0 or release 1 or some other version?

Good to see that your MSYS2 GCC 11.2.0 works.

I did not get as good a drop on my setup, I got a drop of about 35 seconds when building everything. I should do some more tests tomorrow when compiling just the CodeBlocks_wx31_64.cbp and see how I go and report my findings.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #20 on: December 06, 2021, 08:25:37 am »
What version of  guyu's compiler were you using? 11.2.0 release 0 or release 1 or some other version?
gytx_x86_64-11.2.0-posix-seh_r1, which is released Aug 01, 2021.
I have this compiler in two PCs, and both got the same PCH warning message: "sdk_precomp.h.gch: had text segment at different address".
So, I switch to using Msys2's gcc now.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #21 on: December 06, 2021, 09:57:58 am »
If you add PCH to the first plugin I can do it to the others (I have never used precompiled headers)


I see AndrewCot already did that, see here: https://github.com/acotty/codeblocks_sf/commit/9fc1965e72e1c4ef96227f8a84f2423563f25f4b

I can download his change/patch from:
https://github.com/acotty/codeblocks_sf/commit/9fc1965e72e1c4ef96227f8a84f2423563f25f4b.patch

Then use the command line "patch -p1 < 9fc1965e72e1c4ef96227f8a84f2423563f25f4b.patch" to apply to my local git repo. (git am does not work, I'm not sure why)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #22 on: December 11, 2021, 04:19:21 pm »
I have commit the PCH patches in r12572 and r12573.  :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: SVN 12550 does not compile
« Reply #23 on: December 11, 2021, 09:23:00 pm »
Thank you for the changes, they work OK here although I have not tested the compilation times.

I know nothing about precompiled headers, but noted this comment from stahta01:

Quote
FYI: Code::Blocks has in the past 3 years not used the PCH correctly in the contrib projects.

Turning off "-DNOPCH" is a waste of time if the devs refuse to add the location of the PCH to the project search path.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: SVN 12550 does not compile
« Reply #24 on: December 12, 2021, 12:58:48 am »
I can not build codeblocks with pch enabled....
I  use the latest winlibs compiler (gcc11) and cc1plus.exe crashes every time i try to build codeblocks with pch enabled:
Code
cc1plus.exe caused an Access Violation at location 00007FF6BF009080 in module cc1plus.exe Reading from location 0000000011800F14.

AddrPC           Params
00007FF6BF009080 000002A924CBA480 0000000000000000 0000000000000001  cc1plus.exe!0x7ff601119080
00007FF6BF0098F4 00000000000000D0 00007FF6BEFE7096 000002A926640000  cc1plus.exe!0x7ff6011198f4
00007FF6BEFDF0D6 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff6010ef0d6
00007FF6BDF89F5D 000002A926642680 000000B0829FDE50 000002A924E102D0  cc1plus.exe!0x7ff600099f5d
00007FF6BEFDE1FC 000000B0829FDF10 00007FFC00000000 0000000000000000  cc1plus.exe!0x7ff6010ee1fc
00007FF6BEFDE7ED 000000B0829FE9B0 000000000000E000 0000000000AA000A  cc1plus.exe!0x7ff6010ee7ed
00007FF6BEFDEE19 00007FF60000000B 00007FF6BF775240 0000000000000008  cc1plus.exe!0x7ff6010eee19
00007FF6BE581E8A 00007FF6BF812054 0000000000000000 0000000000000000  cc1plus.exe!0x7ff600691e8a
00007FF6BF068A23 000000B0829FE080 00007FF6BDEF0000 000000B0829FE130  cc1plus.exe!0x7ff601178a23
00007FFC19560E10 0000000000000000 000000B0829FE630 000000B0829FECF0  ucrtbase.dll!__C_specific_handler
00007FFC1B9920CF 0000000000000000 000000B0829FE630 000000B0829FECF0  ntdll.dll!RtlpExecuteHandlerForException
00007FFC1B941454 0000000000000000 0000000000000000 00000000000002A0  ntdll.dll!RtlDispatchException
00007FFC1B990BFE 0000000000000000 0000000000000000 000002A924C20150  ntdll.dll!KiUserExceptionDispatch
00007FF6BF009080 000002A924CBA480 0000000000000000 0000000000000000  cc1plus.exe!0x7ff601119080
00007FF6BF0098F4 000002A924C28D24 000002A924C20150 000000000000000A  cc1plus.exe!0x7ff6011198f4
00007FF6BEFDF0D6 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff6010ef0d6
00007FF6BDF89F5D 0000000000000000 000000B0829FF1F0 0000000000000003  cc1plus.exe!0x7ff600099f5d
00007FF6BEFDE1FC 000000B0829FF2B0 0000000000000000 000002A9267D3D70  cc1plus.exe!0x7ff6010ee1fc
00007FF6BEFDE7ED 0000000000000008 00007FFC19538091 000002A924CB1B80  cc1plus.exe!0x7ff6010ee7ed
00007FF6BEFDFD4A 000002A924CBE5E0 000002A924CBE5E0 0000000000000003  cc1plus.exe!0x7ff6010efd4a
00007FF6BE2EA33F 0000000000000003 00007FF6BF1D96D5 000002A924CBCB50  cc1plus.exe!0x7ff6003fa33f
00007FF6BE11A3EA 0000000000000001 0000000000000000 0000000000000000  cc1plus.exe!0x7ff60022a3ea
00007FF6BEFFF5E1 0000000000000000 0000000500000C80 0000000000000001  cc1plus.exe!0x7ff60110f5e1
00007FF6BEFF76C9 0000000000000001 FFFFDFFEFFFFFDFF 0000000100001A01  cc1plus.exe!0x7ff6011076c9
00007FF6BEFF7C48 0000000000000057 000002A926726680 0000000000000045  cc1plus.exe!0x7ff601107c48
00007FF6BF006969 0000000000000000 000002A9CA0000CA 0000000000000000  cc1plus.exe!0x7ff601116969
00007FF6BF00DE50 000000B0829FF980 000002A924CBCB50 000002A924CBCD18  cc1plus.exe!0x7ff60111de50
00007FF6BE110C8B 000000B0829FF980 000002A924CE5060 00007FF6BF8B98E8  cc1plus.exe!0x7ff600220c8b
00007FF6BDFF167C FFFFFD56DB3C6F20 00007FF6BEFF8E12 00007FF6BFA17258  cc1plus.exe!0x7ff60010167c
00007FF6BE03BEC3 000002A924CAE360 0000000000000025 0000000000000000  cc1plus.exe!0x7ff60014bec3
00007FF6BE119A4F 00007FF6BF162020 00007FF6BFA159A0 000002A924C4D960  cc1plus.exe!0x7ff600229a4f
00007FF6BE582081 000002A924CC5F90 0000000000000025 0000000000000000  cc1plus.exe!0x7ff600692081
00007FF6BF13227A 00007FF6BDEF0000 0000002E00000051 000002A924C3A000  cc1plus.exe!0x7ff60124227a
00007FF6BF15F227 0000000000000051 00007FF6BF8B8008 0000000000000000  cc1plus.exe!0x7ff60126f227
00007FF6BDEF1445 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff600001445
00007FF6BDEF1146 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff600001146
00007FFC1B7A7034 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!BaseThreadInitThunk
00007FFC1B942651 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #25 on: December 12, 2021, 02:22:55 am »
I can not build codeblocks with pch enabled....
I  use the latest winlibs compiler (gcc11) and cc1plus.exe crashes every time i try to build codeblocks with pch enabled:
Code
cc1plus.exe caused an Access Violation at location 00007FF6BF009080 in module cc1plus.exe Reading from location 0000000011800F14.

AddrPC           Params
00007FF6BF009080 000002A924CBA480 0000000000000000 0000000000000001  cc1plus.exe!0x7ff601119080
00007FF6BF0098F4 00000000000000D0 00007FF6BEFE7096 000002A926640000  cc1plus.exe!0x7ff6011198f4
00007FF6BEFDF0D6 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff6010ef0d6
00007FF6BDF89F5D 000002A926642680 000000B0829FDE50 000002A924E102D0  cc1plus.exe!0x7ff600099f5d
00007FF6BEFDE1FC 000000B0829FDF10 00007FFC00000000 0000000000000000  cc1plus.exe!0x7ff6010ee1fc
00007FF6BEFDE7ED 000000B0829FE9B0 000000000000E000 0000000000AA000A  cc1plus.exe!0x7ff6010ee7ed
00007FF6BEFDEE19 00007FF60000000B 00007FF6BF775240 0000000000000008  cc1plus.exe!0x7ff6010eee19
00007FF6BE581E8A 00007FF6BF812054 0000000000000000 0000000000000000  cc1plus.exe!0x7ff600691e8a
00007FF6BF068A23 000000B0829FE080 00007FF6BDEF0000 000000B0829FE130  cc1plus.exe!0x7ff601178a23
00007FFC19560E10 0000000000000000 000000B0829FE630 000000B0829FECF0  ucrtbase.dll!__C_specific_handler
00007FFC1B9920CF 0000000000000000 000000B0829FE630 000000B0829FECF0  ntdll.dll!RtlpExecuteHandlerForException
00007FFC1B941454 0000000000000000 0000000000000000 00000000000002A0  ntdll.dll!RtlDispatchException
00007FFC1B990BFE 0000000000000000 0000000000000000 000002A924C20150  ntdll.dll!KiUserExceptionDispatch
00007FF6BF009080 000002A924CBA480 0000000000000000 0000000000000000  cc1plus.exe!0x7ff601119080
00007FF6BF0098F4 000002A924C28D24 000002A924C20150 000000000000000A  cc1plus.exe!0x7ff6011198f4
00007FF6BEFDF0D6 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff6010ef0d6
00007FF6BDF89F5D 0000000000000000 000000B0829FF1F0 0000000000000003  cc1plus.exe!0x7ff600099f5d
00007FF6BEFDE1FC 000000B0829FF2B0 0000000000000000 000002A9267D3D70  cc1plus.exe!0x7ff6010ee1fc
00007FF6BEFDE7ED 0000000000000008 00007FFC19538091 000002A924CB1B80  cc1plus.exe!0x7ff6010ee7ed
00007FF6BEFDFD4A 000002A924CBE5E0 000002A924CBE5E0 0000000000000003  cc1plus.exe!0x7ff6010efd4a
00007FF6BE2EA33F 0000000000000003 00007FF6BF1D96D5 000002A924CBCB50  cc1plus.exe!0x7ff6003fa33f
00007FF6BE11A3EA 0000000000000001 0000000000000000 0000000000000000  cc1plus.exe!0x7ff60022a3ea
00007FF6BEFFF5E1 0000000000000000 0000000500000C80 0000000000000001  cc1plus.exe!0x7ff60110f5e1
00007FF6BEFF76C9 0000000000000001 FFFFDFFEFFFFFDFF 0000000100001A01  cc1plus.exe!0x7ff6011076c9
00007FF6BEFF7C48 0000000000000057 000002A926726680 0000000000000045  cc1plus.exe!0x7ff601107c48
00007FF6BF006969 0000000000000000 000002A9CA0000CA 0000000000000000  cc1plus.exe!0x7ff601116969
00007FF6BF00DE50 000000B0829FF980 000002A924CBCB50 000002A924CBCD18  cc1plus.exe!0x7ff60111de50
00007FF6BE110C8B 000000B0829FF980 000002A924CE5060 00007FF6BF8B98E8  cc1plus.exe!0x7ff600220c8b
00007FF6BDFF167C FFFFFD56DB3C6F20 00007FF6BEFF8E12 00007FF6BFA17258  cc1plus.exe!0x7ff60010167c
00007FF6BE03BEC3 000002A924CAE360 0000000000000025 0000000000000000  cc1plus.exe!0x7ff60014bec3
00007FF6BE119A4F 00007FF6BF162020 00007FF6BFA159A0 000002A924C4D960  cc1plus.exe!0x7ff600229a4f
00007FF6BE582081 000002A924CC5F90 0000000000000025 0000000000000000  cc1plus.exe!0x7ff600692081
00007FF6BF13227A 00007FF6BDEF0000 0000002E00000051 000002A924C3A000  cc1plus.exe!0x7ff60124227a
00007FF6BF15F227 0000000000000051 00007FF6BF8B8008 0000000000000000  cc1plus.exe!0x7ff60126f227
00007FF6BDEF1445 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff600001445
00007FF6BDEF1146 0000000000000000 0000000000000000 0000000000000000  cc1plus.exe!0x7ff600001146
00007FFC1B7A7034 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!BaseThreadInitThunk
00007FFC1B942651 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart


I'm using msys2's gcc compiler(gcc11). It works OK here. Maybe, the winlibs compiler does not support large pch files very well?
Or, we can ask winlibs author to check this issue?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #26 on: December 12, 2021, 02:25:16 am »
Thank you for the changes, they work OK here although I have not tested the compilation times.

I know nothing about precompiled headers, but noted this comment from stahta01:

Quote
FYI: Code::Blocks has in the past 3 years not used the PCH correctly in the contrib projects.

Turning off "-DNOPCH" is a waste of time if the devs refuse to add the location of the PCH to the project search path.

Yes, I agree with Tim's option. We can fix those issues in our repo.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: SVN 12550 does not compile
« Reply #27 on: December 12, 2021, 05:54:49 pm »
Can you give me a direction how you compile codeblocks with msys2?
If i use the package for wxWidgets all paths in codeblocks are wrong,
If i compile wxWidgets my self also all paths are wrong.
If i try to compile wxWidgets with mingw32 makefile and msys2 then i am not able to compile it...

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN 12550 does not compile
« Reply #28 on: December 13, 2021, 12:54:55 am »
Can you give me a direction how you compile codeblocks with msys2?
If i use the package for wxWidgets all paths in codeblocks are wrong,
If i compile wxWidgets my self also all paths are wrong.
If i try to compile wxWidgets with mingw32 makefile and msys2 then i am not able to compile it...

1, you have to install msys2

2, you need to use the pacman command to install the gcc compiler for mingw64 subsystem. for example:

Code
pacman -S mingw-w64-x86_64-toolchain

3, set the gcc's binary folder(in my system, it looks like: "F:\msys2\mingw64\bin" ) to your system's PATH environment

4, download a wx 3.1.5 source, and swith to the build/msw sub folder, (maybe some config file need to be modified to enable the opengl?, I can't remember correctly right now)

5, run the command line:

Code
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-Wno-unused-local-typedefs -Wno-deprecated-declarations -fno-keep-inline-dllexport" > log-release.txt 2>&1

6, go the the Code::Blocks and open the global variables settings, set the "cb_release_type" and "wx31_64".

7, open the "CodeBlocks_wx31_64.cbp" or "CodeBlocks_wx31_64.workspace" to build.

That's all.
« Last Edit: December 13, 2021, 12:57:41 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: SVN 12550 does not compile
« Reply #29 on: December 13, 2021, 04:07:56 am »
Ollybdg,

When I build WxWidget I do not specify the following parameters
    USE_XRC=1
    USE_OPENGL=1
    CXXFLAGS="-Wno-unused-local-typedefs -Wno-deprecated-declarations -fno-keep-inline-dllexport"

The WIKI page ("https://wiki.codeblocks.org/index.php/Compiling_wxWidgets_3.0.0_to_develop_Code::Blocks_(MSW)")  has the following options:
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport" >log.txt 2>&1
The codeblocks manual appears to not be up to date as the command line options specified on pages 133 & top of 134 do not specif the VENDOR=cb option!!!
The  https://github.com/PBfordev/wxpbguide is different again...

So my question if you get this far is what should the wxWidget options be in order to build WxWidget with the same options as included in the official C::B releases?


BlueHazzard,
If you get stuck or want more info on the process I used the following guide to create the batch file that I use to build WxWidgets 3.1.5 or the github source:
    https://github.com/PBfordev/wxpbguide

Attached is the batch file I use to build WxWidgets, it has a bunch of options in the file that allow me to build the debug or release versions, specify the compiler path to use. It also has the option to do a make clean PLUS create/update the setup.h. The batch file also uses power shell to calculate how long the build took, sorry I am still an old school MS batch file user.