[Users] Error on the linking phase on compilation in a virtual environment
José Ferreira
jpmferreira at ua.pt
Wed Jun 12 13:04:49 CDT 2024
Hello Roland,
Thanks for the reply, and apologies for not including all relevant
information.
One of the things is that I forgot to mention that conda (in this case,
micromamba, a drop-in alternative that is fully compatible) sets some
environmental variables by itself. Obviously, some of them are are the
overwritten with whatever is on the |.cfg| file.
It turns out that micromamba sets |$LD| to point towards the |ld| binary
provided by the virtual environment
Adding |LD = g++| as you suggested resulted in a slightly different error
|Creating cactus_empty in /home/undercover/projects/cactus/exe from
/home/undercover/.micromamba/envs/phd/bin/../lib/gcc/x86_64-conda-linux-gnu/11.4.0/../../../../x86_64-conda-linux-gnu/bin/ld:
cannot find -lz: No such file or directory collect2: error: ld returned
1 exit status make[1]: ***
[/home/undercover/projects/cactus/lib/make/make.configuration:150:
/home/undercover/projects/cactus/exe/cactus_empty] Error 1 make: ***
[Makefile:265: empty] Error 2 |
To avoid back and forth between e-mails, and to add some information
that was previously missing, here are the steps that I take to reproduce
the error
1.
Create a new conda environment and activate it (in my machine it’s
called “phd”)
2.
|conda install gcc gxx gfortran openmpi openmpi-mpicc openmpi-mpicxx
openmpi-mpifort binutils|
3.
Compile the toolkit with the thornlist |empty.th| and the options
file |venv.cfg|, both attached again to this e-mail
4.
Configuration is created without any issues, with the terminal
output attached to |empty.log| (this file was missing in the
previous e-mail), and get the error making the binary, with the
terminal output attached in |cactus_empty.log|
Further relevant information about the running status of the machine:
*
Environmental variables: see file |env.txt| which includes a
stripped down version of the environmental variables. For instance,
you can see that |$LD| is set and carries on with its value during
compilation, but |$LDFLAGS|, |$CFLAGS| and |$CXXFLAGS| are
overwritten by whatever is in the |venv.cfg|. Even if I concatenate
the environmental variables from the shell with the ones from the
options file, it still doesn’t work.
*
OS: Manjaro
*
Kernel: Linux legion 5.10.218-1-MANJARO #1 SMP PREEMPT Mon May 27
02:19:19 UTC 2024 x86_64 GNU/Linux
*
CPU: Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz (quad core)
*
Package Manager: Micromamba
<https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html>
using the conda-forge <https://conda-forge.org/packages/> repositories
It should be noted that I am able of replicating this bug on my laptop
(this machine) and two different desktops that are both running Arch Linux.
This is not totally unexpected considering they are very similar OS’s
with the same versions of the software that is being used.
I hope that I could make it as clear as possible.
Best regards,
José Ferreira
On 12/06/24 15:59, Roland Haas wrote:
> Hello Jose,
>
> Cactus uses the C++ compiler to link things.
>
> This is controlled by the LD option list option.
>
> In your option list (thank you for including it) you do not set it, so
> it should default to the value of CXX.
>
> However if there is an environment variable LD set, then this will
> override the option list default (you'd see eg LD in the output of the
> env command).
>
> So as a first try, I'd add
>
> LD = g++
>
> to your option list and recompile from scratch.
>
> If that does not help, then more information will be required. Please
> see:
>
> http://einsteintoolkit.org/support.html#general-guidelines-for-questions
>
> for what to include.
>
> Yours,
> Roland
>
> On Wed, 12 Jun 2024 15:51:13 +0100, José Ferreira wrote:
>> Dear toolkit users and developers,
>>
>>
>> With the latest update of GCC to version 14, there is a known error
>> that prevents the compilation from taking place, preventing me from
>> compiling the toolkit.
>>
>> I’ve been trying to do something which I probably should have some
>> time ago to avoid this kind of issues, while also granting some
>> portability between machines, which is to setup a virtual environment
>> using Conda to compile the toolkit.
>>
>>
>> I am sending you this e-mail because I’ve failed to compile the
>> toolkit in a virtual environment, where I am currently stuck with an
>> error during the linking phase. Before the update to GCC 14, and
>> without the virtual environment, I was able of compiling the toolkit
>> without any issue.
>>
>> Here are the steps that I have performed:
>>
>> 1.
>>
>> Activate an empty virtual environment managed by a conda (or a
>> drop-in replacement) with the conda-forge repository configured
>>
>> 2.
>>
>> |conda install gcc gxx gfortran openmpi openmpi-mpicc
>> openmpi-mpicxx openmpi-mpifort binutils|
>>
>> 3.
>>
>> Compile the toolkit with an empty thornlist, attached in
>> |empty.th|, and an option file that points towards the virtual
>> environment that is activated, attached in |venv.cfg|
>>
>> 4.
>>
>> Get the following error from |ld| (the full log for making the
>> config and the binary are attached in |cactus_empty.log|)
>>
>> |Creating cactus_empty in /home/undercover/projects/cactus/exe from
>> /home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ld:
>> unrecognised emulation mode: arch=native Supported emulations:
>> elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu make[1]: ***
>> [/home/undercover/projects/cactus/lib/make/make.configuration:150:
>> /home/undercover/projects/cactus/exe/cactus_empty] Error 1 make: ***
>> [Makefile:265: empty] Error 2 |
>>
>>
>> To me, the previous error indicates that something is passing the
>> wrong flags to |ld|, because even if the emulation mode was not
>> recognized it should give the error |ld: unrecognised emulation mode:
>> <something>| instead of |ld: unrecognised emulation mode:
>> arch=<something>|.
>>
>> Removing the flag |-march=native| from the compilers confirms my
>> guess by revealing a different error at the same stage
>>
>> |Creating cactus_empty in /home/undercover/projects/cactus/exe from
>> /home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ld:
>> unrecognized option '-DMPICH_IGNORE_CXX_SEEK'
>> /home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ld:
>> use the --help option for usage information make[1]: ***
>> [/home/undercover/projects/cactus/lib/make/make.configuration:150:
>> /home/undercover/projects/cactus/exe/cactus_empty] Error 1 make: ***
>> [Makefile:265: empty] Error 2 |
>>
>> and if I were to remove the corresponding flag in the config file,
>> |ld| will complain about something else.
>>
>> It really seems like something is passing the flags onto |ld| where
>> it shouldn’t, but I cannot tell who and where.
>>
>>
>> I should note that compiling very basic programs in C in the virtual
>> environment doesn’t raise any issues, although I haven’t tested it
>> very thoroughly.
>>
>> Please do let me know if you have any issues in rendering this e-mail!
>>
>>
>> Best regards,
>>
>> José Ferreira
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/users/attachments/20240612/4cc0d185/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cactus_empty.log
Type: text/x-log
Size: 10633 bytes
Desc: not available
URL: <http://lists.einsteintoolkit.org/pipermail/users/attachments/20240612/4cc0d185/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: empty.log
Type: text/x-log
Size: 11594 bytes
Desc: not available
URL: <http://lists.einsteintoolkit.org/pipermail/users/attachments/20240612/4cc0d185/attachment-0003.bin>
-------------- next part --------------
# Cactus configuration for virtual environments managed by conda
# change libraries location to match your virtual environment below!
# list of conda packages installed from conda-forge:
# - binutils
# - libjpeg-turbo
# - gsl
# - hdf5
# - openmpi openmpi-mpicc openmpi-mpicxx openmpi-mpifort
# - gcc gxx gfortran
## Decide which flags will be used at compile-time
OPTIMISE = yes
WARN = yes
DEBUG = no
PROFILE = no
OPENMP = yes
## Preprocessors and Compilers
CPP = cpp
FPP = cpp
CC = gcc
CXX = g++
F77 = gfortran
F90 = gfortran
## Default flags
CPPFLAGS = -DMPICH_IGNORE_CXX_SEEK
FPPFLAGS = -traditional
CFLAGS = -g3 -march=native -std=gnu99
CXXFLAGS = -g3 -march=native -std=gnu++0x
F77FLAGS = -g3 -march=native -fcray-pointer -m128bit-long-double -ffixed-line-length-none -fno-range-check
F90FLAGS = -g3 -march=native -fcray-pointer -m128bit-long-double -ffixed-line-length-none -fno-range-check
LDFLAGS = -rdynamic
## Optimization flags
CPP_OPTIMISE_FLAGS = -DKRANC_VECTORS # -DCARPET_OPTIMISE -DNDEBUG
FPP_OPTIMISE_FLAGS = # -DCARPET_OPTIMISE -DNDEBUG
C_OPTIMISE_FLAGS = -Ofast
CXX_OPTIMISE_FLAGS = -Ofast
F77_OPTIMISE_FLAGS = -Ofast
F90_OPTIMISE_FLAGS = -Ofast
## Warning flags
CPP_WARN_FLAGS = -Wall
FPP_WARN_FLAGS = -Wall
C_WARN_FLAGS = -Wall
CXX_WARN_FLAGS = -Wall
F77_WARN_FLAGS = -Wall
F90_WARN_FLAGS = -Wall
## Debug flags
CPP_DEBUG_FLAGS = -DCARPET_DEBUG -fsanitize=undefined -fsanitize=thread
FPP_DEBUG_FLAGS = -DCARPET_DEBUG -fsanitize=undefined -fsanitize=thread
C_DEBUG_FLAGS = -O0 -fsanitize=undefined -fsanitize=thread
CXX_DEBUG_FLAGS = -O0 -fsanitize=undefined -fsanitize=thread
F77_DEBUG_FLAGS = -O0 -fsanitize=undefined -fsanitize=thread
F90_DEBUG_FLAGS = -O0 -fsanitize=undefined -fsanitize=thread
## Code profiling flags
CPP_PROFILE_FLAGS =
FPP_PROFILE_FLAGS =
C_PROFILE_FLAGS = -pg
CXX_PROFILE_FLAGS = -pg
F77_PROFILE_FLAGS = -pg
F90_PROFILE_FLAGS = -pg
## OpenMP
CPP_OPENMP_FLAGS = -fopenmp
FPP_OPENMP_FLAGS = -fopenmp
C_OPENMP_FLAGS = -fopenmp
CXX_OPENMP_FLAGS = -fopenmp
F77_OPENMP_FLAGS = -fopenmp
F90_OPENMP_FLAGS = -fopenmp
## Libraries location
LIBDIRS = # ?
MPI_DIR = /home/undercover/.micromamba/envs/phd/
HDF5_DIR = /home/undercover/.micromamba/envs/phd/
GSL_DIR = /home/undercover/.micromamba/envs/phd/
HWLOC_DIR = /home/undercover/.micromamba/envs/phd/
PTHREADS_DIR = /home/undercover/.micromamba/envs/phd/
LIBJPEG_DIR = /home/undercover/.micromamba/envs/phd/
LIBS = gfortran open-pal z # ?
C_LINE_DIRECTIVES = yes # ?
F_LINE_DIRECTIVES = yes # ?
-------------- next part --------------
!CRL_VERSION = 1.0
!DEFINE ROOT = Cactus
!DEFINE ARR = $ROOT/arrangements
!DEFINE COMPONENTLIST_TARGET = $ROOT/thornlists/
!DEFINE ET_RELEASE = ET_2023_05
-------------- next part --------------
LOGNAME=undercover
HOME=/home/undercover
USER=undercover
CACTUS_ROOT=/home/undercover/projects/cactus
MAMBA_EXE=/usr/bin/micromamba
MAMBA_ROOT_PREFIX=/home/undercover/.micromamba
CONDA_SHLVL=1
CONDA_BACKUP_HOST=legion
HOST=x86_64-conda-linux-gnu
CONDA_PREFIX=/home/undercover/.micromamba/envs/phd
CONDA_DEFAULT_ENV=phd
CONDA_PROMPT_MODIFIER=(phd)
ADDR2LINE=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-addr2line
AR=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ar
AS=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-as
CXXFILT=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-c++filt
ELFEDIT=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-elfedit
GPROF=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gprof
LD=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ld
LD_GOLD=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ld.gold
NM=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-nm
OBJCOPY=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-objcopy
OBJDUMP=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-objdump
RANLIB=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ranlib
READELF=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-readelf
SIZE=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-size
STRINGS=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-strings
STRIP=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-strip
BUILD=x86_64-conda-linux-gnu
CONDA_TOOLCHAIN_HOST=x86_64-conda-linux-gnu
CONDA_TOOLCHAIN_BUILD=x86_64-conda-linux-gnu
CC=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-cc
CPP=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-cpp
GCC=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc
GCC_AR=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-ar
GCC_NM=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-nm
GCC_RANLIB=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-ranlib
CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/undercover/.micromamba/envs/phd/include
CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include
LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/home/undercover/.micromamba/envs/phd/lib -Wl,-rpath-link,/home/undercover/.micromamba/envs/phd/lib -L/home/undercover/.micromamba/envs/phd/lib
DEBUG_CPPFLAGS=-D_DEBUG -D_FORTIFY_SOURCE=2 -Og -isystem /home/undercover/.micromamba/envs/phd/include
DEBUG_CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include
CMAKE_PREFIX_PATH=/home/undercover/.micromamba/envs/phd:/home/undercover/.micromamba/envs/phd/x86_64-conda-linux-gnu/sysroot/usr
_CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_conda_cos6_linux_gnu
CONDA_BUILD_SYSROOT=/home/undercover/.micromamba/envs/phd/x86_64-conda-linux-gnu/sysroot
CC_FOR_BUILD=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-cc
build_alias=x86_64-conda-linux-gnu
host_alias=x86_64-conda-linux-gnu
MESON_ARGS=--buildtype release
CMAKE_ARGS=-DCMAKE_AR=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ar -DCMAKE_CXX_COMPILER_AR=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-ar -DCMAKE_C_COMPILER_AR=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-ar -DCMAKE_RANLIB=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ranlib -DCMAKE_CXX_COMPILER_RANLIB=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-ranlib -DCMAKE_C_COMPILER_RANLIB=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gcc-ranlib -DCMAKE_LINKER=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-ld -DCMAKE_STRIP=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-strip -DCMAKE_BUILD_TYPE=Release
GFORTRAN=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gfortran
F95=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-f95
FC_FOR_BUILD=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gfortran
FFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include
FORTRANFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include
DEBUG_FFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments -ffunction-sections -pipe
DEBUG_FORTRANFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments -ffunction-sections -pipe
FC=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gfortran
F77=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gfortran
F90=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-gfortran
CXX=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-c++
GXX=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-g++
CXXFLAGS=-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include
DEBUG_CXXFLAGS=-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -ffunction-sections -pipe -isystem /home/undercover/.micromamba/envs/phd/include
CXX_FOR_BUILD=/home/undercover/.micromamba/envs/phd/bin/x86_64-conda-linux-gnu-c++
XML_CATALOG_FILES=file:///home/undercover/.micromamba/envs/phd/etc/xml/catalog file:///etc/xml/catalog
_=/usr/bin/env
More information about the Users
mailing list