User forums > Using Code::Blocks

[RESOLVED][MacOSX 10.15] Build CB

(1/4) > >>

Suryavarman:
I don't know where is the problem. The compiler Clang 12 find some strange errors. (Not only with CB, with my projects too i have some strange compiling errors...)

I can't build wxsmith. And it's the same problem if I build CB with my own wxWidgets building or with this brew tap:
https://github.com/cdalvaro/homebrew-tap
brew install cdalvaro/tap/wxmac

My macport seem to be clean. I have the latest gcc-10 (this is for libtools if my memory is good). Homebrew is also update, my OS is update and Xcode too.
Maybe i have to uninstall something but what?

I have this errors:

--- Code: ---libtool: compile:  clang++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../../src/include -I/…/CodeBlocks/bin/wxwidgets/lib/wx/include/osx_cocoa-unicode-3.1 -I/…/CodeBlocks/wxwidgets-code/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -I../../../../src/include -I../../../../src/sdk/wxscintilla/include -I../../../../src/plugins/contrib/wxSmith -I../../../../src/plugins/contrib/wxSmith/wxwidgets -I../../../../src/plugins/contrib/wxSmith/wxwidgets/properties -I../../../../src/plugins/contrib/wxSmith/properties -I./../wxContribItems/wxchart/include -I./../wxContribItems/wxFlatNotebook/include -I./../wxContribItems/wxImagePanel/include -I./../wxContribItems/wxthings/include -I./../wxContribItems/KWIC/include -I./../wxContribItems/wxSpeedButton -I./../wxContribItems/wxled/gizmosled/include -I./../wxContribItems/wxled/lcdWindow/include -I./../wxContribItems/wxled/led/include -I./../wxContribItems/wxled/ledpanel/include -I./../wxContribItems/wxmathplot -DCB_AUTOCONF -DPIC -I/usr/local/opt/tinyxml/include -mmacosx-version-min=10.15 -fPIC -fexceptions -MT wxthings/wxscustombutton.lo -MD -MP -MF wxthings/.deps/wxscustombutton.Tpo -c wxthings/wxscustombutton.cpp  -fno-common -DPIC -o wxthings/.libs/wxscustombutton.o
wxthings/wxscustombutton.cpp:126:86: error: cannot pass object of non-trivial
      type 'wxString' through variadic method; call will abort at runtime
      [-Wnon-pod-varargs]
  ...wxART_OTHER,Style.wx_str());
     ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:49:36: note:
      expanded from macro 'wxART_OTHER'
#define wxART_OTHER                wxART_MAKE_CLIENT_ID(wxART_OTHER)
                                   ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:31:44: note:
      expanded from macro 'wxART_MAKE_CLIENT_ID'
#define wxART_MAKE_CLIENT_ID(id)           wxASCII_STR(#id "_C")
                                           ^
/…/CodeBlocks/wxwidgets-code/include/wx/string.h:107:24: note:
      expanded from macro 'wxASCII_STR'
#define wxASCII_STR(s) wxString::FromAscii(s)
                       ^
wxthings/wxscustombutton.cpp:130:74: error: cannot pass object of non-trivial
      type 'wxString' through variadic method; call will abort at runtime
      [-Wnon-pod-varargs]
  ...Codef(_T("%ASetBitmapSelected(%i);\n"),&m_BitmapSelected,wxART_OTHER);
                                                              ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:49:36: note:
      expanded from macro 'wxART_OTHER'
#define wxART_OTHER                wxART_MAKE_CLIENT_ID(wxART_OTHER)
                                   ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:31:44: note:
      expanded from macro 'wxART_MAKE_CLIENT_ID'
#define wxART_MAKE_CLIENT_ID(id)           wxASCII_STR(#id "_C")
                                           ^
/…/CodeBlocks/wxwidgets-code/include/wx/string.h:107:24: note:
      expanded from macro 'wxASCII_STR'
#define wxASCII_STR(s) wxString::FromAscii(s)
                       ^
