Author Topic: Can`t build C::B IDE from latest svn revision 12240  (Read 13414 times)

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Can`t build C::B IDE from latest svn revision 12240
« on: December 19, 2020, 05:08:02 pm »
OS: Windows 7 64bit

1) install MSYS2 https://www.msys2.org/
   - run msys2-terminal and run for update all packages (if need)
   
Code
      $pacman -Syu
   
   - run msys2-terminal and run to install packages:
   
Code
      $pacman -S mingw-w64-x86_64-gdb mingw-w64-x86_64-gcc mingw-w64-x86_64-boost zip svn
   
2) download latest wxWidgets-3.1.4 from https://www.wxwidgets.org/downloads/
   - if use wget.exe
   
Code
      wget.exe -P "h:\i\CB_src\s\" "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/wxWidgets-3.1.4.zip" -N --compression=auto -l 16 -t 0 --retry-connrefused -e robots=off -np -x --max-redirect=60 --no-if-modified-since -o "wget_wx.log"
   
     
3) download latest C::B IDE src from https://svn.code.sf.net/p/codeblocks/code/trunk/
   - if use wget.exe [more bad idea for more download files]
   
Code
      wget.exe -P "h:\i\CB_src\s\" "http://svn.code.sf.net/p/codeblocks/code/trunk/" -N -r --compression=auto -l 16 -t 0 --retry-connrefused -e robots=off -np -x --max-redirect=60 --no-if-modified-since -o "wget_cb.log"
   
   - use svn.exe, before start need open in your system firewall ports only svn.exe uotput rules TCP 80,443,3690
   
Code
      svn.exe co --username you svn://svn.code.sf.net/p/codeblocks/code/trunk
   
4) compile wxWidgets
   4.1) create powershell file: I.ps1
     
Code
        chcp 65001
       
        #$path_msys32 = "H:/I/msys32" ## <== change whereis MSYS2 save files
        $path_msys64 = "H:/I/msys64" ## <== change whereis MSYS2 save files

        $path_wx = "H:/I/CB_src/wxgtk" ## <== change whereis saved latest unpacked wxWidgets files
        cd ($path_wx + "/build/msw")

##-- 32 bit
#        $path_mingw32="$path_msys32/mingw32"
#        $env:path +=";" + $path_mingw32
#        $env:path +=";$path_mingw32\bin"
#        $env:path +=";$path_mingw32\include"       

##-- 64 bit       
        $path_mingw64="$path_msys64/mingw64"
        $env:path +=";" + $path_mingw64
        $env:path +=";$path_mingw64\bin"
        $env:path +=";$path_mingw64\include"

        #-- Before compile I change params in $path_wx/build/msw/config.gcc
        #-- add _MSC_VER=1928 for enable direct2D but this not work

        #-- need run if rebuild
        mingw32-make -f makefile.gcc clean
        if(Test-Path -PathType Container "$path_wx\lib\gcc_dll") {
            #del "$path_wx\lib\gcc_dll"
            rm -r -fo "$path_wx\lib\gcc_dll"
        }
        echo "`n-----------------------------------------------`n"

        #-- need run once before compile
        mingw32-make -f makefile.gcc setup_h
        echo "`n-----------------------------------------------`n"

        #-- build all wxWidgets
        #-- recommends for arg -j#:
        #--     -j(cores in CPU / 2)    if cores >= 4
        #--       not use this arg        if cores >= 2
        #mingw32-make -j4 -f makefile.gcc
        mingw32-make -j2 -f makefile.gcc
        echo "`n-----------------------------------------------`n"
       
        #-- need if not found zip.exe in Windows
        #$path_system32 = $env:ComSpec
        #$path_system32 = $path_system32.SubString(0, $path_system32.Length-7)
        #cd $path_system32
        #$creds = Get-Credential

        $arg = "/c" +
                "mklink zip.exe $path_msys64\usr\bin\zip.exe" +
                "& mklink msys-2.0.dll $path_msys64\usr\bin\msys-2.0.dll" +
                "& mklink msys-bz2-1.dll $path_msys64\usr\bin\msys-bz2-1.dll"
               
        Start-Process cmd -ArgumentList $arg -Verb runas
        echo "`n-----------------------------------------------`n"
     
   4.2) Need change file: H:\I\CB_src\wxgtk\include\wx\msw\setup.h
      from
      #define wxUSE_GRAPHICS_DIRECT2D 0

      to in the #else case as well.
      #define wxUSE_GRAPHICS_DIRECT2D 1
   4.3) run compile:
      click double on I.ps1
     
