MrBayes is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. For documentation and downloading the program, please see the home page:
The configure scripts detects the extensions provided by the build host CPU and builds code utilizing them, disregarding the characteristics of the target machine specified by CFLAGS.
For example:
./configure CFLAGS='-march=x86-64'
specifies that the executable should work on a generic x86-64 machine. However, the configure script appends a number of flags incompatible with the generic x86-64 target, plus compiles code incompatible with it:
Only code compatible with the selected target should be built.
How may we reproduce this bug?
Steps to reproduce the bug:
./configure CFLAGS='-march=x86-64'
make
Would you be able to compile and run MrBayes to test fixes to this bug?
[x] Yes, I know how to use git and how to compile MrBayes.
[ ] No, sorry.
What is the environment that you run MrBayes in?
Operating system (including variant and release): Gentoo Linux
Version of MrBayes: verified on 586f3104cb5d4b33f62edb1e41b2f27bebfbea7a
If possible, include the output of the Version command in MrBayes below:
---------------------------------------------------------------------------
Version
MrBayes 3.2.7a
Features: readline
Host type: x86_64-unknown-linux-gnu (CPU: x86_64)
Compiler: gnu 11.2.1
---------------------------------------------------------------------------
Other information that may be of use to us in resolving this issue
In my opinion, there are two main solutions to the problem. Either:
Use compiler macros to determine which extensions are requested via CFLAGS, e.g. #if defined(__SSE2__) and so on. You can use e.g. clang -march=... -dM -E -x c /dev/null to see what flags are available for the given CPU.
Call cpuid at runtime to determine which extensions are available. Build the respective optimized functions unconditionally and use attributes to enable necessary compiler instructions locally, and then check cpuid to determine which function to call.
In either case, AX_EXT is completely broken by design and should never be used. You shouldn't forcibly append -m flags either as that breaks the ability to compile MrBayes for CPU other than the one currently used.
What is the current observed behaviour?
The configure scripts detects the extensions provided by the build host CPU and builds code utilizing them, disregarding the characteristics of the target machine specified by CFLAGS.
For example:
specifies that the executable should work on a generic x86-64 machine. However, the configure script appends a number of flags incompatible with the generic x86-64 target, plus compiles code incompatible with it:
What is the expected/wanted behaviour?
Only code compatible with the selected target should be built.
How may we reproduce this bug?
Steps to reproduce the bug:
./configure CFLAGS='-march=x86-64'
make
Would you be able to compile and run MrBayes to test fixes to this bug?
git
and how to compile MrBayes.What is the environment that you run MrBayes in?
If possible, include the output of the
Version
command in MrBayes below:Other information that may be of use to us in resolving this issue
In my opinion, there are two main solutions to the problem. Either:
#if defined(__SSE2__)
and so on. You can use e.g.clang -march=... -dM -E -x c /dev/null
to see what flags are available for the given CPU.cpuid
at runtime to determine which extensions are available. Build the respective optimized functions unconditionally and use attributes to enable necessary compiler instructions locally, and then checkcpuid
to determine which function to call.In either case,
AX_EXT
is completely broken by design and should never be used. You shouldn't forcibly append-m
flags either as that breaks the ability to compile MrBayes for CPU other than the one currently used.