wxthings/wxscustombutton.cpp:135:70: error: cannot pass object of non-trivial
      type 'wxString' through variadic method; call will abort at runtime
      [-Wnon-pod-varargs]
                Codef(_T("%ASetBitmapFocus(%i);\n"),&m_BitmapFocused,wxA...
                                                                     ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:49:36: note:
      expanded from macro 'wxART_OTHER'
#define wxART_OTHER                wxART_MAKE_CLIENT_ID(wxART_OTHER)
                                   ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:31:44: note:
      expanded from macro 'wxART_MAKE_CLIENT_ID'
#define wxART_MAKE_CLIENT_ID(id)           wxASCII_STR(#id "_C")
                                           ^
/…/CodeBlocks/wxwidgets-code/include/wx/string.h:107:24: note:
      expanded from macro 'wxASCII_STR'
#define wxASCII_STR(s) wxString::FromAscii(s)
                       ^
wxthings/wxscustombutton.cpp:140:74: error: cannot pass object of non-trivial
      type 'wxString' through variadic method; call will abort at runtime
      [-Wnon-pod-varargs]
  ...Codef(_T("%ASetBitmapDisabled(%i);\n"),&m_BitmapDisabled,wxART_OTHER);
                                                              ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:49:36: note:
      expanded from macro 'wxART_OTHER'
#define wxART_OTHER                wxART_MAKE_CLIENT_ID(wxART_OTHER)
                                   ^
/…/CodeBlocks/wxwidgets-code/include/wx/artprov.h:31:44: note:
      expanded from macro 'wxART_MAKE_CLIENT_ID'
#define wxART_MAKE_CLIENT_ID(id)           wxASCII_STR(#id "_C")
                                           ^
/…/CodeBlocks/wxwidgets-code/include/wx/string.h:107:24: note:
      expanded from macro 'wxASCII_STR'
#define wxASCII_STR(s) wxString::FromAscii(s)
                       ^
4 errors generated.
make[4]: *** [wxthings/wxscustombutton.lo] Error 1
make[3]: *** [install-recursive] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1

--- End code ---

Here my script to reproduce my compilation. (Thanks to Xaviou to give his building process).
(Sorry i have just translate with DeepL.… may be is better like that :p)


--- Code: ---# Before launching the script for the first time, you can execute the following code
# yourself in a terminal at the same level as this script. You can also let the script
# do it, but it can happen that cloning a repository does not work, in which case it
# will be up to you to do it manually.
#$ git clone https://github.com/wxWidgets/wxWidgets.git wxwidgets-code
#$ cd wxwidgets-code
#$ git submodule update --init --recursiv
#$ cd ..
#$ svn checkout http://svn.code.sf.net/p/codeblocks/code/trunk codeblocks-code

# Specify here the version of wxWidgets. It must be tagged.
# \see https://github.com/wxWidgets/wxWidgets.git
export WX_TAG="v3.1.4"

function install_dependencies()
{
    if [ ! -d /Applications/Xcode.app ]; then
        xcode-select --install
        xcodebuild -license
    fi

    if [ ! -f /usr/local/bin/brew ]; then
        bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    fi
   
    if [ ! -f /usr/bin/svn ]; then
        brew install svn
    fi
   
    if [ ! -f /usr/local/bin/autoconf ]; then
        brew install autoconf
    fi
   
    if [ ! -f /usr/local/bin/automake ]; then
        brew install automake
    fi
   
    if [ ! -f /usr/bin/libtool ]; then
        brew install libtool
    fi
   
    if [ ! -f /usr/local/include/squirrel.h ]; then
        brew install squirrel
    fi
   
    if [ ! -f /usr/local/bin/hunspell ]; then
        brew install hunspell
    fi
       
    if [ ! -d /usr/local/Cellar/gtk+3 ]; then
        brew install gtk+3
    fi
   
    if [ ! -d /usr/local/Cellar/coreutils ]; then
        brew install coreutils
    fi
   
    if [ ! -d /usr/local/Cellar/tinyxml ]; then
        brew install tinyxml
    fi
   
    #echo "macports update."
    # ça peut être long
    #sudo port selfupdate
   
    #echo "libgcc installation."
    #sudo port install libgcc
   
    #echo "cctools installation."
    #sudo port install cctools
}

# To be launched before to be sure to have coreutils to be able to execute the greadlink command.
install_dependencies

# Absolute path to this script, e.g. /home/user/bin/foo.sh
# https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
SCRIPT=$(greadlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd "$SCRIPTPATH"

export CXX=clang++
export CC=clang

export OUT_WX="$SCRIPTPATH/bin/wxwidgets"
export OUT_CB="$SCRIPTPATH/bin/codeblocks"

function wxwidgets_build()
{
    cd wxwidgets-code
    git reset --hard
    git clean -f -d
    git pull
    git checkout "tags/$WX_TAG"
    git submodule update --recursive

    # https://wiki.wxwidgets.org/Possible_Configure_Flags_under_OS_X
    cd "$SCRIPTPATH"
    if [ ! -d ./bin ]; then
        mkdir bin
    fi
    cd bin
    if [ -d "$OUT_WX" ]; then
        rm -r -v -f "$OUT_WX"
    fi
    mkdir wxwidgets
    cd wxwidgets

    "$SCRIPTPATH/wxwidgets-code/configure" --with-osx-cocoa --with-macosx-version-min=10.15 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --disable-debug --disable-debug-flag

    nice make -j $(($(nproc) -1))
}

function codeblocks_build()
{
    cd "$SCRIPTPATH"
    if [ ! -d ./bin ]; then
        mkdir bin
    fi
    cd bin
    if [ -d "$OUT_CB" ]; then
        rm -r -v -f "$OUT_CB"
    fi
    mkdir codeblocks
       
    cd "$SCRIPTPATH"
    cd codeblocks-code
    svn revert --recursive .
    svn update
   
    # To make sure you start again from scratch. You can do that : ´cd codeblock-code | svn cleanup --remove-unversioned
    # before to launch the script.
    if [ -f ./configure ]; then
        make clean
        make distclean
        make clean-bin
        make clean-zipfiles
    else
        ./bootstrap
    fi
   
    export CXXFLAGS=-mmacosx-version-min=10.15
    ./configure --disable-pch --with-wx-config="$OUT_WX/wx-config" --prefix=$OUT_CB --with-contrib-plugins=all,-FileManager,-NassiShneiderman
   
    make -j $(($(nproc) -1))
    make install
    ./bundle.sh
    read -r -p 'Would you like to replace /Applications/CodeBlocks.app with this new ./CodeBlocks.app? ( type "y" for yes or "n" for no ): '
    if [ "${REPLY}" == 'y' ]; then
        cp -R ./CodeBlocks.app /Applications
    fi
}

if [ ! -d ./wxwidgets-code ]; then
    git clone https://github.com/wxWidgets/wxWidgets.git wxwidgets-code
    cd wxwidgets-code
    git submodule update --init --recursive
    wxwidgets_build
else
    read -r -p 'Would you like to re-compile wxWidgets? ( type "y" for yes or "n" for no ): '
    if [ "${REPLY}" == 'y' ]; then
        wxwidgets_build
    fi
fi

if [ ! -d ./codeblocks_code ]; then
    svn checkout http://svn.code.sf.net/p/codeblocks/code/trunk codeblocks-code
fi
codeblocks_build
   
 
--- End code ---

oBFusCATed:
The problem is that wxART_OTHER expands to type wxString and the function expects wxChar* (and also ... expects non-objects) as far as I can see.

I guess something has changed in the latest wx-master you seem to be using.
What is the commit hash of the build of wxWidgets you're using?

Suryavarman:
i use the last wxWidgets tag version tag/v3.1.4
https://github.com/wxWidgets/wxWidgets/commits/v3.1.4

I have change the wxwidgets configure arguments by these:


--- Code: ---    "$SCRIPTPATH/wxwidgets-code/configure" --with-osx-cocoa --with-macosx-version-min=10.15 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --disable-debug --disable-debug-flag --enable-unicode --enable-cxx11 --enable-stl --with-opengl --with-expat=builtin --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin

--- End code ---

And now i have only one error



--- Code: ---Making install in wxSmith
Making install in properties
make[6]: Nothing to be done for `install-exec-am'.
 /usr/local/bin/gmkdir -p '/…/CodeBlocks/bin/codeblocks/include/wxsmith/properties'
 /usr/local/bin/ginstall -c -m 644 ./wxspropertycontainer.h ./wxsproperties.h ./wxsboolproperty.h ./wxspropertystream.h ./wxsflagsproperty.h ./wxsfloatproperty.h ./wxsemptyproperty.h ./wxslongproperty.h ./wxsarraystringeditordlg.h ./wxsenumproperty.h ./wxsarraystringproperty.h ./wxsstringproperty.h ./wxsquickpropspanel.h ./wxsproperty.h ./wxspropertygridmanager.h ./wxscustomeditorproperty.h ./wxstwolongproperty.h ./wxseditenumproperty.h '/…/CodeBlocks/bin/codeblocks/include/wxsmith/properties'
Making install in wxwidgets
Making install in defitems
depbase=`echo wxstreectrl.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../../../../../libtool  --tag=CXX   --mode=compile clang++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../../../../src/include  -I/…/CodeBlocks/bin/wxwidgets/lib/wx/include/osx_cocoa-unicode-3.1 -I/…/CodeBlocks/wxwidgets-code/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__  -I../../../../../../src/include -I../../../../../../src/sdk/wxscintilla/include -DCB_AUTOCONF  -DPIC -I/usr/local/opt/tinyxml/include  -mmacosx-version-min=10.15 -fPIC -fexceptions -MT wxstreectrl.lo -MD -MP -MF $depbase.Tpo -c -o wxstreectrl.lo wxstreectrl.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  clang++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../../../../src/include -I/…/CodeBlocks/bin/wxwidgets/lib/wx/include/osx_cocoa-unicode-3.1 -I/…/CodeBlocks/wxwidgets-code/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -I../../../../../../src/include -I../../../../../../src/sdk/wxscintilla/include -DCB_AUTOCONF -DPIC -I/usr/local/opt/tinyxml/include -mmacosx-version-min=10.15 -fPIC -fexceptions -MT wxstreectrl.lo -MD -MP -MF .deps/wxstreectrl.Tpo -c wxstreectrl.cpp  -fno-common -DPIC -o .libs/wxstreectrl.o
wxstreectrl.cpp:346:26: error: cannot cast from type 'wxString' to pointer type 'const wxChar *' (aka 'const wchar_t *')
        pImageNames[i] = (const wxChar *) sImageNames[i];
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[6]: *** [wxstreectrl.lo] Error 1
make[5]: *** [install-recursive] Error 1
make[4]: *** [install-recursive] Error 1
make[3]: *** [install-recursive] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1
--- End code ---

Suryavarman:
Here the offending code:

codeblocks-code/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxstreectrl.cpp


--- Code: ---…
void wxsTreeCtrl::OnEnumWidgetProperties(cb_unused long Flags)
{
    static wxString     sImageNames[128];
    static const wxChar *pImageNames[128];

    int                 i, n;
    wxString            ss, tt;
    wxArrayString       aa;

    // find available image lists and store them in our local static arrays
    FindAllImageLists(aa);
    n = aa.GetCount();
    if(n > 127)
    {
        n = 127;
    }

    for(i = 0; i < n; i++)
    {
        ss = aa.Item(i);
        sImageNames[i] = ss;
        pImageNames[i] = (const wxChar *) sImageNames[i]; // <------------ HERE
    }




--- End code ---


Here some help to converting wxString
https://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString

oBFusCATed:
This flag is unsupported: --enable-stl

Navigation

[0] Message Index

[#] Next page

Go to full version