5) run current C::B IDE
   5.1) Open workspace file
      ## 32 bit
      #- open file in C::B IDE: "H:\I\CB_src\s\svn.code.sf.net\p\codeblocks\code\trunk\src\CodeBlocks_wx31.workspace"
     
      ## OR
     
      ## 64 bit
      - open file in C::B IDE: "H:\I\CB_src\s\svn.code.sf.net\p\codeblocks\code\trunk\src\CodeBlocks_wx31_64.workspace"
   
   5.2) take button build or rebuild
   
      and look this ERRORS :)

     
https://ibb.co/Xz44qHc
https://ibb.co/bLLtpcj
https://ibb.co/MhxWvrn
https://ibb.co/4pDmnDy
https://ibb.co/xgzdR0k

expired 30 days https://easyupload.io/m/m3o8cv
« Last Edit: December 25, 2020, 12:05:23 am by omlk »

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Can`t buid C::B IDE from latest svn revision 12240
« Reply #1 on: December 19, 2020, 06:02:09 pm »
CodeBlocks requires a monolithic DLL version of wxWidgets, not sure what the Makefile compiles by default with no parameters specified, since your errors are linker errors it most probably builds another variant.

Adding _MSC_VER as parameter to Make does NOT pass this as define to the compiler but just sets this as environment variable, thats why it doesn't have any effect. A better way is really to modify setup.h to get the required settings.

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #2 on: December 19, 2020, 06:06:14 pm »
my config.gcc containe:
Code
# =========================================================================
#     This configuration file was generated by
#     Bakefile 0.2.12 (http://www.bakefile.org)
#     Beware that all changes made to this file will be overwritten next
#     time you run Bakefile!
# =========================================================================


# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------

_MSC_VER = 1928

# Compiler flags to link shared library
LINK_DLL_FLAGS ?= -shared

# Compiler flags to link loadable module
LINK_MODULE_FLAGS ?= -shared

# C compiler
CC = gcc

# C++ compiler
CXX = g++

# Standard flags for CC
CFLAGS ?=

# Standard flags for C++
CXXFLAGS ?=

# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=

# Standard linker flags
LDFLAGS ?=

# The C preprocessor
CPP ?= $(CC) -E

# What type of library to build? [0,1]
SHARED ?= 1

# GTK+ toolkit version [,2]
TOOLKIT_VERSION ?=

# Build wxUniversal instead of native port? [0,1]
WXUNIV ?= 0

# Compile Unicode build of wxWidgets? [0,1]
UNICODE ?= 1

# Type of compiled binaries [debug,release]
BUILD ?= release

# Should debugging info be included in the executables? The default value
# "default" means that debug info will be included if BUILD=debug
# and not included if BUILD=release. [0,1,default]
DEBUG_INFO ?= default

# Value of wxDEBUG_LEVEL. The default value is the same as 1 and means that all
# but expensive assert checks are enabled, use 0 to completely remove debugging
# code. [0,1,default]
DEBUG_FLAG ?= 1

# Multiple libraries or single huge monolithic one? [0,1]
MONOLITHIC ?= 1

# Build GUI libraries? [0,1]
USE_GUI ?= 1

# Build wxHTML library (USE_GUI must be 1)? [0,1]
USE_HTML ?= 1

# Build wxWebView library (USE_GUI must be 1)? [0,1]
USE_WEBVIEW ?= 1

# Build multimedia library (USE_GUI must be 1)? [0,1]
USE_MEDIA ?= 1

# Build wxXRC library (USE_GUI must be 1)? [0,1]
USE_XRC ?= 1

# Build wxAUI library (USE_GUI must be 1)? [0,1]
USE_AUI ?= 1

# Build wxRibbon library (USE_GUI must be 1)? [0,1]
USE_RIBBON ?= 1

# Build wxPropertyGrid library (USE_GUI must be 1)? [0,1]
USE_PROPGRID ?= 1

# Build wxRichTextCtrl library (USE_GUI must be 1)? [0,1]
USE_RICHTEXT ?= 1

# Build wxStyledTextCtrl library (USE_GUI must be 1)? [0,1]
USE_STC ?= 1

# Build OpenGL canvas library (USE_GUI must be 1)? [0,1]
USE_OPENGL ?= 1

# Build quality assurance classes library (USE_GUI must be 1)? [0,1]
USE_QA ?= 1

# Enable exceptions in compiled code. [0,1]
USE_EXCEPTIONS ?= 1

# Enable run-time type information (RTTI) in compiled code. [0,1]
USE_RTTI ?= 1

# Set DPI Awareness (win32) to none, system or per-monitor. [0,1,2]
USE_DPI_AWARE_MANIFEST ?= 2

# Enable threading in compiled code. [0,1]
USE_THREADS ?= 1

# Enable wxCairoContext for platforms other than Linux/GTK. [0,1]
USE_CAIRO ?= 0

# Is this official build by wxWidgets developers? [0,1]
OFFICIAL_BUILD ?= 0

# Use this to name your customized DLLs differently
VENDOR ?= omlk


WX_FLAVOUR ?=


WX_LIB_FLAVOUR ?=

# Name of your custom configuration. This affects directory
# where object files are stored as well as the location of
# compiled .lib files and setup.h under the lib/ toplevel directory.
CFG ?=

# Version of C runtime library to use. You can change this to
# static if SHARED=0, but it is highly recommended to not do
# it if SHARED=1 unless you know what you are doing. [dynamic,static]
RUNTIME_LIBS ?= dynamic

# Set the version of your Mingw installation here.
#     "3" ...... this is for Mingw 2.0 or newer (comes with gcc3)
#     "2.95" ... for Mingw 1.1 or any of the older versions [3,2.95]
GCC_VERSION ?= 3

# Windows resource compiler to use, possibly including extra options.
# For example, add "-F pe-i386" here if using 64 bit windres for 32 bit build.
WINDRES ?= windres


« Last Edit: December 22, 2020, 09:46:54 pm by omlk »

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #3 on: December 19, 2020, 06:22:56 pm »
Great, now all you have to do is to reverse engineer all these generated Makefiles to figure out how to actually pass this definition to all required compiler calls as define.

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #4 on: December 19, 2020, 06:34:26 pm »
Great, now all you have to do is to reverse engineer all these generated Makefiles to figure out how to actually pass this definition to all required compiler calls as define.

? mingw32-make -j2 -f makefile.gcc  in file #include config.gcc

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #5 on: December 19, 2020, 06:43:30 pm »
Not sure what you are trying to tell us with that, but before this gets out of hand, my last post was a joke.

Actually, it is a very bad idea to define this symbol yourself, this is a compiler internal symbol and code usually uses this to detect the current compiler. If you define this symbol yourself, the code might think it is getting compiled with MSVC although it gets compiled with GCC, this will break your whole build.

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #6 on: December 19, 2020, 09:41:45 pm »
I compare two .dll, orig and my and I cant't found
_z10wxOnAssertPKciS0_S0_
_z10wxOnAssert*


FIX: need change in config.gcc: DEBUG_FLAG ?= 0  to DEBUG_FLAG ?= 1

so, how disable use wxAsserts() when compile src C::B? I want to get the release version without debug info in wx*.dll
   
« Last Edit: December 22, 2020, 09:42:44 pm by omlk »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #7 on: December 20, 2020, 05:01:13 am »
Do you wish to learn how to do it, correctly?
Or do you wish to continue on your path of editing "config.gcc"?

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

Offline gh_origin

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #8 on: December 20, 2020, 08:58:41 am »
Your method is hackish. There is indeed a detailed wiki page about how to build CodeBlocks from source. It's easy to search for it on Google.

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #9 on: December 20, 2020, 06:34:33 pm »
Why do you consider this method hacking  :)? I do not break anything and use information from files that are in the codeblocks repository.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #10 on: December 20, 2020, 07:45:54 pm »
Trolling continues... and it is quite successful given the number of replies you're getting... Kudos for that  ;D
(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 omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #11 on: December 20, 2020, 08:18:39 pm »
C::B rev12187 can`t correct run pre/post cmd commadns, look in attached screenshot
and I replace all backslashes '\' to forward '/' becouse zip 3.0.0 bug with '\'

