conda-forge / ctng-compiler-activation-feedstock

A conda-smithy repository for ctng-compiler-activation.
BSD 3-Clause "New" or "Revised" License
13 stars 22 forks source link

g++ cannot find sys/auxv.h on ubuntu 18.04 #88

Closed awf closed 1 year ago

awf commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Without conda, and desired behaviour, albeit with system g++

ubuntu-18.04$ which g++
/usr/bin/g++

ubuntu-18.04$ g++ -V
g++: error: unrecognized command line option ‘-V’
g++: fatal error: no input files
compilation terminated.

ubuntu-18.04$ g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ubuntu-18.04$ echo '#include <sys/auxv.h>' | g++ -c -x c++ -

ubuntu-18.04$ 

With conda

ubuntu-18.04$ conda activate base
(base) ubuntu-18.04$ conda update conda
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

(base) ubuntu-18.04$ conda -V
conda 22.11.1

(base) ubuntu-18.04$ conda create -n gcc5
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/awf/miniconda3/envs/gcc5

Proceed ([y]/n)? 

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate gcc5
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) ubuntu-18.04$ conda activate gcc5

(gcc5) ubuntu-18.04$ conda install cxx-compiler
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/awf/miniconda3/envs/gcc5

  added / updated specs:
    - cxx-compiler

The following NEW packages will be INSTALLED:

  _libgcc_mutex      conda-forge/linux-64::_libgcc_mutex-0.1-conda_forge 
  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-2_gnu 
  binutils           conda-forge/linux-64::binutils-2.39-hdd6e379_1 
  binutils_impl_lin~ conda-forge/linux-64::binutils_impl_linux-64-2.39-he00db2b_1 
  binutils_linux-64  conda-forge/linux-64::binutils_linux-64-2.39-h5fc0e48_11 
  c-compiler         conda-forge/linux-64::c-compiler-1.5.2-h0b41bf4_0 
  cxx-compiler       conda-forge/linux-64::cxx-compiler-1.5.2-hf52228f_0 
  gcc                conda-forge/linux-64::gcc-11.3.0-h02d0930_11 
  gcc_impl_linux-64  conda-forge/linux-64::gcc_impl_linux-64-11.3.0-hab1b70f_19 
  gcc_linux-64       conda-forge/linux-64::gcc_linux-64-11.3.0-he6f903b_11 
  gxx                conda-forge/linux-64::gxx-11.3.0-h02d0930_11 
  gxx_impl_linux-64  conda-forge/linux-64::gxx_impl_linux-64-11.3.0-hab1b70f_19 
  gxx_linux-64       conda-forge/linux-64::gxx_linux-64-11.3.0-hc203a17_11 
  kernel-headers_li~ conda-forge/noarch::kernel-headers_linux-64-2.6.32-he073ed8_15 
  ld_impl_linux-64   conda-forge/linux-64::ld_impl_linux-64-2.39-hcc3a1bd_1 
  libgcc-devel_linu~ conda-forge/linux-64::libgcc-devel_linux-64-11.3.0-h210ce93_19 
  libgcc-ng          conda-forge/linux-64::libgcc-ng-12.2.0-h65d4601_19 
  libgomp            conda-forge/linux-64::libgomp-12.2.0-h65d4601_19 
  libsanitizer       conda-forge/linux-64::libsanitizer-11.3.0-h239ccf8_19 
  libstdcxx-devel_l~ conda-forge/linux-64::libstdcxx-devel_linux-64-11.3.0-h210ce93_19 
  libstdcxx-ng       conda-forge/linux-64::libstdcxx-ng-12.2.0-h46fd767_19 
  sysroot_linux-64   conda-forge/noarch::sysroot_linux-64-2.12-he073ed8_15 

Proceed ([y]/n)? 

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(gcc5) ubuntu-18.04$ which g++ # good outcome
/home/awf/miniconda3/envs/gcc5/bin/g++

(gcc5) ubuntu-18.04$ g++ --version  # good outcome - version 11.3.0
g++ (conda-forge gcc 11.3.0-19) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(gcc5) ubuntu-18.04$ echo '#include <sys/auxv.h>' | g++ -c -x c++ - # bad outcome
<stdin>:1:10: fatal error: sys/auxv.h: No such file or directory
compilation terminated.

With conda, sys/auxv.h is not found.

.condarc is:

(gcc5) ubuntu-18.04$ cat ~/.condarc 
channels:
  - conda-forge
  - defaults
channel_priority: strict

Installed packages

gcc5) ubuntu-18.04$ conda list
# packages in environment at /home/awf/miniconda3/envs/gcc5:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
binutils                  2.39                 hdd6e379_1    conda-forge
binutils_impl_linux-64    2.39                 he00db2b_1    conda-forge
binutils_linux-64         2.39                h5fc0e48_11    conda-forge
c-compiler                1.5.2                h0b41bf4_0    conda-forge
cxx-compiler              1.5.2                hf52228f_0    conda-forge
gcc                       11.3.0              h02d0930_11    conda-forge
gcc_impl_linux-64         11.3.0              hab1b70f_19    conda-forge
gcc_linux-64              11.3.0              he6f903b_11    conda-forge
gxx                       11.3.0              h02d0930_11    conda-forge
gxx_impl_linux-64         11.3.0              hab1b70f_19    conda-forge
gxx_linux-64              11.3.0              hc203a17_11    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
ld_impl_linux-64          2.39                 hcc3a1bd_1    conda-forge
libgcc-devel_linux-64     11.3.0              h210ce93_19    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libsanitizer              11.3.0              h239ccf8_19    conda-forge
libstdcxx-devel_linux-64  11.3.0              h210ce93_19    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
sysroot_linux-64          2.12                he073ed8_15    conda-forge

Environment info

(gcc5) ubuntu-18.04$ conda info

     active environment : gcc5
    active env location : /home/awf/miniconda3/envs/gcc5
            shell level : 2
       user config file : /home/awf/.condarc
 populated config files : /home/awf/.condarc
          conda version : 22.11.1
    conda-build version : not installed
         python version : 3.8.15.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.27=0
                          __linux=5.4.0=0
                          __unix=0=0
       base environment : /home/awf/miniconda3  (writable)
      conda av data dir : /home/awf/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/awf/miniconda3/pkgs
                          /home/awf/.conda/pkgs
       envs directories : /home/awf/miniconda3/envs
                          /home/awf/.conda/envs
               platform : linux-64
             user-agent : conda/22.11.1 requests/2.28.1 CPython/3.8.15 Linux/5.4.0-64-generic ubuntu/18.04.6 glibc/2.27
                UID:GID : 2753:501
             netrc file : None
           offline mode : False
isuruf commented 1 year ago

You need to install sysroot_linux-64>=2.16 to get sys/auxv.h.

awf commented 1 year ago

Thanks, that helps me.

Specifically:

conda install cxx-compiler
conda update sysroot_linux-64

Would it be possible for the install to warn if the system libc is newer than the cxx-compiler one?