-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Abstract
We currently use Configure.TryRun() to test for various configuration properties in SConstruct. For example, to find the versions of our dependent libraries. Since an executable has to be compiled and executed this doesn't work for cross-compiling, since the compiled program can't be executed on the foreign architecture. This causes us to maintain patches to SConstruct for the conda-forge recipe that require fairly constant upkeep. Ideally, we could find a way to ensure the compilers are configured correctly and all the versions for our dependencies without running a program.
Motivation
For the conda-forge recipe, we maintain several patches for SConstruct that essentially hard code different dependency versions to avoid having to run compiled programs to determine configuration options. Since these are simple diff patches, they regularly conflict with ongoing changes to SConstruct, forcing us to recreate them. I want to see if we can eliminate the need for TryRun() or at least find a way to turn it into a no-op when we're cross-compiling.
Possible Solutions
It should be possible to retrieve dependency versions out of header files using the -E or /E flags to gcc/clang and msvc, respectively. That flag runs only the pre-processor, so by including the relevant header file and then the relevant #defines, we should be able to print the versions and extract them without actually running the program. SCons also has a built-in class to run the preprocessor: https://scons.org/doc/4.8.0/HTML/scons-api/_modules/SCons/cpp/#PreProcessor
References
Note: cross-compiling means using a compiler that produces machine code for an architecture different than the compiler itself. It is distinct from emulating, where there is no problem running executables (although they're naturally much slower to execute).