« Last Edit: December 22, 2020, 09:40:38 pm by omlk »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #12 on: December 20, 2020, 08:32:13 pm »
Since, you do not want help why are you still posting on this website?

You either need to have a Windows zip command first in the path or edit the CB project to use the MSys2 zip command.
This is NOT a CB problem!

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

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #13 on: December 20, 2020, 08:48:48 pm »
Since, you do not want help why are you still posting on this website?

You either need to have a Windows zip command first in the path or edit the CB project to use the MSys2 zip command.
This is NOT a CB problem!

Tim S.

So I want codeblocks to work correctly, and I show that there are bugs in codeblocks, and you claim that this is not a problem - and what do you think it is then?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #14 on: December 20, 2020, 08:59:28 pm »
Since, you do not want help why are you still posting on this website?

You either need to have a Windows zip command first in the path or edit the CB project to use the MSys2 zip command.
This is NOT a CB problem!

Tim S.

So I want codeblocks to work correctly, and I show that there are bugs in codeblocks, and you claim that this is not a problem - and what do you think it is then?

I can not help you! If you can not read and understand what you quoted then no one can help you on this website!

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

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #15 on: December 20, 2020, 09:07:28 pm »
Since, you do not want help why are you still posting on this website?

You either need to have a Windows zip command first in the path or edit the CB project to use the MSys2 zip command.
This is NOT a CB problem!

