Author Topic: Problem building on Linux  (Read 4613 times)

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Problem building on Linux
« on: March 20, 2021, 02:53:34 pm »
I just tried building from source in Ubuntu 18.04.
Code
svn checkout svn://svn.code.sf.net/p/codeblocks/code/trunk
cd trunk
./bootstrap
./update-revision.sh
./configure --with-contrib=all
make
sudo make install
No errors were reported in make but when I try to run it I get:
codeblocks: symbol lookup error: codeblocks: undefined symbol: _ZTI32IncrementalSelectIteratorIndexed

Does anyone have any idea what went wrong?

Offline Suryavarman

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Suryavarman
Re: Problem building on Linux
« Reply #1 on: March 20, 2021, 05:35:02 pm »
Here my script for mageia:

I build wxWidgets and C::B

Code
# \see https://github.com/wxWidgets/wxWidgets.git
export WX_TAG="v3.1.4"

function install_dependencies()
{
    su
    urpmi autoconf libtool automake lib64squirrel-devel hunspell hunspell-fr hunspell-en lib64hunspell-devel lib64wxgtku3.0-devel lib64tinyxml-devel lib64gamin-devel
    exit
}

# A lancer avant pour être certain d'avoir le nécessaire pour construire le projet.
# install_dependencies

# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd "$SCRIPTPATH"

export CXX=g++
export CC=gcc

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

    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" --disable-debug --disable-debug-flag --enable-unicode --enable-cxx11 --with-opengl --with-expat=builtin --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin
   
    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
   
    read -r -p 'Souhaitez vous reconstruire Codeblocks ou repartir de la précédente compilation? ( taper "o" pour oui ou "n" pour non ): '
    if [ "${REPLY}" == 'o' ]; then
        svn cleanup
        svn revert --recursive .
        svn update
       
        # vous pouvez faire : «cd codeblock-code | svn cleanup --remove-unversioned avant de
        # lancer le script pour tre sžre de re-partir zŽro.
        if [ -f ./configure ]; then
            make clean
            make distclean
            make clean-bin
            make clean-zipfiles
        else
            ./bootstrap
        fi

        ./configure --disable-pch --with-wx-config="$OUT_WX/wx-config" --prefix=$OUT_CB --with-contrib-plugins=all
    fi
   
    make -j $(($(nproc) -1))
    make install
}

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 'Souhaitez vous re-compiler wxWidgets? ( taper "o" pour oui ou "n" pour non ): '
    if [ "${REPLY}" == 'o' ]; 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
   

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem building on Linux
« Reply #2 on: March 20, 2021, 06:02:32 pm »
Does anyone have any idea what went wrong?
Yes, most probably you're mixing libcodeblocks.so from different versions.
(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 lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Problem building on Linux
« Reply #3 on: March 21, 2021, 11:52:40 am »
Yes, most probably you're mixing libcodeblocks.so from different versions.
Thanks. As far as I know there isn't any other copy of codeblocks installed on the system. I did have the Ubuntu packaged version of CodeBlocks installed but I uninstalled it before building this copy.

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Problem building on Linux
« Reply #4 on: March 21, 2021, 01:57:34 pm »
OK, apt remove codeblocks leaves libcodeblocks behind. I needed to apt remove libcodeblocks.

Next issue. When I run codeblocks I get
Code
codeblocks: error while loading shared libraries: libcodeblocks.so.0: cannot open shared object file: No such file or directory
libcodeblocks.so exists in /usr/local/lib

Oddly if I install to a non-standard prefix e.g /home/myhome/whatever and run it from there, it finds libcodeblocks from /home/myhome/whatever/lib/ and runs correctly.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem building on Linux
« Reply #5 on: March 21, 2021, 02:54:17 pm »
Read the manual of your distro how you're supposed to tell the linker to update libraries. It should be something related to ldconfig.
Generelly I think it is really bad idea to use the default path. I suppose we have to change it to be somewhere else.
Also if you're on ubuntu you can easily build packages and use those.
(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 lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Problem building on Linux
« Reply #6 on: March 22, 2021, 11:33:50 am »
Dangit. I should have known that. Thanks.