How to compile using a previous version of gcc

Hello people. I’m trying to install leela chess, using the script build.sh they give. However, there is this error:

/usr/local/cuda/include/crt/host_config.h:143:2: erreur: #error -- unsupported GNU version! gcc versions later than 12 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk

Gcc7 is already installed on TW but… how do I use it? How can I run the script while specifying I want to use gcc7 as compiler?

EDIT: this is the script i run to compile and install:

!/usr/bin/env bash

set -e

# Move to this script's directory.
CDPATH= cd -- "$(dirname -- "$0")"

case $1 in
  plain|debug|debugoptimized|release|minsize)
    BUILDTYPE=$1
    shift
    ;;
  *)
    BUILDTYPE=release
    ;;
esac

BUILDDIR=build/${BUILDTYPE}

MESON=$(PATH="${PATH}:${HOME}/.local/bin" command -v meson || :)
MESON=${MESON:?"Could not find meson. Is it installed and in PATH?"}

if [ -f "${BUILDDIR}/build.ninja" ]
then
  "${MESON}" configure "${BUILDDIR}" -Dbuildtype="${BUILDTYPE}" -Dprefix="${INSTALL_PREFIX:-/usr/local}" "$@"
else
  "${MESON}" "${BUILDDIR}" --buildtype "${BUILDTYPE}" --prefix "${INSTALL_PREFIX:-/usr/local}" "$@"
fi

"${MESON}" compile -C "${BUILDDIR}"

if [ -n "${INSTALL_PREFIX}" ]
then
  "${MESON}" install -C "${BUILDDIR}"
fi

Hi
I use gcc 13 here, just add the -allow-unsupported-compiler flag in the makefile calling nvcc.

Sounds easier. Where must I add the -allow-unsupported-compiler? The script has to many variables in capitals for me to understand anything ^^"

@BobLeRigoleur I did build as an rpm awhile back… then rebuilt the src rpm locally.

I used -Dnvcc_ccbin="/usr/bin/g++-12" to the messon command…

I need to find a weights file that works to benchmark…

@BobLeRigoleur I popped it back on OBS and updated;
https://build.opensuse.org/package/show/home:malcolmlewis:TESTING/lc0

You can then rebuild the src rpm locally (as your user) like;

rpmbuild --rebuild lc0-0.30.0+136-2.1.src.rpm
....
The Meson build system
Version: 1.3.2
....
Configuring build_id.h using configuration
Run-time dependency threads found: YES
Library dl found: YES
Found pkg-config: YES (/usr/bin/pkg-config) 2.1.1
Found CMake: /usr/bin/cmake (3.28.1)
Run-time dependency tensorflow_cc found: NO (tried pkgconfig and cmake)
Run-time dependency accelerate found: NO (tried pkgconfig and cmake)
Library mkl_rt found: NO
Library mklml found: NO
Library dnnl found: NO
Library openblas.dll found: NO
Library openblas found: YES
Has header "openblas_config.h" : NO 
Has header "openblas_config.h" : YES 
Run-time dependency eigen3 found: YES 3.4.0
Program ispc found: NO
Library OpenCL found: YES
Run-time dependency opencl found: NO 
Has header "CL/opencl.h" : YES 
Library cublas found: YES
Library cudnn found: YES
Library cudart found: YES
Program nvcc found: YES (/usr/local/cuda/bin/nvcc)
....
Wrote: /home/username/rpmbuild/RPMS/x86_64/lc0-0.30.0+136-2.1.x86_64.rpm

You can then zypper in that rpm and should be good to go.

@BobLeRigoleur:

You could convert the build script supplied by the application’s programmers to a CMake initial input file – ‘CMakeLists.txt’ – more information on using CMake and it’s capabilities with respect to different compiler versions, is available here – <https://cmake.org/>.

  • Alternatively, if, you’re using a KDE Plasma Desktop, you can pull the application’s source files into a KDevelop project – KDevelop uses CMake by default …
 > LANG=C zypper info kdevelop5
Loading repository data...
Reading installed packages...


Information for package kdevelop5:
----------------------------------
Repository     : Haupt-Repository
Name           : kdevelop5
Version        : 22.12.3-bp155.1.8
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 18.9 MiB
Installed      : Yes
Status         : up-to-date
Source package : kdevelop5-22.12.3-bp155.1.8.src
Upstream URL   : https://www.kdevelop.org
Summary        : Plugin-extensible IDE for C/C++ and other programming languages
Description    : 
    KDevelop is an integrated development environment (IDE).
    It provides editing, navigation and debugging features for several programming languages,
    as well as integration with multiple build systems and version-control systems
    using a plugin-based architecture.
    KDevelop has parser backends for C, C++ and Javascript/QML,
    with further external plugins supporting e.g. PHP or Python.

 >

Thanks! But when I click “download package” it says " No data home:malcolmlewis:TESTING / lc0"

Also forgot to mention, but installing lc0 per se is fine… When I don’t use CUDA. The problem is nvcc specifically which refuses to compile lc0. But when I installed lc0 without CUDA it worked (but way too slowly)

Thanks but I have no idea how to do that, I’m no developper. I just have a build.sh script that I already copy pasted.

Where did you add the flag? I just get “unrecognized arguments: -Dnvcc_ccbin=”/usr/bin/g+±7". In which file and where should I add this?

@BobLeRigoleur You add to the meson_options.txt file in the source (value);

option('nvcc_ccbin',
       type: 'string',
       value: '',
       description: 'Override C++ compiler used by cuda nvcc')

Then run your build script, assuming gcc7-c++ is installed…

You need to log into the openSUSE Build Service to download the src rpm.
https://build.opensuse.org/projects/home:malcolmlewis:TESTING/packages/lc0/repositories/openSUSE_Tumbleweed/binaries

I could install your package but when I launch nibbler it says error Network format NETWORK_ATTENTIONBODY_WITH_HEADFORMAT is not supported by OpenCL backend

also, the meson_options.txt file already has option(‘nvcc_ccbin’ etc, , in which I replaced value: '-Dnvcc_ccbin="/usr/bin/g++-12"', the result is still the same. (I did install gcc12)

Erratum: for my first remark, the problem is just the network file that doesn’t support opencl, soo I got another one from leela’s website and it works. But it’s not as up to date so I’m still looking to compile leela using cuda ^^"

Can you post the link to the file your using as a test here as in download link

@BobLeRigoleur did you rebuild the src rpm and install that?

I used the binary.

But no worry i got it to work. Turns out, writing ./build.sh -Dnvcc_ccbin=g++-12 did the trick. (well actually it’s still complaining that it’s not the correct version of CUDA but I’m tired, I’ll just stick to openCL)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.