Tim S.

So I want codeblocks to work correctly, and I show that there are bugs in codeblocks, and you claim that this is not a problem - and what do you think it is then?

I can not help you! If you can not read and understand what you quoted then no one can help you on this website!

Tim S.


Tell me then who can help me? Are you a codeblocks developer?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #16 on: December 20, 2020, 09:49:18 pm »
Since, you do not want help why are you still posting on this website?

You either need to have a Windows zip command first in the path or edit the CB project to use the MSys2 zip command.
This is NOT a CB problem!

Tim S.

So I want codeblocks to work correctly, and I show that there are bugs in codeblocks, and you claim that this is not a problem - and what do you think it is then?

I can not help you! If you can not read and understand what you quoted then no one can help you on this website!

Tim S.


Tell me then who can help me? Are you a codeblocks developer?

No, I am not a Code::blocks developer; but, since you can not understand what is the problem no one can help you!!!

As I told you already the problem is you are not using a Windows standard zip command!!!
Either you must use a Windows standard zip command or you must edit the CB Project!
This is NOT the fault of the CB Project! It is your fault for not installing an Windows standard zip command in the path before it finds the  MSys2 zip command!

Do you understand the problem?

If you still do not understand the problem; please get some to explain my post to you.

After you install the Windows standard zip command, you can add the path to it in the CB Compiler global setting.

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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #17 on: December 20, 2020, 10:26:08 pm »
I have likely built Code::Blocks over a hundred times using the MinGW64 GCC from MSys2.

I can help you; but, you have to understand what you are trying to do and you have to explain it to me.

I have built C::B using the standard CB Projects about 3 or more times; but, it seemed better to me to edit the CB Projects instead of trying to use the CB projects without changes.

I normally build C::B using an custom build of wxWidgets via one of two ways.
1. The C::B standard win32 way of mingw makefile
2. The MSys2 standard way of an MSys2 package

Under way 1 (mingw makefile) I have used monolithic builds with standard CB Projects or multilib with highly edited CB Projects.

My past tries of build CB via the configure/make required major edits to CB source code and the resulting binary failed to work.

My current use of highly customized CB projects that use wxWidgets msys2 package results in a binary that seems to work.
But, that project of mine was also to test CB source code changes.
And, I really have not tested the produced binary enough to say it works.

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

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #18 on: December 20, 2020, 10:28:15 pm »
It is you who are incompetent in this problem. I have already found the cause of the problem and it is that too many parameters are passed for the zip, you need to use a template.

