This is a test version of Biostars. For the public version, visit https://www.biostars.org.
"C++ compiler cannot create executables", while installing ABySS 2.0 assembler

I am assembling a plant genome using ABySS 2.0 short-read assembler. I am using the GitHub documentation to perform the installation of ABySS 2.0. I used Homebrew for installing ABySS, gcc, and all other dependencies, mentioned in the documentation.

Query After running the following script, I haven't been able to make progress.

./autogen.sh
mkdir build
cd build
../configure --prefix=/path/to/abyss

Here, --prefix= was set with path to a folder where I wanted to install ABySS. When I ran, It showed the following error.

checking for g++ -std=c++11 option to support OpenMP... -fopenmp
configure: error: ABySS requires the btllib C++ libraries, which may
    be downloaded from here: https://github.com/bcgsc/btllib
    It is necessary to compile btllib. The readme
    in the GitHub repo contains instructs to compile btllib.

I installed btllib-1.7.0.tar.gz from this GitHub site, compiled then entered the following commands on the console.

export CPPFLAGS="-isystem home/palmyra/abyss/btllib-1.7.0/install/include $CPPFLAGS"
export LDFLAGS="-L/home/palmyra/abyss/btllib-1.7.0/install/lib -lbtllib $LDFLAGS"

After this, when I ran the ../configure --prefix=/path/to/abyss

it shows C++ compiler cannot create executables

the complete error:

checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in '/home/palmyra/abyss/build':
configure: error: C++ compiler cannot create executables

The configure.log file can be accessed at here

Can someone help to troubleshoot it. I am very much confused.

====================================================================

EDIT: I removed the LDFLAGS and now C++ compiler creates executables. Currently, btllib-1.7 is not able to be compiled. I don't understand if it is because C++ compiler used for compiling Python matches the one used for compiling btllib.

Compiling btllib-1.7 shows the following error.

./../home/palmyra/abyss/btllib-1.7.0/include/btllib/hashing_internals.hpp:2896:11: error: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Werror=c++17-extensions]
 2896 | constexpr inline const uint64_t*
      |           ^~~~~~
../../home/palmyra/abyss/btllib-1.7.0/include/btllib/hashing_internals.hpp:3156:11: error: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Werror=c++17-extensions]
 3156 | constexpr inline const uint64_t* const LEVEL_X_AA_SEED_TABLE[4] = {
      |           ^~~~~~
../../home/palmyra/abyss/btllib-1.7.0/include/btllib/hashing_internals.hpp:3162:11: error: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Werror=c++17-extensions]
 3162 | constexpr inline const uint64_t* const*
      |           ^~~~~~
../../home/palmyra/abyss/btllib-1.7.0/include/btllib/hashing_internals.hpp:3169:11: error: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Werror=c++17-extensions]
 3169 | constexpr inline const uint64_t* const*
      |           ^~~~~~
In file included from ../../home/palmyra/abyss/btllib-1.7.0/include/btllib/nthash.hpp:13:
../../home/palmyra/abyss/btllib-1.7.0/include/btllib/nthash_kmer.hpp:14:11: error: nested namespace definitions only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Werror=c++17-extensions]
   14 | namespace btllib::hashing_internals {
      |           ^~~~~~
In file included from ../../home/palmyra/abyss/btllib-1.7.0/include/btllib/nthash.hpp:14:
../../home/palmyra/abyss/btllib-1.7.0/include/btllib/nthash_seed.hpp:15:11: error: nested namespace definitions only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Werror=c++17-extensions]
   15 | namespace btllib::hashing_internals {
      |           ^~~~~~
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/palmyra/abyss/btllib-1.7.0/./compile", line 182, in <module>
    sp.run(
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['\n    if [ -f /tmp/btllib-build-eLg_1lWEQkGwS9dB7HujlQ/venv/bin/activate ]; then\n      . /tmp/btllib-build-eLg_1lWEQkGwS9dB7HujlQ/venv/bin/activate;\n    fi &&\n    export AR=gcc-ar &&\n    meson setup --buildtype release -Db_lto=true -Db_ndebug=true -Db_coverage=false --prefix=/home/palmyra/abyss/btllib-1.7.0/install /tmp/btllib-build-eLg_1lWEQkGwS9dB7HujlQ &&\n    cd /tmp/btllib-build-eLg_1lWEQkGwS9dB7HujlQ &&\n    ninja install &&\n    cd .. &&\n    if [ -f /tmp/btllib-build-eLg_1lWEQkGwS9dB7HujlQ/venv/bin/activate ]; then\n      deactivate;\n    fi\n  ']' returned non-zero exit status 1.

This is the compile Python file

assembly illumina abyss btllib paired-end

2 answers

instead of

export CPPFLAGS="-isystem home/palmyra/abyss/btllib-1.7.0/install/include $CPPFLAGS"

try (colon instead of space)

export CPPFLAGS="-isystem home/palmyra/abyss/btllib-1.7.0/install/include:$CPPFLAGS"

Thank you for the response. May I ask you a doubt: should I remove the preexisting CPPFLAGS from the cache variable (found it on the configure.log) by

unset ac_cv_env_CPPFLAGS_set
unset ac_cv_env_CPPFLAGS_value

before replacing with export CPPFLAGS="-isystem home/palmyra/abyss/btllib-1.7.0/install/include:$CPPFLAGS"

@Pierre Lindenbaum, I modified the code

export CPPFLAGS="-isystem home/palmyra/abyss/btllib-1.7.0/install/include:$CPPFLAGS"
export LDFLAGS="-L/home/palmyra/abyss/btllib-1.7.0/install/lib -lbtllib:$LDFLAGS"

and it still shows the same error:

checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in '/home/palmyra/abyss/build':
configure: error: C++ compiler cannot create executables

Is there anyway I can revert, I mean to remove these flags?

You could try installing it with conda:

conda install -c bioconda abyss

If you still want to compile it, I would try activating a conda environment and installing the requirements as suggested in the docs:

conda install -c conda-forge compilers
conda install -c conda-forge boost openmpi
conda install -c bioconda google-sparsehash btllib

Thank you Raony Guimarães , I have previously used conda for installing abyss and other dependencies but I was not able to reach as far I have been now with linuxbrew. Actually, I am now struggling with compiling btllib-1.7. I am not able to comprehend the error report. I have edited the question. Can you please take a look at it?

Hi there, I checked and saw that there were a few errors with compiling it recently on macOS. so my suggestions would be, to check this building script:

https://github.com/bioconda/bioconda-recipes/blob/master/recipes/btllib/build_failure.osx-64.yaml

https://github.com/bioconda/bioconda-recipes/blob/master/recipes/btllib/build.sh

Try using an older version 1.6.1, 1.6.0 or 1.4 of btlib:

btllib v1.6.1

Added coverage tests
Fixed compilation issues when using GCC on macOS

Upgrade your GCC: GCC 6+ or Clang 5+ (with OpenMP and C++17 support)

https://bcgsc.github.io/btllib/

https://github.com/bcgsc/btllib/releases

Maybe try to use the flag -std=c++1z

https://stackoverflow.com/questions/3603461/is-there-a-specific-reason-nested-namespace-declarations-are-not-allowed-in-c

And please make sure you are using the latest version off gcc with support to C++17

https://github.com/bcgsc/btllib/issues/90

https://github.com/bcgsc/btllib/pull/88

Log in to answer this question.