This error, OF COURSE, was due to conda not using my system gcc etc, but I think it's good to have this round of misery archived in case I forget. (Also, my new favorite bash comannd is "history", lol )
So as always use (as many times as needed):
conda deactivate
In my case, it didn't deactivate the first time, instead it brought me back [base] which is the worst possible place to be :). In fact this:
conda config --set auto_activate_base false
seems like a good solution.
Then it turns this is some kind of math library problem, so what I did is to replace
-lm
with
-ldl -lmvec -lm
in the Makefile of what I was compiling. After that it compiled fine without further complaints.
I think at one point I also did as suggested here (which honestly I don't know if it was needed because i deactivated conda afterwards, so it could be just conda and the Makefile that did the trick):
EXPORT CFLAGS=" -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -funroll-all-loops";
which for me looked like:
bash -c " export CFLAGS=" -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -funroll-all-loops""
and (as suggested here)
ldd -r /home/denijane/anaconda3/envs/BAO/x86_64-conda-linux-gnu/sysroot/lib64/libdl.so.2