h:\i\msys64\usr\bin\zip.exe -0 ../../devel31_64/share/CodeBlocks/manager_resources.zip images/*.png images/??x??/*.png

« Last Edit: December 22, 2020, 09:33:28 pm by omlk »

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #19 on: December 20, 2020, 10:57:08 pm »
In this post I wrote 5 steps how to compile codeblox 32/64 bits and config, + it is necessary to correct really parameter in a file H:\I\CB_src\wxgtk\include\wx\msw\setup.h
Codeblock has compiled, but there are still problems with executing pre / post commands to copy files to the appropriate directory devel31

from
#define wxUSE_GRAPHICS_DIRECT2D 0

to in the #else case as well.
#define wxUSE_GRAPHICS_DIRECT2D 1

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #20 on: December 20, 2020, 11:15:32 pm »
I hope in time you can get a clue.

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

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #21 on: December 21, 2020, 09:43:29 am »
 :)
« Last Edit: December 22, 2020, 09:35:10 pm by omlk »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #22 on: December 21, 2020, 01:08:15 pm »
(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 omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #23 on: December 21, 2020, 09:09:07 pm »
Okay, it was interesting to get through all the obstacles on the way to getting a C::B IDE ;)
« Last Edit: December 22, 2020, 09:32:25 pm by omlk »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #24 on: December 22, 2020, 02:25:27 am »
I have not idea, why you think posting patches as images is something worth doing. :)
Posting patches without explanation what problem do they fix is even bigger waste of your time. :)
(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 omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #25 on: December 22, 2020, 05:34:00 pm »
I have not idea, why you think posting patches as images is something worth doing. :)
Posting patches without explanation what problem do they fix is even bigger waste of your time. :)

An interesting question, I think others should learn to fix bugs in codeblocks and graphic information is better perceived than a fix that no one sees except the developers. :)
 
« Last Edit: December 22, 2020, 09:31:02 pm by omlk »

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #26 on: December 22, 2020, 06:51:03 pm »
I don't know in which world you are living, but in my world "others" are failing to wear a simple face mask or stay at home. I have yet to meet someone who want's to fix stuff in third party code who doesn't call himself developer. As a developer looking at pictures (or even worse videos) to fix code is quite a huge waste of time for me, but maybe it's just me getting old and refusing to adapt to the new style of doing coding work ::) :P

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #27 on: December 24, 2020, 09:00:18 am »
If anyone wants to test my codeblocks build, here is the link
« Last Edit: December 24, 2020, 09:09:41 am by omlk »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #28 on: December 24, 2020, 09:37:24 pm »
For those like me that wonder which files are in the zip; here is the output of the tree command.

One file that likely should not be in the zip is codeblocks.RPT

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

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #29 on: December 24, 2020, 11:50:18 pm »
For those like me that wonder which files are in the zip; here is the output of the tree command.

One file that likely should not be in the zip is codeblocks.RPT

Tim S.
You're right, I'm more interested in how my build works, do you have any comments?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #30 on: January 11, 2021, 11:21:07 pm »
Building CB myself using MSys2 MinGW64 64 bit and I think squirrel needs patched I am not sure that this patch is correct.

1. It is poorly formatted ( should I use tabs or spaces should I indent the tests or not. )
2. I am testing if __USE_MINGW_ANSI_STDIO is defined; but, maybe I need to test if the value is 1 or not zero.

Code
diff --git a/src/sdk/scripting/squirrel/sqdebug.cpp b/src/sdk/scripting/squirrel/sqdebug.cpp
index 7f96c4f..df3ef5f 100644
--- a/src/sdk/scripting/squirrel/sqdebug.cpp
+++ b/src/sdk/scripting/squirrel/sqdebug.cpp
@@ -76,7 +76,11 @@ SQString *SQVM::PrintObjVal(const SQObject &o)
  case OT_INTEGER:
  // C::B patch: Support for Windows 64 bit
  #if defined(_WIN64)
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%I64d"), _integer(o));
+            #if defined(__USE_MINGW_ANSI_STDIO)
+                scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%lld"), _integer(o));
+            #else
+                scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%I64d"), _integer(o));
+            #endif
  // C::B patch: Support for Linux 64 bit
  #elif defined(_SQ64)
  scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%ld"), _integer(o));
diff --git a/src/sdk/scripting/squirrel/sqfuncstate.cpp b/src/sdk/scripting/squirrel/sqfuncstate.cpp
index f98c757..28e55c7 100644
--- a/src/sdk/scripting/squirrel/sqfuncstate.cpp
+++ b/src/sdk/scripting/squirrel/sqfuncstate.cpp
@@ -82,7 +82,11 @@ void DumpLiteral(SQObjectPtr &o)
  case OT_INTEGER:
  // C::B patch: Support for Windows 64 bit
             #if defined(_WIN64)
-            scprintf(_SC("{%I64d}"),_integer(o));
+            #if defined(__USE_MINGW_ANSI_STDIO)
+                scprintf(_SC("{%lld}"),_integer(o));
+            #else
+                scprintf(_SC("{%I64d}"),_integer(o));
+            #endif
  // C::B patch: Support for Linux 64 bit
             #elif defined(_SQ64)
             scprintf(_SC("{%ld}"),_integer(o));
diff --git a/src/sdk/scripting/squirrel/sqvm.cpp b/src/sdk/scripting/squirrel/sqvm.cpp
index b1e91b5..d12f959 100644
--- a/src/sdk/scripting/squirrel/sqvm.cpp
+++ b/src/sdk/scripting/squirrel/sqvm.cpp
@@ -251,7 +251,11 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
  case OT_INTEGER:
  // C::B patch: Support for Windows 64 bit
         #if defined(_WIN64)
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%I64d"),_integer(o));
+            #if defined(__USE_MINGW_ANSI_STDIO)
+                scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%lld"),_integer(o));
+            #else
+                scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%I64d"),_integer(o));
+            #endif
  // C::B patch: Support for Linux 64 bit
  #elif  defined(_SQ64)
  scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%ld"),_integer(o));

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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #31 on: January 12, 2021, 12:28:56 am »
Patching it for what? What is the error you're trying to fix?
I'm pretty sure we're not supposed to use __USE_MINGW_ANSI_STDIO.
(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 stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #32 on: January 12, 2021, 02:43:51 am »
Patching it for what? What is the error you're trying to fix?
I'm pretty sure we're not supposed to use __USE_MINGW_ANSI_STDIO.

Building using the MSys2 MinGW64 64 bit GCC; it does not support "I64d" printf option.
Edit: And the compiler defines "__USE_MINGW_ANSI_STDIO" to 1 to show this fact.
Edit2: The define is in C:\msys64\mingw64\include\c++\10.2.0\x86_64-w64-mingw32\bits\os_defines.h
I have yet to find if it is defined for C only code.

Tim S.
« Last Edit: January 12, 2021, 03:16:00 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
« Last Edit: January 12, 2021, 09:53:06 am by omlk »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #34 on: January 12, 2021, 10:06:11 am »
@stahta01: I guess omlk wanted to point you to PRxNN macros, but he/she was so vague that I'm not sure he/she succeeded :)
(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 stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Can`t build C::B IDE from latest svn revision 12240
« Reply #35 on: January 13, 2021, 05:57:57 am »
@stahta01: I guess omlk wanted to point you to PRxNN macros, but he/she was so vague that I'm not sure he/she succeeded :)

Likely true; but, I have no idea if that would really be the clearest fix for third party code.

From MSys2 _mingw.h it seem to clearly imply my patch should either use __USE_MINGW_ANSI_STDIO equal 1 or use the PRxNN macros. Will have to further research. And, the problem seems to be MinGW64 instead of MSys2 based.
Code
/* We are activating __USE_MINGW_ANSI_STDIO for various define indicators.
 * printf ll modifier (unsupported by msvcrt.dll) is required by C99 and C++11 standards. */
#if (defined (_POSIX) || defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) \
     || defined (_ISOC99_SOURCE) \
     || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && __MSVCRT_VERSION__ < 0xE00) \
     || (defined (__cplusplus) && __cplusplus >= 201103L && __MSVCRT_VERSION__ < 0xE00) \
     || defined (_XOPEN_SOURCE) || defined (_XOPEN_SOURCE_EXTENDED) \
     || defined (_GNU_SOURCE) \
     || defined (_SVID_SOURCE)) \
    && !defined(__USE_MINGW_ANSI_STDIO)
/* Enable __USE_MINGW_ANSI_STDIO if user did _not_ specify it explicitly... */
#  define __USE_MINGW_ANSI_STDIO 1
#endif

/* We are defining __USE_MINGW_ANSI_STDIO as 0 or 1 */
#if !defined(__USE_MINGW_ANSI_STDIO)
#define __USE_MINGW_ANSI_STDIO 0      /* was not defined so it should be 0 */
#elif (__USE_MINGW_ANSI_STDIO + 0) != 0 || (1 - __USE_MINGW_ANSI_STDIO - 1) == 2
#define __USE_MINGW_ANSI_STDIO 1      /* was defined as nonzero or empty so it should be 1 */
#else
#define __USE_MINGW_ANSI_STDIO 0      /* was defined as (int)zero and non-empty so it should be 0 */
#endif

Edit: Decided to build using 32 bit MinGW64 to see if I get any warning like when using 64 bit.

Then try using non MSys2 GCC 64 bit and confirm the problem exists outside of MSys2 GCC.

Likely try the PRxNN macros based fix because it should be less complex to maintain; still not sure it is better long term.
But, when you have two choices the simpler one is the one to pick if you have no idea which is better.

Tim S.
« Last Edit: January 13, 2021, 06:06:36 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org